elephant.waveform_features.waveform_snr

elephant.waveform_features.waveform_snr(waveforms)[source]

Return the signal-to-noise ratio of the waveforms of one or more spike trains (Hatsopoulos et al., 2007).

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.

Parameters:
waveformsarray-like

A list or a quantity or a numpy array of waveforms of shape (n_waveforms, time) in case of a single spike train or (n_waveforms, n_spiketrains, time) in case of one or more spike trains.

Returns:
snrfloat or np.ndarray

Signal-to-noise ratio according to (Hatsopoulos et al., 2007). If the input waveforms shape is (n_waveforms, time) or (n_waveforms, 1, time), a single float is returned. Otherwise, if the shape is (n_waveforms, n_spiketrains, time), a numpy array of length n_spiketrains is returned.

Notes

The waveforms of a neo.SpikeTrain can be extracted as spiketrain.waveforms, if it’s loaded from a file, in which case you need to set load_waveforms=True in neo.read_block().

Examples

>>> from elephant.waveform_features import waveform_snr
>>> waveforms = [[20, 25, 10, -5, -2, 7, 15], [17, 29, 11, -4, 0, 5, 20]]
>>> waveform_snr(waveforms)
12.249999999999998