SPIKY



Source Code - SPIKY


Matlab graphical user interface

SPIKY-Logo

Graphical user interface (Matlab) designed to calculate and visualize the SPIKE-distance, the

ISI-Distance and SPIKE synchronization between two or more spike trains:


Download: SPIKY.zip


('Beta' version 3.1: Apr 30, 2021, Copyright: Thomas Kreuz, Nebojsa Bozanic)


For a detailed description of SPIKY please refer to:

Kreuz T, Mulansky M, Bozanic N:


SPIKY: A graphical user interface for monitoring spike train synchrony


JNeurophysiol 113, 3432 (2015) [PDF]



Bozanic N, Mulansky M, Kreuz T:


SPIKY


Scholarpedia 9(12), 32344 (2014)


For a detailed description of the methods 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 Event-based Control, Communication, and Signal Processing (EBCCSP), 1-8 and arXiv [PDF] (2015) [PDF]



A list of papers (including our own) that use either of these measures can be found here.



Note that recently we have developed a complementary directional approach to multivariate spike train analysis which quantifies the consistency of spatiotemporal propagation patterns and allows to sort spike trains from leader to follower. The corresponding measures SPIKE-Order and Spike Train Order are now part of SPIKY:


Kreuz T, Satuvuori E, Pofahl M, Mulansky M:


Leaders and followers: Quantifying consistency in spatio-temporal propagation patterns


New J. Phys., 19, 043028 and arXiv [PDF] (2017) [PDF]


In order to get the latest information about new features and updates please like the

Facebook page of SPIKY.

Here you'll also find a lot of documentation including many images and movies that illustrate how to use SPIKY.


[ If you are not on Facebook here are some zip-folders with images from that page (each folder also contains a file with a list of figure captions for all images of that folder):

Elements Figure-Layout Input Output Spike-Train-Generator Windows ]


All relevant movies can also be found on the new


SPIKY Youtube Channel.


Here are a few examples. The first movie gives a general introduction to SPIKY:

Here is another movie which shows how to use the spike train generator:

If you use SPIKY and/or any of its methods please credit us properly by citing the correct references.

This is a list of scientific articles which include detailed descriptions of the methods:


For the SPIKE-distance:

Kreuz T, Chicharro D, Houghton C, Andrzejak RG, Mormann F:

Monitoring spike train synchrony

J Neurophysiol 109, 1457 (2013) [PDF]



Kreuz T:

SPIKE-distance

Scholarpedia 7(12), 30652 (2012)


For the ISI-distance:

Kreuz T, Haas JS, Morelli A, Abarbanel HDI, Politi A:

Measuring spike train synchrony

J Neurosci Methods 165, 151 (2007) [PDF]


For more details on the SPIKE- and the ISI-distance (including further movies) please have a look here.


For SPIKE synchronization:

Kreuz T, Mulansky M, Bozanic N:

SPIKY: A graphical user interface for monitoring spike train synchrony

JNeurophysiol 113, 3432 and arXiv [PDF] (2015) [PDF]



For more details on event synchronization (which first included the coincidence detection now also used in SPIKE synchronization) please have a look here.

Release history:


Beta-Versions


3.1: Added rate-independent SPIKE-distance to SPIKY-loop (and to SPIKY but there it is not yet included in the GUI) (April 2021)


3.0: Added SPIKE-Order and Spike train order algorithm that allows to quantify consistency of spatio-temporal propagation patterns in sequences of discrete events (e.g. spike trains). This includes a sorting of the spike trains from leader to follower. (March 2017)


2.3: Updates and Bug fixes (August 2016)


2.2: Added a few more SPIKY_loop programs. Some minor corrections. Lots of testing (June 2015)


2.1: Applies the same edge correction originally introduced for the SPIKE-distance (see Kreuz et al., 2015) also to the ISI-distance. (May 2015)

2.0: Added the event detector which enables the application of the SPIKY-measures to continuous data. SPIKY now also includes a new program 'SPIKY_loop_trigger' which allows to easily compare different epochs of the same length within one dataset, typically triggered by the onset of a stimulus. From our point of view this is the first complete version of SPIKY. (March 2015)

