elephant.spike_train_generation.threshold_detection

elephant.spike_train_generation.threshold_detection(signal: AnalogSignal, threshold: Quantity = array(0.) * mV, sign: Literal['above', 'below'] = 'above', always_as_list: bool = False) SpikeTrain | SpikeTrainList[source]

Returns the times when the analog signal crosses a threshold. Usually used for extracting spike times from a membrane potential.

Parameters:
signalneo.core.AnalogSignal

An analog input signal with one or multiple channels.

thresholdpq.Quantity, optional

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

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

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

always_as_list: bool, optional

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

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

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 neo.core.spiketrainlist.SpikeTrainList is returned.