elephant.spike_train_generation.spike_extraction

elephant.spike_train_generation.spike_extraction(signal: AnalogSignal, threshold: Quantity = array(0.) * mV, sign: Literal['above', 'below'] = 'above', time_stamps: SpikeTrain = None, interval: tuple = (array(-2.) * ms, array(4.) * ms), always_as_list: bool = False) SpikeTrain | SpikeTrainList[source]

Return the peak times for all events that cross threshold and the waveforms. Usually used for extracting spikes from a membrane potential to calculate waveform properties.

Parameters:
signalneo.core.AnalogSignal

An analog input signal one or more 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’

time_stampsneo.core.SpikeTrain , optional

Provides the time stamps around which the waveform is extracted. If it is None, the function peak_detection is used to calculate the time_stamps from signal. Default: None

intervaltuple of pq.Quantity

Specifies the time interval around the time_stamps where the waveform is extracted. Default: (-2 * pq.ms, 4 * pq.ms)

always_as_list: bool, optional

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

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

Contains the time_stamps of each of the spikes and the waveforms in result_st.waveforms.