spiketools.utils.extract.reinstate_range

spiketools.utils.extract.reinstate_range(spikes, time_range)[source]

Reinstate a dropped time range into an array of spike times.

Parameters:
spikes1d or 2d array

An array of spikes times, in seconds.

time_rangelist of [float, float] or list of list of [float, float]

Time range(s), in seconds, to reinstate into shuffled spike times. Each time range should be defined as [start_add_time, end_add_time].

Returns:
spikes_out1d or 2d array

An array of spikes times, in seconds, with the time range reinstated.

Examples

Reinstate a time range into a set of spike times:

>>> spikes = np.array([0.24, 0.73, 1.22, 1.65, 2.15, 2.95, 3.52, 3.84])
>>> time_range = [2, 10]
>>> reinstate_range(spikes, time_range)
array([ 0.24,  0.73,  1.22,  1.65, 10.15, 10.95, 11.52, 11.84])