summaryrefslogtreecommitdiff
path: root/examples/test_data.py
blob: dcd0f2056a7ca0ce48af3f81d960b20cb4340920 (plain)
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
30
31
32
33
34
# compute the isi distance of some test data

from __future__ import print_function

import numpy as np
import matplotlib.pyplot as plt

import pyspike as spk

spike_trains = spk.load_spike_trains_from_txt("SPIKY_testdata.txt", 
                                              time_interval=(0,4000))

# plot the spike time
for (i,spikes) in enumerate(spike_trains):
    plt.plot(spikes, i*np.ones_like(spikes), 'o')

f = spk.isi_distance(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()

plt.figure()
plt.plot(x, np.abs(y), '--k')

print("Average: %.8f" % f.avrg())
print("Absolute average: %.8f" % f.abs_avrg())


f = spk.spike_distance(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
print(x)
print(y)
#plt.figure()
plt.plot(x, y, '-b')

plt.show()