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

# Make recording, sorting and wvf_extractor objects for your data.

fraction_missing = qm.compute_amplitudes_cutoff(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

Various cluster quality metrics.

Some of then come from or the old implementation: * https://github.com/AllenInstitute/ecephys_spike_sorting/tree/master/ecephys_spike_sorting/modules/quality_metrics * https://github.com/SpikeInterface/spikemetrics

Implementations here have been refactored to support the multi-segment API of spikeinterface.

spikeinterface.qualitymetrics.misc_metrics.compute_amplitudes_cutoff(waveform_extractor, peak_sign='neg', num_histogram_bins=500, histogram_smoothing_value=3, **kwargs)

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 template to compute best channels.

num_histogram_binsint, optional, default: 500

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.

Returns
all_fraction_missingdict

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)

Important note: here the amplitudes are extracted from the waveform extractor. It means that the number of spike to estimate amplitude is low See: WaveformExtractor.set_params(max_spikes_per_unit=500)

Literature

Introduced by [Hill].

Citations

Hill

Hill, Daniel N., Samar B. Mehta, and David Kleinfeld. “Quality Metrics to Accompany Spike Sorting of Extracellular Signals.” The Journal of neuroscience 31.24 (2011): 8699–8705. Web.