Presence ratio (presence_ratio)

Calculation

Presence ratio is the proportion of discrete time bins in which at least one spike occurred.

\[\textrm{presence ratio} = \frac{B_s}{B_s + B_n}\]
  • \(B_s\) : number of bins in which spikes occurred.

  • \(B_n\) : number of bins in which no spikes occurred.

Expectation and use

Complete units are expected to have a presence ratio of 90% or more. Low presence ratio (close to 0) can indicate incompleteness (type II error) or highly selective firing pattern.

Example code

import spikeinterface.qualitymetrics as qm

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

presence_ratio = qm.compute_presence_ratio(wvf_extractor)
# presence_ratio is a dict containing the units' ID as keys
# and their presence ratio (between 0 and 1) as values.

References

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.toolkit.qualitymetrics.misc_metrics.compute_presence_ratio(waveform_extractor, num_bin_edges=101, **kwargs)

Calculate the presence ratio, representing the fraction of time the unit is firing.

Parameters
waveform_extractorWaveformExtractor

The waveform extractor object.

num_bin_edgesint, optional, default: 101

The number of bins edges to use to compute the presence ratio.

Returns
presence_ratiodict

The presence ratio for each unit ID.

Notes

The total duration, across all segments, is divide into “num_bins”. To do so, spiketrains across segments are concatenated to mimic a continuous segment.

Literature

Unknown origin.

Citations