1.3: SPIKE synchronization replaces event synchronization. In comparison with event synchronization this measure has a more intuitive normalization which also extends to the multivariate case. (February 2015)

1.2: Added a third and complementary measure, event synchronization (September 2014)

1.1: Simpler folder structure plus some improvements regarding the input of spike train groups and the extraction of dissimilarity matrices (July 2014)

1.0: Initial release (June 2014)


Alpha-Versions

2.4: Lots of testing (May 2014)


2.3: Final improvements regarding the memory management. Now it should in principle be possible to analyze datasets of almost any size (May 2014)

2.2: Possibility within SPIKY to also select other variables (such as markers, separators, instants, selective and triggered averages) from a given variable / field stored in a Matlab-file; Protection against datasets that are very large (~ >100000 spikes).

The new program 'SPIKY_loop_surro' allows to compare the results obtained for a dataset against results obtained for spike train surrogates generated from that dataset. This can help in estimating the statistical significance (not yet completely finished). (April 2014)

2.1: Possibility within SPIKY to select spike train data from a given variable / field stored in a Matlab-file (March 2014)

2.0: New program 'SPIKY_loop' replaces 'SPIKY_no_plot'. The scope is the same but it adds the full functionality of SPIKY (access to time instants, selective and triggered averages as well as averages over spike train groups).

Correction of edge effect (spurious decrease of S to zero at the beginning resp. at the end of the spike trains due to a lack of previous resp. following spikes) (suggested by Conor Houghton) (March 2014)

1.8: Added Peri-Stimulus Time Histogram (PSTH) as well as possibility to edit spikes in STG with the keyboard, also simplified layout and menu (February 2014) 1.7: Improved figure layout including context menus which allow to shift subplots and to edit objects individually and collectively. Possibility to include colorbars for the dissimilarity matrices. Added second reset button which allows to reset SPIKY to the state where the data have been loaded but the dissimilarity measures have not yet been calculated (January 2014)1.6: Ability to select and sort spike trains and spike train groups. One can either sort by hand (deleting and shifting) or sort according to some predefined criteria (such as number of spikes and latency). Furthermore, once you have plotted some dendrograms you can also sort the spike trains according to the clustering obtained. (December 2013)

1.5: Improved memory management for piecewise linear SPIKE-distance (November 2013)

1.4: Generalization of allowed input formats for spikes: Three different options (October 2013)

- cell arrays (ca) with just the spike times (this is the preferred format used by SPIKY since it is most memory efficient. The two other formats will internally be converted into this format)

- regular matrices with each row being a spike train and zero padding (zp) in case the spike numbers are different.

- matrices representing time bins where each zero/one (01) indicates the absence/presence of a spike

In addition to this you can also load data in text format. Here spike times should be written as a matrix with each row being one spike train. The package now contains one example file for each format (‘testdata_ca.mat’, ‘testdata_zp.mat’, ‘testdata_01.mat’ as well as ‘testdata.txt’).

1.3: Added the program 'SPIKY_no_plot' which is complementary to the graphical user interface 'SPIKY'. Both programs can be used to calculate time-resolved spike train distances (ISI and SPIKE) between two (or more) spike trains. However, whereas SPIKY was mainly designed to facilitate the detailed analysis of one dataset, 'SPIKY_no_plot' is meant to be used in order to compare the results for many different datasets (e.g. in some kind of loop). The source codes are stripped-down and use a minimum number of input and output variables. (September 2013)

1.2: New input masks (keyboard and mouse) for selecting time markers, spike train separators and spike train groups (August 2013)

1.1: New input mask (keyboard and mouse) for selecting frames and selective/triggered averages (July 2013)

1.0: Initial release (June 2013)

Note of warning (see also 'Notice' at the end):

We are not professional programmers but we have tried to design the GUI to the best of our ability. Before launching the 'Beta-version' of SPIKY we have done some extensive testing ourselves but of course it is absolutely possible that we have missed something and that there are still some bugs or that the program is not yet as error-tolerant as it should be. Whenever you encounter any problem please provide feedback and we will try to resolve the problem and improve the source codes accordingly. Furthermore, if you have any suggestion how the code could be improved or which additional features could be build in please contact us. Any feedback is welcome.

