elephant.spike_train_surrogates.shuffle_isis

elephant.spike_train_surrogates.shuffle_isis(spiketrain, n_surrogates=1, decimals=None)[source]

Generates surrogates of a spike train by inter-spike-interval (ISI) shuffling.

The surrogates are obtained by randomly sorting the ISIs of the given input spiketrain. This generates independent neo.SpikeTrain object(s) with same ISI distribution and spike count as in spiketrain, while destroying temporal dependencies and firing rate profile.

Parameters:
spiketrainneo.SpikeTrain

The spike train from which to generate the surrogates.

n_surrogatesint, optional

Number of surrogates to be generated. Default: 1

decimalsint or None, optional

Number of decimal points for every spike time in the surrogates. If None, machine precision is used. Default: None

Returns:
list of neo.SpikeTrain

Each surrogate spike train obtained independently from spiketrain by random ISI shuffling. The time range of the surrogate spike trains is the same as in spiketrain.

Examples

>>> import quantities as pq
>>> import neo
...
>>> st = neo.SpikeTrain([100, 250, 600, 800] * pq.ms, t_stop=1 * pq.s)
>>> print(shuffle_isis(st))  
    [<SpikeTrain(array([ 200.,  350.,  700.,  800.]) * ms,
             [0.0 ms, 1000.0 ms])>]
>>> print(shuffle_isis(st, n_surrogates=2))  
    [<SpikeTrain(array([ 100.,  300.,  450.,  800.]) * ms,
          [0.0 ms, 1000.0 ms])>,
     <SpikeTrain(array([ 200.,  350.,  700.,  800.]) * ms,
          [0.0 ms, 1000.0 ms])>]