File: merge.py

package info (click to toggle)
python-pyspike 0.8.0%2Bdfsg-3.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 17,000 kB
  • sloc: python: 3,503; makefile: 147; sh: 19
file content (29 lines) | stat: -rw-r--r-- 737 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
""" merge.py

Simple example showing the merging of two spike trains.

Copyright 2014, Mario Mulansky <mario.mulansky@gmx.net>

Distributed under the BSD License
"""

from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

import pyspike as spk

# first load the data, ending time = 4000
spike_trains = spk.load_spike_trains_from_txt("PySpike_testdata.txt", 4000)

merged_spike_train = spk.merge_spike_trains([spike_trains[0], spike_trains[1]])

print(merged_spike_train.spikes)

plt.plot(spike_trains[0], np.ones_like(spike_trains[0]), 'o')
plt.plot(spike_trains[1], np.ones_like(spike_trains[1]), 'x')
plt.plot(merged_spike_train.spikes,
         2*np.ones_like(merged_spike_train), 'o')

plt.show()