spiketools.stats.shuffle.shuffle_spikes

spiketools.stats.shuffle.shuffle_spikes(spikes, approach, n_shuffles=1000, start_time=0, **kwargs)[source]

Shuffle spikes.

Parameters:
spikes1d array

Spike times, in seconds.

approach{‘isi’, ‘circular’, ‘bincirc’}

Which approach to take for shuffling spike times. See shuffle sub-functions for details.

n_shufflesint, optional, default: 1000

The number of shuffles to create.

start_timefloat, optional

The start time of the input spikes, used to set the time values of the shuffled outputs.

kwargs

Additional keyword arguments for the shuffle procedure. See shuffle sub-functions for details.

Returns:
shuffled_spikes2d array

Shuffled spike times.

Examples

Simulate some example spikes for examples:

>>> from spiketools.sim.times import sim_spiketimes
>>> spikes = sim_spiketimes(5, 30, 'poisson')

Create 5 spike time shuffles using the ISI shuffle method:

>>> shuffled_spikes = shuffle_spikes(spikes, 'isi', n_shuffles=5)

Create 5 spike time shuffles using a circular shuffle:

>>> shuffled_spikes = shuffle_spikes(spikes, 'circular', n_shuffles=5, shuffle_min=10000)