Source Code - Event Synchronization




Note that we recommend to use the new method SPIKE-synchronization instead of event synchronization. SPIKE-synchronization is based on the same adaptive coincidence detection used in event synchronization but it has a much nicer normalization with a more intuitive interpretation. Finally, it allows a straightforward and consistent extension to the case of more than two spike trains.

SPIKE-synchronization was proposed in this paper:

Kreuz T, Mulansky M, Bozanic N:
SPIKY: A graphical user interface for monitoring spike train synchrony.
JNeurophysiol 113, 3432 (2015) [PDF].

For a detailed description of its mathematical properties please refer to:

Mulansky M, Bozanic N, Sburlea A, Kreuz T:
A guide to time-resolved and parameter-free measures of spike train synchrony.
IEEE Proceeding on Event-based Control, Communication, and Signal Processing (EBCCSP), 1-8 and arXiv [PDF] (2015).



For a detailed description of event synchronization please refer to:

Quian Quiroga R, Kreuz T, and Grassberger P:
Event Synchronization: A simple and fast method to measure synchronicity and time delay patterns.
Phys.Rev. E, 66, 041904 (2002) [PDF].


Matlab code to calculate the event synchronization and the event delay between two given spike trains:

[Event-Synchronization]                Copyright:  Thomas Kreuz


Function Event_sync.m:

Input:

Two spike trains (times of spikes)

Output:

Value of event synchronization and event delay


Example call:

x=[1:100];                                  % first spike train (completely periodic)
y=x+(rand(1,length(x))-0.5);        % second spike train (first spike train with some random jitter)
[es,ed]=Event_sync(x,y);              % es and ed give you the event synchronization and the event delay between spike train x and spike train y


Example output (timemode=1):

Example output (timemode=2):

Example output (timemode=3):


This is the version with the most simplest call (just two variables). Other parameters are set at the beginning of the program:

plotmode (0-no,1-yes) - whether or not you want to have a figure
numfig - number of that figure

printmode(0-no,1-yes) - whether or not you want to save the figure as a postscript-file
filename - name of that file

xy_name - Names of the two spike trains
xy_col - colors to display the two spike trains

precision - negative logarithm of sampling interval (i.e., 3 for dt = 0.001)

taumode - maximum allowed time lag (to consider to events still to be synchronous): 1-fixed, 2-adaptive
timemode - kind of presentation: 1-cumulative, 2-windowed, 3: cumulative normalized (see Examples above)

tau - maximum allowed time lag (for taumode=1)
window - window size (for timemode=2)

Please feel free to adapt the program according to your needs (e.g., by using more variables in the call,...).


For a detailed description of the method please refer to:

Quian Quiroga R, Kreuz T, and Grassberger P:
Event Synchronization: A simple and fast method to measure synchronicity and time delay patterns.
Phys Rev E 66, 041904 (2002) [PDF].


See also:

Measuring spike train synchrony I:   SPIKY (graphical user interface)

Graphical user interface (Matlab) which can be used to calculate and visualize both the SPIKE- and the ISI-distance between two (or more) spike trains. This is an extension and update of the code in II (there you also find the links to the relevant articles).

For a detailed description of the methods please refer to:

Kreuz T, Chicharro D, Houghton C, Andrzejak RG, Mormann F:
Monitoring spike train synchrony.
J Neurophysiol 109, 1457 (2013). Also submitted to the arXiv [PDF].

Kreuz T, Chicharro D, Greschner M, Andrzejak RG:
Time-resolved and time-scale adaptive measures of spike train synchrony.
J Neurosci Methods 195, 92 (2011) [PDF].

Kreuz T, Chicharro D, Andrzejak RG, Haas JS, Abarbanel HDI:
Measuring multiple spike train synchrony.
J Neurosci Methods 183, 287 (2009) [PDF].

Kreuz T, Haas JS, Morelli A, Abarbanel HDI, Politi A:
Measuring spike train synchrony.
J Neurosci Methods 165, 151 (2007) [PDF].

Measuring spike train synchrony II:   cSPIKE

This Matlab command line software utilizes MEX files with C++ back ends for improved performance and abstraction. It offers the same basic functionality as SPIKY and PySpike and can be easily incorporated as part of your own Matlab program. You can also use cSPIKE as a stand-alone program to calculate the ISI-distance, SPIKE-distance and SPIKE synchronization measures and many more for your spike train sets.

Measuring spike train synchrony III:   SPIKE- and ISI-Distance

Matlab codes to calculate both the SPIKE- and the ISI-distance between two (or more) spike trains

For a detailed description of the methods please refer to:

Kreuz T, Chicharro D, Houghton C, Andrzejak RG, Mormann F:
Monitoring spike train synchrony.
J Neurophysiol 109, 1457 (2013) [PDF].

Also submitted to the arXiv [PDF].

Kreuz T:
SPIKE-distance.
Scholarpedia
7(12), 30652 (2012).

Measuring spike train synchrony V:   Directionality

Matlab code to calculate the directionality measure L between two given spike trains (or between two continuous datasets or between a spike train and a continuous dataset)

For a detailed description of the method please refer to:

Andrzejak RG, Kreuz T:
Characterizing unidirectional couplings between point processes and flows.
European Physics Letters 96, 50012 (2011) [PDF].

Measuring spike train synchrony VI:   van Rossum distance and multi-neuron extension

Matlab codes to calculate the spike train metric by van Rossum and the multi-neuron extension by Houghton and Sen.

For a detailed description of the method please refer to:

Houghton C, Kreuz T:
On the efficient calculation of van Rossum distances.
Network: Computation in Neural Systems 23, 48 (2012) [PDF].

Measuring spike train synchrony VII:  Victor-Purpura distance and multi-neuron extension

Matlab codes to calculate the spike train metric by Victor-Purpura and the multi-neuron extension by Victor-Purpura-Aronov.

(Homepage of Prof. Jonathan D. Victor, Cornell, NY, USA)

See also:

Matlab code for the Victor-Purpura distance which in addition calculates the percentage of spikes that have been matched by a time shift as well as the average time shift

For a detailed description of the algorithm please refer to:

Chicharro D, Kreuz T, Andrzejak RG:
What can spike train distances tell us about the neural code?
J Neurosci Methods 199, 146 (2011) [PDF].

 


For questions and comments please contact me at  "thomas.kreuz (at) cnr.it".

Notices

FOR SCIENTIFIC USE ONLY

These codes are free of charge for research and education purposes only. Any commercial or military use of this software is prohibited.

NO WARRANTY

The software on this site is provided "as-is," without any expressed or implied warranty. In no event I am liable for any damages arising from the use of the software. Since it is distributed for free, I do also not take responsibility for any eventual error in it.