|
46 | 46 | "\n", |
47 | 47 | "import elephant.unitary_event_analysis as ue\n", |
48 | 48 | "from elephant.datasets import download_datasets\n", |
| 49 | + "from elephant.trials import TrialsFromBlock\n", |
49 | 50 | "\n", |
50 | 51 | "# Fix random seed to guarantee fixed output\n", |
51 | 52 | "random.seed(1224)" |
|
451 | 452 | "io = neo.io.NixIO(f\"{filepath}\",'ro')\n", |
452 | 453 | "block = io.read_block()\n", |
453 | 454 | "\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" |
458 | 456 | ] |
459 | 457 | }, |
460 | 458 | { |
|
473 | 471 | "UE = ue.jointJ_window_analysis(\n", |
474 | 472 | " spiketrains, bin_size=5*pq.ms, win_size=100*pq.ms, win_step=10*pq.ms, pattern_hash=[3])\n", |
475 | 473 | "\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" |
478 | 476 | ] |
479 | 477 | } |
480 | 478 | ], |
481 | 479 | "metadata": { |
482 | | - "interpreter": { |
483 | | - "hash": "623e048a0474aa032839f97d38ba0837cc9041adc49a14b480c72f2df8ea99e3" |
484 | | - }, |
485 | 480 | "kernelspec": { |
486 | | - "display_name": "inm-elephant", |
| 481 | + "display_name": "Python 3", |
487 | 482 | "language": "python", |
488 | | - "name": "inm-elephant" |
| 483 | + "name": "python3" |
489 | 484 | }, |
490 | 485 | "language_info": { |
491 | 486 | "codemirror_mode": { |
|
497 | 492 | "name": "python", |
498 | 493 | "nbconvert_exporter": "python", |
499 | 494 | "pygments_lexer": "ipython3", |
500 | | - "version": "3.8.10" |
| 495 | + "version": "3.12.5" |
501 | 496 | }, |
502 | 497 | "latex_envs": { |
503 | 498 | "LaTeX_envs_menu_present": true, |
|
0 commit comments