elephant.spike_train_surrogates.surrogates(spiketrain, n_surrogates=1, method='dither_spike_train', dt=None, **kwargs)[source]

Generates surrogates of a spiketrain by a desired generation method.

This routine is a wrapper for the other surrogate generators in the module.

The surrogates retain the spiketrain.t_start and spiketrain.t_stop of the original spiketrain.

spiketrainneo.SpikeTrain or list of neo.SpikeTrain

The spike train from which to generate the surrogates. The only method that accepts a list of spike trains instead of a single spike train to generate the surrogates from is ‘trial_shifting’.

n_surrogatesint, optional

Number of surrogates to be generated. Default: 1

methodstr, optional

The method to use to generate surrogate spike trains. Can be one of:

  • ‘dither_spike_train’: see surrogates.dither_spike_train()
    [dt needed]
  • ‘dither_spikes’: see surrogates.dither_spikes() [dt needed]
  • ‘jitter_spikes’: see surrogates.jitter_spikes() [dt needed]
  • ‘randomise_spikes’: see surrogates.randomise_spikes()
  • ‘shuffle_isis’: see surrogates.shuffle_isis()
  • ‘joint_isi_dithering’: see surrogates.joint_isi_dithering()
    [dt needed]
  • ‘trial_shifting’: see surrogates.trial_shifting [dt needed]
    If used on a neo.SpikeTrain, specify the key-word argument trial_length and trial_separation of type pq.Quantity. Else, spiketrain has to be a list of neo.SpikeTrain.
  • ‘bin_shuffling’: see surrogates.bin_shuffling() [dt needed]
    If used in this module, specify the key-word argument bin_size of type pq.Quantity.

Default: ‘dither_spike_train’

dtpq.Quantity, optional

For methods shifting spike times or spike trains randomly around their original time (dither_spikes, dither_spike_train) or replacing them randomly within a certain window (jitter_spikes), dt represents the size of that shift / window. For other methods, dt is ignored. Default: None


Keyword arguments passed to the chosen surrogate method.

list of neo.SpikeTrain

Each surrogate spike train obtained independently from spiketrain according to chosen surrogate type. The time range of the surrogate spike trains is the same as in spiketrain.


If spiketrain is not either a neo.SpikeTrain object or a list of neo.SpikeTrain.


If method is not one of the surrogate methods defined in this module.

If dt is None and method is not ‘randomise_spikes’ nor ‘shuffle_isis’.