The name of the zip-file will always include the date of release which will allow users to ensure that they have the most recent version. As the development of the measure evolves, more and more applications and possible GUI features will come to mind and will be integrated. Thus it might be worthwhile to check for bug fixes and updates now and then. We have also set up a Facebook page where we provide plenty of illustrations and where you will also have the opportunity to provide feedback and ask any questions you might have.

Documentation:

The zip-file contains several m-and mex-files which all should be stored in the same directory.

It also contains many different files that serve as documentation:

SPIKY-FAQ.doc

This is the file to get you started. It should address the most important issues. If there is an important question it does not answer please let us know...

SPIKY-Readme.doc

Contains a hint how to get started and a disclaimer (BSD-License).

SPIKY-Flowchart.pdf

This contains a flowchart detailing the general structure and workflow of SPIKY.

STG-Flowchart.pdf

This contains a flowchart detailing the general structure and workflow of the spike train generator (STG).

SPIKY-Elements.doc

This contains a detailed description of each individual element of the main GUI.

SPIKY-Files.doc

This contains a detailed description of all the individual files in the SPIKY-package.

STG-Elements.doc

This contains a detailed description of each individual element of the spike train generator (STG).

SPIKY-Screenshot.png

This contains an exemplary screenshot of the main GUI.

STG-Screenshot.png

This contains an exemplary screenshot of the spike train generator (STG).

SPIKY-Annotated_Screenshot.eps

Annotated figure which illustrates some of the elements of a SPIKY-plot. Very soon we will include some more illustrative screen shots on this webpage.

SPIKY_loop.doc

Short documentation of the program 'SPIKY_loop' which is complementary to the graphical user interface 'SPIKY'. Both programs can be used to calculate time-resolved spike train distances (ISI and SPIKE) between two (or more) spike trains. However, whereas SPIKY was mainly designed to facilitate the detailed analysis of one dataset, 'SPIKY_loop' is meant to be used in order to compare the results for many different datasets.

The following plots can be derived with the predefined examples provided in the 'Selection: Data'- Listbox. They mostly correspond to examples used in the 2013 JNeurpphysiol paper. In the following we describe the settings that are used to obtain the respective figure.


Fig. 2a: SPIKE-distance applied to a bivariate example with varying spike match

In the panel 'Selection: Data' select the first listbox entry 'Frequency mismatch' and then press the 'Select from list' button.

In the panel 'Parameters: Data' you could set 'Comment' to 'Frequency mismatch'. This string describing the data would then be used in all figure and file names using these data. Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes.

In the panel 'Parameters: Figure' you could set 'Comment' to something like ' - SPIKE'. This string describing this specific figure would then be used in this figure and file name.

To see the figure press the 'Plot' button.

Fig. 2b: SPIKE-distance applied to a multivariate example

In the panel 'Selection: Data' select the second listbox entry 'Spiking events' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 3a: Real-time SPIKE-distance applied to a bivariate example with varying spike match

In the panel 'Selection: Data' select the first listbox entry 'Frequency mismatch' and then press the 'Select from list' button.

In the panel 'Parameters: Data' you could set 'Comment' to 'Frequency mismatch'. This string describing the data would then be used in all figure and file names using these data. Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance (realtime)' to 2. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes.

In the panel 'Parameters: Figure' in the subpanel 'Moving Average' in the popupmenu select 'Regular and Mov Ave'.

In the panel 'Parameters: Figure' in the subpanel 'Moving Average' adjust the 'MA-Order'. You can try out different values and update the figure each time by pressing the button 'Plot' in the 'Selection: Plots' panel.

In the panel 'Parameters: Figure' you could set 'Comment' to ' - SPIKE realtime and Moving Average'. This string describing this specific figure would then be used in this figure and file name.

To see the figure press the 'Plot' button.

Fig. 3b: SPIKE-distance applied to a multivariate example

In the panel 'Selection: Data' select the second listbox entry 'Spiking events' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance (realtime)' to 2. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes.

