diff --git a/doc/tutorials/unitary_event_analysis.ipynb b/doc/tutorials/unitary_event_analysis.ipynb index 2b5c161f5..5ae16d1ad 100644 --- a/doc/tutorials/unitary_event_analysis.ipynb +++ b/doc/tutorials/unitary_event_analysis.ipynb @@ -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)" @@ -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" ] }, { @@ -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": { @@ -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,