Skip to content

Commit 1f36584

Browse files
use trial object in UE tutorial
1 parent 2d4f92d commit 1f36584

File tree

1 file changed

+7
-12
lines changed

1 file changed

+7
-12
lines changed

doc/tutorials/unitary_event_analysis.ipynb

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"\n",
4747
"import elephant.unitary_event_analysis as ue\n",
4848
"from elephant.datasets import download_datasets\n",
49+
"from elephant.trials import TrialsFromBlock\n",
4950
"\n",
5051
"# Fix random seed to guarantee fixed output\n",
5152
"random.seed(1224)"
@@ -451,10 +452,7 @@
451452
"io = neo.io.NixIO(f\"{filepath}\",'ro')\n",
452453
"block = io.read_block()\n",
453454
"\n",
454-
"spiketrains = []\n",
455-
"# each segment contains a single trial\n",
456-
"for ind in range(len(block.segments)):\n",
457-
" spiketrains.append (block.segments[ind].spiketrains)\n"
455+
"spiketrains = TrialsFromBlock(block)\n"
458456
]
459457
},
460458
{
@@ -473,19 +471,16 @@
473471
"UE = ue.jointJ_window_analysis(\n",
474472
" spiketrains, bin_size=5*pq.ms, win_size=100*pq.ms, win_step=10*pq.ms, pattern_hash=[3])\n",
475473
"\n",
476-
"plot_ue(spiketrains, UE, significance_level=0.05)\n",
477-
"plt.show()"
474+
"plot_ue([spiketrains.get_spiketrains_from_trial_as_list(idx) for idx in range(spiketrains.n_trials)], UE, significance_level=0.05)\n",
475+
"plt.show()\n"
478476
]
479477
}
480478
],
481479
"metadata": {
482-
"interpreter": {
483-
"hash": "623e048a0474aa032839f97d38ba0837cc9041adc49a14b480c72f2df8ea99e3"
484-
},
485480
"kernelspec": {
486-
"display_name": "inm-elephant",
481+
"display_name": "Python 3",
487482
"language": "python",
488-
"name": "inm-elephant"
483+
"name": "python3"
489484
},
490485
"language_info": {
491486
"codemirror_mode": {
@@ -497,7 +492,7 @@
497492
"name": "python",
498493
"nbconvert_exporter": "python",
499494
"pygments_lexer": "ipython3",
500-
"version": "3.8.10"
495+
"version": "3.12.5"
501496
},
502497
"latex_envs": {
503498
"LaTeX_envs_menu_present": true,

0 commit comments

Comments
 (0)