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
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
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("../test/SPIKE_Sync_Test.txt",
time_interval=(0, 4000))
plt.figure()
f = spk.spike_sync_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
plt.plot(x, y, '--ok', label="SPIKE-SYNC profile")
print(f.x)
print(f.y)
print(f.mp)
print("Average:", f.avrg())
f = spk.spike_profile(spike_trains[0], spike_trains[1])
x, y = f.get_plottable_data()
plt.plot(x, y, '-b', label="SPIKE-profile")
plt.axis([0, 4000, -0.1, 1.1])
plt.legend(loc="center right")
plt.figure()
plt.subplot(211)
f = spk.spike_sync_profile_multi(spike_trains)
x, y = f.get_plottable_data()
plt.plot(x, y, '-b', alpha=0.7, label="SPIKE-Sync profile")
x1, y1 = f.get_plottable_data(averaging_window_size=50)
plt.plot(x1, y1, '-k', lw=2.5, label="averaged SPIKE-Sync profile")
plt.subplot(212)
f_psth = spk.psth(spike_trains, bin_size=5.0)
x, y = f_psth.get_plottable_data()
plt.plot(x, y, '-k', alpha=1.0, label="PSTH")
print("Average:", f.avrg())
plt.show()
|