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 distributions 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 few false negatives. The distributions 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 qm
# It is also recommended to run `compute_spike_amplitudes(wvf_extractor)`
# in order to use amplitudes from all spikes
fraction_missing = qm.compute_amplitude_cutoffs(wvf_extractor, peak_sign="neg")
# fraction_missing is a dict containing the units' ID 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)¶
Calculate approximate fraction of spikes missing from a distribution of amplitudes.
- Parameters
- waveform_extractorWaveformExtractor
The waveform extractor object.
- peak_sign{‘neg’, ‘pos’, ‘both’}
The sign of the peaks.
- num_histogram_binsint, optional, default: 100
The number of bins to use to compute the amplitude histogram.
- histogram_smoothing_valueint, optional, default: 3
Controls the smoothing applied to the amplitude histogram.
- amplitudes_bins_min_ratioint, optional, 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.
- 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].