Skip to content

Commit

Permalink
add plot to notebook
Browse files Browse the repository at this point in the history
  • Loading branch information
leon committed Sep 18, 2023
1 parent ccf9d26 commit 6d42f4a
Show file tree
Hide file tree
Showing 10 changed files with 65 additions and 293 deletions.
2 changes: 1 addition & 1 deletion notebooks/doc.ipynb

Large diffs are not rendered by default.

64 changes: 64 additions & 0 deletions org/doc.org
Original file line number Diff line number Diff line change
Expand Up @@ -146,3 +146,67 @@ Then one just runs the model with
saving data to /home/leon/tmp/rnn_numba/data/simul/test.h5
Elapsed (with compilation) = 7.218026272952557s
#+end_example


** analysis

#+begin_src ipython
import pandas as pd
from src.analysis.decode import decode_bump
#+end_src

#+RESULTS:

#+begin_src ipython
df = pd.read_hdf("/home/leon/tmp/rnn_numba/data/simul/test.h5", mode="r")
print(df.head())
#+end_src

#+RESULTS:
: rates ff h_E neurons time
: 0 3.899561 3.440118 -5.947128 0 0.499
: 1 1.512104 -1.030196 -5.946676 1 0.499
: 2 4.634333 8.938921 -5.946227 2 0.499
: 3 3.354177 8.559323 -5.945780 3 0.499
: 4 1.629222 -2.949507 -5.945335 4 0.499

#+begin_src ipython
data = df.groupby(['time'])['rates'].apply(decode_bump).reset_index()
data[['m0', 'm1', 'phase']] = pd.DataFrame(data['rates'].tolist(), index=data.index)
data = data.drop(columns=['rates'])

print(data.head())
#+end_src

#+RESULTS:
: time m0 m1 phase
: 0 0.499 2.169205 0.090843 5.330103
: 1 0.999 2.160349 0.099340 1.362622
: 2 1.499 6.259074 7.082152 3.131938
: 3 1.999 5.858699 5.441624 3.103535
: 4 2.499 5.864153 5.443271 3.108716

#+begin_src ipython
fig, ax = plt.subplots(1, 3, figsize=[2*width, height])

sns.lineplot(data=data, x='time', y='m0', legend=False, lw=2, ax=ax[0])
ax[0].set_xlabel('Time (s)')
ax[0].set_ylabel('$\mathcal{F}_0 (Hz)$')
ax[1].set_xticks([0, 1, 2, 3, 4])

sns.lineplot(x=data['time'], y=data['m1']/data['m0'], legend=False, lw=2, ax=ax[1])
ax[1].set_xlabel('Time (s)')
ax[1].set_ylabel('$\mathcal{F}_1 / \mathcal{F}_0$')
ax[1].set_xticks([0, 1, 2, 3, 4])

sns.lineplot(x=data['time'], y=data['phase']*180/np.pi, legend=False, lw=2, ax=ax[2])
ax[2].set_xlabel('Time (s)')
ax[2].set_ylabel('$\phi$ (°)')
ax[2].set_xticks([0, 1, 2, 3, 4])
ax[2].set_yticks([0, 90, 180, 270, 360])
plt.show()

#+end_src

#+RESULTS:
[[file:./.ob-jupyter/7403f6ea654a97566db3dd1a7c8dffd5322bb6cd.png]]
22 changes: 0 additions & 22 deletions src/analysis/pev.py

This file was deleted.

38 changes: 0 additions & 38 deletions src/loops/bump_I0.py

This file was deleted.

24 changes: 0 additions & 24 deletions src/loops/bump_I0_J0.py

This file was deleted.

29 changes: 0 additions & 29 deletions src/loops/bump_I0_S0.py

This file was deleted.

24 changes: 0 additions & 24 deletions src/loops/bump_J0_J1.py

This file was deleted.

86 changes: 0 additions & 86 deletions src/loops/bump_diff.py

This file was deleted.

46 changes: 0 additions & 46 deletions src/loops/bump_drift.py

This file was deleted.

23 changes: 0 additions & 23 deletions src/loops/bump_gain.py

This file was deleted.

0 comments on commit 6d42f4a

Please sign in to comment.