summaryrefslogtreecommitdiff
path: root/doc/tutorial.rst
diff options
context:
space:
mode:
authorMario Mulansky <mario.mulansky@gmx.net>2018-09-20 10:49:42 -0700
committerGitHub <noreply@github.com>2018-09-20 10:49:42 -0700
commit34bd30415dd93a2425ce566627e24ee9483ada3e (patch)
treedcfa9164d46e3cf501a1e8dcf4970f350063561a /doc/tutorial.rst
parent44d23620d2faa78ca74437fbd3f1b95da722a853 (diff)
Spike Order support (#39)0.6.0
* reorganized directionality module * further refactoring of directionality * completed python directionality backend * added SPIKE-Sync based filtering new function filter_by_spike_sync removes spikes that have a multi-variate Spike Sync value below some threshold not yet fully tested, python backend missing. * spike sync filtering, cython sim ann Added function for filtering out events based on a threshold for the spike sync values. Usefull for focusing on synchronous events during directionality analysis. Also added cython version of simulated annealing for performance. * added coincidence single profile to python backend missing function in python backend added, identified and fixed a bug in the implementation as well * updated test case to new spike sync behavior * python3 fixes * another python3 fix * reorganized directionality module * further refactoring of directionality * completed python directionality backend * added SPIKE-Sync based filtering new function filter_by_spike_sync removes spikes that have a multi-variate Spike Sync value below some threshold not yet fully tested, python backend missing. * spike sync filtering, cython sim ann Added function for filtering out events based on a threshold for the spike sync values. Usefull for focusing on synchronous events during directionality analysis. Also added cython version of simulated annealing for performance. * added coincidence single profile to python backend missing function in python backend added, identified and fixed a bug in the implementation as well * updated test case to new spike sync behavior * python3 fixes * another python3 fix * Fix absolute imports in directionality measures * remove commented code * Add directionality to docs, bump version * Clean up directionality module, add doxy. * Remove debug print from tests * Fix bug in calling Python backend * Fix incorrect integrals in PieceWiseConstFunc (#36) * Add (some currently failing) tests for PieceWiseConstFunc.integral * Fix implementation of PieceWiseConstFunc.integral Just by adding a special condition for when we are only taking an integral "between" two edges of a PieceWiseConstFunc All tests now pass. Fixes #33. * Add PieceWiseConstFunc.integral tests for ValueError * Add testing bounds of integral * Raise ValueError in function implementation * Fix incorrect integrals in PieceWiseLinFunc (#38) Integrals of piece-wise linear functions were incorrect if the requested interval lies completely between two support points. This has been fixed, and a unit test exercising this behavior was added. Fixes #38 * Add Spike Order example and Tutorial section Adds an example computing spike order profile and the optimal spike train order. Also adds a section on spike train order to the tutorial.
Diffstat (limited to 'doc/tutorial.rst')
-rw-r--r--doc/tutorial.rst66
1 files changed, 66 insertions, 0 deletions
diff --git a/doc/tutorial.rst b/doc/tutorial.rst
index aff03a8..377c0a2 100644
--- a/doc/tutorial.rst
+++ b/doc/tutorial.rst
@@ -231,3 +231,69 @@ The following example computes and plots the ISI- and SPIKE-distance matrix as w
plt.title("SPIKE-Sync")
plt.show()
+
+
+Quantifying Leaders and Followers: Spike Train Order
+---------------------------------------
+
+PySpike provides functionality to quantify how much a set of spike trains
+resembles a synfire pattern (ie perfect leader-follower pattern). For details
+on the algorithms please see
+`our article in NJP <http://iopscience.iop.org/article/10.1088/1367-2630/aa68c3>`_.
+
+The following example computes the Spike Order profile and Synfire Indicator
+of two Poissonian spike trains.
+
+.. code:: python
+ import numpy as np
+ from matplotlib import pyplot as plt
+ import pyspike as spk
+
+
+ st1 = spk.generate_poisson_spikes(1.0, [0, 20])
+ st2 = spk.generate_poisson_spikes(1.0, [0, 20])
+
+ d = spk.spike_directionality(st1, st2)
+
+ print "Spike Directionality of two Poissonian spike trains:", d
+
+ E = spk.spike_train_order_profile(st1, st2)
+
+ plt.figure()
+ x, y = E.get_plottable_data()
+ plt.plot(x, y, '-ob')
+ plt.ylim(-1.1, 1.1)
+ plt.xlabel("t")
+ plt.ylabel("E")
+ plt.title("Spike Train Order Profile")
+
+ plt.show()
+
+Additionally, PySpike can also compute the optimal ordering of the spike trains,
+ie the ordering that most resembles a synfire pattern. The following example
+computes the optimal order of a set of 20 Poissonian spike trains:
+
+.. code:: python
+
+ M = 20
+ spike_trains = [spk.generate_poisson_spikes(1.0, [0, 100]) for m in xrange(M)]
+
+ F_init = spk.spike_train_order(spike_trains)
+ print "Initial Synfire Indicator for 20 Poissonian spike trains:", F_init
+
+ D_init = spk.spike_directionality_matrix(spike_trains)
+ phi, _ = spk.optimal_spike_train_sorting(spike_trains)
+ F_opt = spk.spike_train_order(spike_trains, indices=phi)
+ print "Synfire Indicator of optimized spike train sorting:", F_opt
+
+ D_opt = spk.permutate_matrix(D_init, phi)
+
+ plt.figure()
+ plt.imshow(D_init)
+ plt.title("Initial Directionality Matrix")
+
+ plt.figure()
+ plt.imshow(D_opt)
+ plt.title("Optimized Directionality Matrix")
+
+ plt.show()