Skip to content

Commit

Permalink
use trial object in UE tutorial
Browse files Browse the repository at this point in the history
  • Loading branch information
Moritz-Alexander-Kern committed Oct 9, 2024
1 parent 2d4f92d commit 1f36584
Showing 1 changed file with 7 additions and 12 deletions.
19 changes: 7 additions & 12 deletions doc/tutorials/unitary_event_analysis.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
"\n",
"import elephant.unitary_event_analysis as ue\n",
"from elephant.datasets import download_datasets\n",
"from elephant.trials import TrialsFromBlock\n",
"\n",
"# Fix random seed to guarantee fixed output\n",
"random.seed(1224)"
Expand Down Expand Up @@ -451,10 +452,7 @@
"io = neo.io.NixIO(f\"{filepath}\",'ro')\n",
"block = io.read_block()\n",
"\n",
"spiketrains = []\n",
"# each segment contains a single trial\n",
"for ind in range(len(block.segments)):\n",
" spiketrains.append (block.segments[ind].spiketrains)\n"
"spiketrains = TrialsFromBlock(block)\n"
]
},
{
Expand All @@ -473,19 +471,16 @@
"UE = ue.jointJ_window_analysis(\n",
" spiketrains, bin_size=5*pq.ms, win_size=100*pq.ms, win_step=10*pq.ms, pattern_hash=[3])\n",
"\n",
"plot_ue(spiketrains, UE, significance_level=0.05)\n",
"plt.show()"
"plot_ue([spiketrains.get_spiketrains_from_trial_as_list(idx) for idx in range(spiketrains.n_trials)], UE, significance_level=0.05)\n",
"plt.show()\n"
]
}
],
"metadata": {
"interpreter": {
"hash": "623e048a0474aa032839f97d38ba0837cc9041adc49a14b480c72f2df8ea99e3"
},
"kernelspec": {
"display_name": "inm-elephant",
"display_name": "Python 3",
"language": "python",
"name": "inm-elephant"
"name": "python3"
},
"language_info": {
"codemirror_mode": {
Expand All @@ -497,7 +492,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.8.10"
"version": "3.12.5"
},
"latex_envs": {
"LaTeX_envs_menu_present": true,
Expand Down

0 comments on commit 1f36584

Please sign in to comment.