In the panel 'Parameters: Figure' in the subpanel 'Moving Average' in the popupmenu select 'Regular and Mov Ave'.

In the panel 'Parameters: Figure' in the subpanel 'Moving Average' adjust the 'MA-Order'. You can try out different values and update the figure each time by pressing the button 'Plot' in the 'Selection: Plots' panel.

To see the figure press the 'Plot' button.

Fig. 4: Real-time SPIKE-distance: Peaks during reliable spiking events are not spurious

In the panel 'Selection: Data' select the fourth listbox entry 'Non-spurious events' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance (realtime)' to 2. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 5A: Instantaneous clustering for artificially generated spike trains

In the panel 'Selection: Data' select the third listbox entry 'Clustering' and then press the 'Select from list' button.

In the panel 'Parameters: Data' in the subpanel 'Time' set 'End' to '2000' (without the single quotation marks).

In the panel 'Parameters: Data' in the subpanel 'Time' set 'Thin markers' to '500 1000 1500' (without the single quotation marks). Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3. Then press the 'Calculate' button.

In the panel 'Selection: Measures' set 'Frames' to '250 750 1190 1510' (without the single quotation marks).

In the panel 'Selection: Plots' check the second checkbox 'Matrix comparison (cuts/averages)' and none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 5B: Further examples of instantaneous clustering for artificially generated spike trains

In the panel 'Selection: Data' select the third listbox entry 'Clustering' and then press the 'Select from list' button.

In the panel 'Parameters: Data' in the subpanel 'Time' set 'Start' to '2000' (without the single quotation marks).

In the panel 'Parameters: Data' in the subpanel 'Time' set 'Thin markers' to '2500 3000 3500' (without the single quotation marks). Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3.

In the panel 'Selection: Measures' set 'Frames' to '2250 2750 3250 3750' (without the single quotation marks). Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame comparison' and none of the other checkboxes. To see the figure press the 'Plot' button.

In the panel 'Parameters: Figure' in the subpanel 'Time-axis' set 'X-Offset' to '-2000' (without the single quotation marks).

Fig. 6: Selective temporal averaging

In the panel 'Selection: Data' select the third listbox entry 'Clustering' and then press the 'Select from list' button.

In the panel 'Parameters: Data' in the subpanel 'Time' set 'Thin markers' to '500:500:3500' (without the single quotation marks). Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3.

In the panel 'Selection: Measures' set 'Selective averages' to '{[0 500];[1000 2000];[2000 2500 3000 3500];[0 4000]}' (without the single quotation marks). Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the second checkbox 'Matrix comparison (cuts/averages)' and none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 7a: Triggered temporal averaging: Whole Interval

In the panel 'Selection: Data' select the seventh listbox entry 'Poisson Divergence' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2.

In the panel 'Selection: Measures' set 'Selective averages' to '{[0 100]}' (without the single quotation marks). Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame sequence (movie)' as well as the checkbox 'Dendrograms' but none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 7b: Triggered temporal averaging: Firings of first spike train

In the panel 'Selection: Data' select the seventh listbox entry 'Poisson Divergence' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2.

