elephant.spike_train_generation.peak_detection

elephant.spike_train_generation.peak_detection(signal: AnalogSignal, threshold: Quantity = array(0.) * mV, sign: Literal['above', 'below'] = 'above', as_array: bool = False, always_as_list: bool = False) SpikeTrain | SpikeTrainList[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.core.AnalogSignal

An analog input signal or a list of analog input signals.

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

always_as_list: bool, optional

If True, a neo.core.spiketrainslist.SpikeTrainList is returned. Default: False

Returns:
result_stneo.core.SpikeTrain, neo.core.spiketrainslist.SpikeTrainList

np.ndarrav, List[np.ndarrav] Contains the spike times of each of the events (spikes) extracted from the signal. If signal is an AnalogSignal with multiple channels or always_return_list=True a list is returned.