elephant.spike_train_correlation.spike_train_timescale¶

elephant.spike_train_correlation.
spike_train_timescale
(binned_spiketrain, max_tau)[source]¶ Calculates the autocorrelation time of a binned spike train; uses the definition of the autocorrelation time proposed in [cor2] (Eq. 6):
where denotes the autocorrelation function excluding the Dirac delta at zero timelag.
Parameters:  binned_spiketrainelephant.conversion.BinnedSpikeTrain
A binned spike train containing the spike train to be evaluated.
 max_taupq.Quantity
Maximal integration time of the autocorrelation function. It needs to be a multiple of the bin_size of binned_spiketrain.
Returns:  timescalepq.Quantity
The autocorrelation time of the binned spiketrain with the same units as in the input. If binned_spiketrain has less than 2 spikes, a warning is raised and np.nan is returned.
Notes
 is a critical parameter: numerical estimates of the autocorrelation functions are inherently noisy. Due to the square in the definition above, this noise is integrated. Thus, it is necessary to introduce a cutoff for the numerical integration  this cutoff should be neither smaller than the true autocorrelation time nor much bigger.
 The bin size of binned_spiketrain is another critical parameter as it defines the discretization of the integral . If it is too big, the numerical approximation of the integral is inaccurate.
Examples
>>> import neo >>> import numpy as np >>> import quantities as pq >>> from elephant.spike_train_correlation import spike_train_timescale >>> from elephant.conversion import BinnedSpikeTrain >>> spiketrain = neo.SpikeTrain([1, 5, 7, 8], units='ms', t_stop=10*pq.ms) >>> bst = BinnedSpikeTrain(spiketrain, bin_size=1 * pq.ms) >>> spike_train_timescale(bst, max_tau=5 * pq.ms) array(14.11111111) * ms