elephant.spike_train_correlation.spike_time_tiling_coefficient

elephant.spike_train_correlation.spike_time_tiling_coefficient(spiketrain_i: SpikeTrain, spiketrain_j: SpikeTrain, dt: Quantity = array(0.005) * s) float[source]

Calculates the Spike Time Tiling Coefficient (STTC) as described in (Cutts and Eglen, 2014) following their implementation in C. The STTC is a pairwise measure of correlation between spike trains. It has been proposed as a replacement for the correlation index as it presents several advantages (e.g. it’s not confounded by firing rate, appropriately distinguishes lack of correlation from anti-correlation, periods of silence don’t add to the correlation, and it’s sensitive to firing patterns).

The STTC is calculated as follows:

\[STTC = 1/2((PA - TB)/(1 - PA*TB) + (PB - TA)/(1 - PB*TA))\]

Where PA is the proportion of spikes from train 1 that lie within [-dt, +dt] of any spike of train 2 divided by the total number of spikes in train 1, PB is the same proportion for the spikes in train 2; TA is the proportion of total recording time within [-dt, +dt] of any spike in train 1, TB is the same proportion for train 2. For \(TA = PB = 1\) and for \(TB = PA = 1\) the resulting \(0/0\) is replaced with \(1\), since every spike from the train with \(T = 1\) is within [-dt, +dt] of a spike of the other train.

This is a Python implementation compatible with the elephant library of the original code by C. Cutts written in C and available here:

Parameters:
spiketrain_i, spiketrain_jneo.core.SpikeTrain

Spike trains to cross-correlate. They must have the same t_start and t_stop.

dtpq.Quantity.

The synchronicity window is used for both: the quantification of the proportion of total recording time that lies [-dt, +dt] of each spike in each train and the proportion of spikes in spiketrain_i that lies [-dt, +dt] of any spike in spiketrain_j. Default : 0.005 * pq.s

Returns:
indexfloat or numpy.nan

The spike time tiling coefficient (STTC). Returns numpy.nan if any spike train is empty.

Notes

Alias: sttc

Examples

>>> import neo
>>> import quantities as pq
>>> from elephant.spike_train_correlation import spike_time_tiling_coefficient  # noqa
>>> spiketrain1 = neo.SpikeTrain([1.3, 7.56, 15.87, 28.23, 30.9, 34.2,
...     38.2, 43.2], units='ms', t_stop=50)
>>> spiketrain2 = neo.SpikeTrain([1.02, 2.71, 18.82, 28.46, 28.79, 43.6],
...     units='ms', t_stop=50)
>>> spike_time_tiling_coefficient(spiketrain1, spiketrain2)
0.4958601655933762