spiketools.measures.collections.detect_empty_time_ranges

spiketools.measures.collections.detect_empty_time_ranges(all_spikes, bins, time_range=None)[source]

Compute the empty time ranges that are common across a collection of recorded neurons.

Parameters:
all_spikeslist of 1d array

Spike times for a collection of neurons.

binsfloat or 1d array

The binning to apply to the spiking data. If float, the time length of each bin. If array, precomputed bin definitions.

time_rangelist of [float, float], optional

Time range, in seconds, to use to check for empty time ranges. Only used if bins is a float.

Returns:
empty_rangeslist of list of float

List of ranges indicating time ranges with no spiking across all neurons.

Examples

Detect an empty range across a collection of 2 spiking neurons:

>>> all_spikes = [np.array([0.25, 0.80, 1.25, 1.75, 4.15, 4.95]),
...               np.array([0.15, 0.55, 1.55, 1.95, 4.35, 4.85])]
>>> detect_empty_time_ranges(all_spikes, bins=1, time_range=[0, 5])
[[2, 4]]