efel.pyfeatures.extrafeats

Extracellular features functions

Functions

calculate_features(waveforms, sampling_frequency)

Calculate features for all waveforms

halfwidth(waveforms, sampling_frequency[, ...])

Width of waveform at half of its amplitude.

peak_image(waveforms[, sign])

Normalized amplitude at the time of peak minimum or maximum.

peak_time_diff(waveforms, fs[, sign])

Peak time differences with respect to channel with largest amplitude.

peak_to_valley(waveforms, sampling_frequency)

Time between trough and peak.

peak_trough_ratio(waveforms)

Normalized ratio of peak height over trough depth

recovery_slope(waveforms, ...)

Return the recovery slope of input waveforms.

relative_amplitude(waveforms[, sign])

Normalized amplitude with respect to channel with largest amplitude.

repolarization_slope(waveforms, ...[, ...])

Return slope of repolarization period between trough and baseline

efel.pyfeatures.extrafeats.calculate_features(waveforms, sampling_frequency, upsample=None, feature_names=None, recovery_slope_window=0.7)[source]

Calculate features for all waveforms

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sampling_frequency – float rate at which the waveforms are sampled (Hz)

  • feature_names – list or None (if None, compute all) features to compute

  • recovery_slope_window – float window length in ms after peak wherein recovery slope is computed

Returns:

Dictionary with computed metrics.

Keys are the metric names, values are the computed features

Return type:

dict (num_waveforms x num_metrics)

efel.pyfeatures.extrafeats.halfwidth(waveforms, sampling_frequency, return_idx=False)[source]

Width of waveform at half of its amplitude. If the peak precedes the trough, halfwidth is negative.

Computes the width of the waveform peak at half its height

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sampling_frequency – float rate at which the waveforms are sampled (Hz)

  • return_idx – bool if true, also returns index of threshold crossing before and index of threshold crossing after peak

Returns:

Halfwidth of the waveforms or (Halfwidth of the waveforms, index_cross_pre_peak, index_cross_post_peak)

Return type:

np.ndarray or (np.ndarray, np.ndarray, np.ndarray)

efel.pyfeatures.extrafeats.peak_image(waveforms, sign='negative')[source]

Normalized amplitude at the time of peak minimum or maximum.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sign – str “positive” | “negative”

Returns:

Peak images for the waveforms

Return type:

np.ndarray

efel.pyfeatures.extrafeats.peak_time_diff(waveforms, fs, sign='negative')[source]

Peak time differences with respect to channel with largest amplitude.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • fs – float Sampling rate in Hz

  • sign – str “positive” | “negative”

Returns:

Peak time differences for the waveforms

Return type:

np.ndarray

efel.pyfeatures.extrafeats.peak_to_valley(waveforms, sampling_frequency)[source]

Time between trough and peak. If the peak precedes the trough, peak_to_valley is negative.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute feature for

  • sampling_frequency – float rate at which the waveforms are sampled (Hz)

Returns:

peak_to_valley in seconds

Return type:

np.ndarray (num_waveforms)

efel.pyfeatures.extrafeats.peak_trough_ratio(waveforms)[source]

Normalized ratio of peak height over trough depth

Assumes baseline is 0

Parameters:

waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute feature for

Returns:

Peak to trough ratio

Return type:

np.ndarray (num_waveforms)

efel.pyfeatures.extrafeats.recovery_slope(waveforms, sampling_frequency, window)[source]

Return the recovery slope of input waveforms. After repolarization, the neuron hyperpolarizes until it peaks. The recovery slope is the slope of the action potential after the peak, returning to the baseline in dV/dT. The slope is computed within a user-defined window after the peak.

Takes a numpy array of waveforms and returns an array with recovery slopes per waveform.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sampling_frequency – float rate at which the waveforms are sampled (Hz)

  • window – float length after peak wherein to compute recovery slope (ms)

Returns:

Recovery slope of the waveforms

Return type:

np.ndarray

efel.pyfeatures.extrafeats.relative_amplitude(waveforms, sign='negative')[source]

Normalized amplitude with respect to channel with largest amplitude.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sign – str “positive” | “negative”

Returns:

Relative amplitudes for the waveforms

Return type:

np.ndarray

efel.pyfeatures.extrafeats.repolarization_slope(waveforms, sampling_frequency, return_idx=False)[source]

Return slope of repolarization period between trough and baseline

After reaching its maxumum polarization, the neuron potential will recover. The repolarization slope is defined as the dV/dT of the action potential between trough and baseline.

Optionally the function returns also the indices per waveform where the potential crosses baseline.

Parameters:
  • waveforms – numpy.ndarray (num_waveforms x num_samples) waveforms to compute features for

  • sampling_frequency – float rate at which the waveforms are sampled (Hz)

  • return_idx – bool if true, also returns index of threshold crossing before and index of threshold crossing after peak

Returns:

Repolarization slope of the

waveforms or (Repolarization slope of the waveforms, return to base index)

Return type:

np.ndarray or (np.ndarray, np.ndarray)

Source

_autosummary/efel.pyfeatures.extrafeats.rst