spiketools.stats.shuffle.shuffle_circular

spiketools.stats.shuffle.shuffle_circular(spikes, shuffle_min=20000, n_shuffles=1000, start_time=0)[source]

Shuffle spikes based on circularly shifting the spike train.

Parameters:
spikes1d array

Spike times, in seconds.

shuffle_minint

The minimum amount to rotate data, in terms of units of the spike train.

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.

Returns:
shuffled_spikes2d array

Shuffled spike times.

Notes

The input shuffle_min should always be less than the maximum time in which a spike occurred.

Examples

Shuffle spike times using the circular method:

>>> from spiketools.sim.times import sim_spiketimes
>>> spikes = sim_spiketimes(5, 30, 'poisson')
>>> shuffled_spikes = shuffle_circular(spikes, shuffle_min=10000, n_shuffles=5)