elephant.spike_train_surrogates.JointISI

class elephant.spike_train_surrogates.JointISI(spiketrain, dither=array(15.) * ms, truncation_limit=array(100.) * ms, n_bins=100, sigma=array(2.) * ms, alternate=True, use_sqrt=False, method='window', cutoff=True, refractory_period=array(4.) * ms, isi_dithering=False)[source]

Joint-ISI dithering implementation, based on the ideas from [sr1] and [sr2].

The main function is JointISI.dithering().

Parameters:
spiketrainneo.SpikeTrain

Input spiketrain to create surrogates of.

ditherpq.Quantity, optional

This quantity describes the maximum displacement of a spike, when method is ‘window’. It is also used for the uniform dithering for the spikes, which are outside the regime in the Joint-ISI histogram, where Joint-ISI dithering is applicable. Default: 15. * pq.ms

truncation_limitpq.Quantity, optional

The Joint-ISI distribution of (ISI_i, ISI_{i+1}) is defined within the range [0, \infty). Since this is computationally not feasible, the Joint-ISI distribution is truncated for high ISI. The Joint-ISI histogram is calculated for (ISI_i, ISI_{i+1}) from 0 to truncation_limit. Default: 100. * pq.ms

n_binsint, optional

The size of the joint-ISI-distribution will be n_bins*n_bins/2. Default: 100

sigmapq.Quantity, optional

The standard deviation of the Gaussian kernel, with which the data is convolved. Default: 2. * pq.ms

alternatebool, optional

If True, then all even spikes are dithered followed by all odd spikes. Otherwise, the spikes are dithered in ascending order from the first to the last spike. Default: True

use_sqrtbool, optional

If True, the joint-ISI histogram is preprocessed by applying a square root (following [sr1]). Default: False

method{‘fast’, ‘window’}, optional
  • ‘fast’: the spike can move in the whole range between the
    previous and subsequent spikes (computationally efficient).
  • ‘window’: the spike movement is limited to the parameter dither.

Default: ‘window’

cutoffbool, optional

If True, then the filtering of the Joint-ISI histogram is limited on the lower side by the minimal ISI. This can be necessary, if in the data there is a certain refractory period, which will be destroyed by the convolution with the 2d-Gaussian function. Default: True

refractory_periodpq.Quantity, optional

Defines the refractory period of the dithered spiketrain unless the smallest ISI of the spiketrain is lower than this value. Default: 4. * pq.ms

isi_ditheringbool, optional

If True, the Joint-ISI distribution is evaluated as the outer product of the ISI-distribution with itself. Thus, all serial correlations are destroyed. Default: False

Methods

__init__(spiketrain[, dither, …]) Initialize self.
dithering([n_surrogates]) Implementation of Joint-ISI-dithering for spike trains that pass the threshold of the dense rate.
joint_isi_histogram() Calculates a 2D histogram of (ISI_i, ISI_{i+1}) and applies square root or gaussian filtering if necessary.

Attributes

MIN_SPIKES
bin_width
isi The inter-spike intervals of the spiketrain.
num_bins
refr_period
dithering(n_surrogates=1)[source]

Implementation of Joint-ISI-dithering for spike trains that pass the threshold of the dense rate. If not, a uniform dithered spike train is given back.

Parameters:
n_surrogatesint

The number of dithered spiketrains to be returned. Default: 1

Returns:
dithered_stslist of neo.SpikeTrain

Spike trains, that are dithered versions of the given spiketrain.

property isi

The inter-spike intervals of the spiketrain.

Returns:
np.ndarray or None

An array of inter-spike intervals of the spiketrain. None, if not enough spikes in the spiketrain.

joint_isi_histogram()[source]

Calculates a 2D histogram of (ISI_i, ISI_{i+1}) and applies square root or gaussian filtering if necessary.

Returns:
joint_isi_histogramnp.ndarray or None

A np.ndarray with shape n_bins x n_bins containing the joint-ISI histogram. None, if not enough spikes in the spiketrain.