[In the panel 'Selection: Measures' set 'Triggered averages' to 'SPIKY_trig_ave' (without the single quotation marks) which is the name of a Matlab m-file in the same directory as the SPIKY-installation. It will be called by the GUI and its code can be used to assign the trigger variable. This way it is possible to assign triggered averages which depend on the spike trains themselves ('internal triggering'). For 'external triggering' where the times are known (e.g. set by a stimulus, just use standard Matlab notation. XXX work in progress] Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame sequence (movie)' as well as the checkbox 'Dendrograms' but none of the other checkboxes. To see the figure press the 'Plot' button.

Fig. 8: Screenshot from the supplementary movie

In the panel 'Selection: Data' select the third listbox entry 'Clustering' and then press the 'Select from list' button.

In the panel 'Parameters: Data' in the subpanel 'Time' set 'Thin markers' to '500:500:3500' (without the single quotation marks).

In the panel 'Parameters: Data' in the subpanel 'Spike trains' set 'Group names' to 'G1; G2; G3; G4' (without the single quotation marks and with exactly one space after each semicolon).

In the panel 'Parameters: Data' in the subpanel 'Spike trains' set 'Group sizes' to '10 10 10 10' (without the single quotation marks). Of course the number of elements in these two fields have to correspond. Then press the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3.

In the panel 'Selection: Measures' set 'Selective averages' to '{[500 1000 1500 2000]}' (without the single quotation marks). Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame sequence (movie)' as well as the checkboxes 'Block matrices' and 'Dendrograms' but none of the other checkboxes.

In the panel 'Parameters: Figure' set the popupmenu 'Spike train color coding' to 'Color-coded groups'.

To see the figure press the 'Plot' button.

Additional Figure 1: Comparison of piecewise constant and sampled dissimilarity profile

In the panel 'Selection: Data' select the first listbox entry 'Frequency mismatch' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in both the Subpanel 'Piecewise constant' and the subpanel 'Main' set 'SPIKE-distance' to 2. This way both profiles are plotted in the same subplot. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes.

In the panel 'Parameters: Figure' set 'Subplot sizes' to '1 1.5' (without the single quotation marks). This way the second subplot is 1.5 times larger than the first.

To see the figure press the 'Plot' button.


[The dissimilarity profile with the normal line width is sampled (with one value each sample point), whereas the bold dissimilarity profile is piecewise constant (with one value for each interval in the pooled spike train). This profile is obtained by representing each interval by the value of its center and weighting it by its length. This is not only faster, but it actually gives the exact result, whereas the sampled calculation is a very good approximation only for sufficiently small sampling intervals (imagine the example of a rectangular function, at some point any sampled representation has to cut the right angle). On the other hand, the sampled profile has a higher temporal resolution in the visualization. If this is not essential or if the averaged values are sufficient, the calculation of the piecewise constant distances is preferable.

The three examples below are currently disabled (in order to keep the number of predefined entries in the listbox reasonably low).

Additional Figure 2: Poisson with different firing rate - Distance value only depends on distance from diagonal (distances are scale-free)

In the panel 'Selection: Data' select the ninth listbox entry 'Poisson Scalefree I' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3.

In the panel 'Selection: Measures' set 'Selective average' to the values '[Start End]' using standard Matlab notation, e.g. [0 1] if these were the values set in the 'Parameters: Data' panel. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame sequence (movie)' but none of the other checkboxes.

In the panel 'Parameters: Figure' set the popupmenu 'Color normalization' to 'Overall occurring' which normalizes all matrices to the one overall maximum that actually occurs.

To see the figure press the 'Plot' button.

Additional Figure 3: Poisson with different firing rate - Distance value only depends on distance from diagonal (distances are scale-free)

In the panel 'Selection: Data' select the tenth listbox entry 'Poisson Scalefree II' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3.

In the panel 'Selection: Measures' set 'Selective average' to the values '[Start End]' using standard Matlab notation, e.g. [0 1] if these were the values set in the 'Parameters: Data' panel. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the checkbox 'Frame sequence (movie)' but none of the other checkboxes.

In the panel 'Parameters: Figure' set the popupmenu 'Color normalization' to 'Overall occurring' which normalizes all matrices to the one overall maximum that actually occurs.

To see the figure press the 'Plot' button.

Additional Figure 4: Expectation values for Poisson spike trains with identical rate (but these values do not depend on the rate)

In the panel 'Selection: Data' select the eleventh listbox entry 'Poisson expectation value' and then press the 'Select from list' button followed by the 'Update' button.

In the panel 'Selection: Measures' set 'Spikes' to 1 and in the Subpanel 'Main' set 'SPIKE-distance' to 2 and 'SPIKE-distance (realtime)' to 3. Then press the 'Calculate' button.

In the panel 'Selection: Plots' check the first checkbox 'Dissimilarity profiles' and none of the other checkboxes. To see the figure press the 'Plot' button.

[The firing rate of the Poisson spike trains is 1000 Hz so these are almost 1.000.000 spikes. It takes quite some time to run this example. The interval is cut into smaller segments, and the averaging over all pairs of spike trains is performed for each segment separately.]