elephant.waveform_features.waveform_width

elephant.waveform_features.waveform_width(waveform, cutoff=0.75)[source]

Calculate the width (trough-to-peak TTP) of a waveform.

Searches for an index of a minimum within first cutoff of the waveform vector, next for a maximum after the identified minimum, and returns the difference between them.

Parameters:
waveformarray-like

Time course of a single waveform. Accepts a list, a numpy array or a quantity.

cutofffloat, optional

Defines the normalized range [0, cutoff] of the input sequence for computing the minimum. Must be in [0, 1) range. Default: 0.75

Returns:
widthint

Width of a waveform expressed as a number of data points

Raises:
ValueError

If waveform is not a one-dimensional vector with at least two numbers.

If cutoff is not in [0, 1) range.

Examples

>>> from elephant.waveform_features import waveform_width
>>> waveform_width([20, 25, 10, -5, -2, 7, 15], cutoff=0.75)
3