Waveform features

Features of waveforms (e.g waveform_snr).

elephant.waveform_features.waveform_snr(spiketrain)[source]

Return the signal-to-noise ratio of the waveforms of a SpikeTrain.

Signal-to-noise ratio is defined as the difference in mean peak-to-trough voltage divided by twice the mean SD. The mean SD is computed by measuring the SD of the spike waveform over all acquired spikes at each of the sample time points of the waveform and then averaging [1].

Parameters:
spiketrainneo.SpikeTrain

The spike times with attached waveforms.

Returns:
snrfloat

signal-to-noise ratio according to [1]

Raises:
ValueError

If spiketrain has no attached waveforms.

References

[1](1, 2) Hatsopoulos, N. G., Xu, Q. & Amit, Y. Encoding of Movement Fragments in the Motor Cortex. J. Neurosci. 27, 5105–5114 (2007).
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:
waveformnp.ndarray or list or pq.Quantity

Time course of a single waveform

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.