elephant.spike_train_generation.peak_detection

elephant.spike_train_generation.peak_detection(signal, threshold=array(0.) * mV, sign='above', as_array=False)[source]

Return the peak times for all events that cross threshold. Usually used for extracting spike times from a membrane potential. Similar to spike_train_generation.threshold_detection.

Parameters:
signalneo.AnalogSignal

An analog input signal.

thresholdpq.Quantity, optional

Contains a value that must be reached for an event to be detected. Default: 0.*pq.mV

sign{‘above’, ‘below’}, optional

Determines whether to count threshold crossings that cross above or below the threshold. Default: ‘above’

as_arraybool, optional

If True, a NumPy array of the resulting peak times is returned instead of a (default) neo.SpikeTrain object. Default: False

format{None, ‘raw’}, optional

Deprecated since version 0.8.0.

Whether to return as SpikeTrain (None) or as a plain array of times (‘raw’). Deprecated. Use as_array=False for None format and as_array=True otherwise. Default: None

Returns:
result_stneo.SpikeTrain

Contains the spike times of each of the events (spikes) extracted from the signal.