diff options
author | Gard Spreemann <gspr@nonempty.org> | 2019-07-17 15:34:45 +0200 |
---|---|---|
committer | Gard Spreemann <gspr@nonempty.org> | 2019-07-17 15:34:45 +0200 |
commit | 7dafdd4535f44a6946592f22ead74bb6dbec8952 (patch) | |
tree | 4723ffb85d6d18fb589db65eb08771433a735e87 /examples/spike_sync.py | |
parent | d1f42d4be4676d76242e4148c06004cbf0b7cefa (diff) | |
parent | 34bd30415dd93a2425ce566627e24ee9483ada3e (diff) |
Merge tag '0.6.0' into debian/sid
Diffstat (limited to 'examples/spike_sync.py')
-rw-r--r-- | examples/spike_sync.py | 50 |
1 files changed, 50 insertions, 0 deletions
diff --git a/examples/spike_sync.py b/examples/spike_sync.py new file mode 100644 index 0000000..13ca0ce --- /dev/null +++ b/examples/spike_sync.py @@ -0,0 +1,50 @@ +from __future__ import print_function + +import matplotlib.pyplot as plt + +import pyspike as spk + +spike_trains = spk.load_spike_trains_from_txt("../test/SPIKE_Sync_Test.txt", + edges=(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(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=50.0) +x, y = f_psth.get_plottable_data() +plt.plot(x, y, '-k', alpha=1.0, label="PSTH") + + +print("Average:", f.avrg()) + +plt.show() |