Amplitude cutoff (amplitude_cutoff
)¶
Calculation¶
A histogram of spike amplitudes is created and deviations from the expected symmetrical distribution are identified.
Expectation and use¶
Deviations from the expected Gaussian distribution are used to estimate the number of spikes missing from the unit. This yields an estimate of the number of spikes missing from the unit (false negative rate). A smaller value for this metric is preferred, as this indicates fewer false negatives. The distribution can be computed on chunks for larger recording, as drift can impact the spike amplitudes (and thus not give a Gaussian distribution anymore).
Example code¶
import spikeinterface.qualitymetrics as sqm
# It is also recommended to run `compute_spike_amplitudes(wvf_extractor)`
# in order to use amplitudes from all spikes
fraction_missing = sqm.compute_amplitude_cutoffs(wvf_extractor, peak_sign="neg")
# fraction_missing is a dict containing the unit IDs as keys,
# and their estimated fraction of missing spikes as values.
Reference¶
- spikeinterface.qualitymetrics.misc_metrics.compute_amplitude_cutoffs(waveform_extractor, peak_sign='neg', num_histogram_bins=500, histogram_smoothing_value=3, amplitudes_bins_min_ratio=5, unit_ids=None)¶
Calculate approximate fraction of spikes missing from a distribution of amplitudes.
- Parameters
- waveform_extractorWaveformExtractor
The waveform extractor object.
- peak_sign“neg” | “pos” | “both”, default: “neg”
The sign of the peaks.
- num_histogram_binsint, default: 100
The number of bins to use to compute the amplitude histogram.
- histogram_smoothing_valueint, default: 3
Controls the smoothing applied to the amplitude histogram.
- amplitudes_bins_min_ratioint, default: 5
The minimum ratio between number of amplitudes for a unit and the number of bins. If the ratio is less than this threshold, the amplitude_cutoff for the unit is set to NaN.
- unit_idslist or None
List of unit ids to compute the amplitude cutoffs. If None, all units are used.
- Returns
- all_fraction_missingdict of floats
Estimated fraction of missing spikes, based on the amplitude distribution, for each unit ID.
Notes
This approach assumes the amplitude histogram is symmetric (not valid in the presence of drift). If available, amplitudes are extracted from the “spike_amplitude” extension (recommended). If the “spike_amplitude” extension is not available, the amplitudes are extracted from the waveform extractor, which usually has waveforms for a small subset of spikes (500 by default).
References
Inspired by metric described in [Hill]
This code was adapted from: https://github.com/AllenInstitute/ecephys_spike_sorting/tree/master/ecephys_spike_sorting/modules/quality_metrics
Links to original implementations¶
From the AllenInstitute
From the AllenSDK
Literature¶
Introduced by [Hill].