spiketools.utils.extract.create_mask

spiketools.utils.extract.create_mask(data, min_value=None, max_value=None)[source]

Create a mask to select data points based on value.

Parameters:
data1d array

Array of data.

min_value, max_valuefloat, optional

Minimum and/or maximum value to extract from the input array. The minimum value is inclusive, but the maximum value is exclusive.

Returns:
mask1d array of bool

Mask to select data points from the input array.

Examples

Create a mask to select data within a given value range:

>>> data = np.array([1, 2, 3, 4, 5, 6, 7, 8])
>>> create_mask(data, min_value=2.5, max_value=6.5)
array([False, False,  True,  True,  True,  True, False, False])