spiketools.utils.extract.drop_range¶
- spiketools.utils.extract.drop_range(spikes, time_range, check_empty=True)[source]¶
Drop a specified time range from a vector spike times.
- Parameters:
- spikes1d array
Spike times, in seconds.
- time_rangelist of [float, float] or list of list of [float, float]
Time range(s), in seconds, to drop from spike times. Each time range should be defined as [start_add_time, end_add_time].
- check_emptybool, optional, default: True
Whether to check if the dropped range is empty of spikes. If True, and there are spikes within the drop time_range, an error is raised.
- Returns:
- out_spikes1d array
Spike times, in seconds, with the time range removed.
Examples
Drop an empty time range from a set of spike times:
>>> spikes = np.array([0.24, 0.73, 1.22, 1.65, 10.15, 10.95, 11.52, 11.84]) >>> time_range = [2, 10] >>> drop_range(spikes, time_range) array([0.24, 0.73, 1.22, 1.65, 2.15, 2.95, 3.52, 3.84])