Sliding refractory period violations (sliding_rp_violations)

Calculation

Compute maximum allowed refractory period violations for all possible refractory periods in recording. Bins of 0.25ms are used in the [IBL] implementation. For each bin, this maximum value is compared with that observed in the recording.

In the [IBL] implementation, a threshold is imposed and a binary value returned (based on whether the unit ‘passes’ the metric). The SpikeInterface implementation, instead, returns the minimum contamination with at least 90% confidence. This contamination value is between 0 and 1.

Expectation and use

Similar to the ISI violations metric, this metric quantifies the number of refractory period violations seen in the recording of the unit. This is an estimate of the false positive rate. A high number of violations indicates contamination, so a low value is expected for high quality units.

Example code

With SpikeInterface:

import spikeinterface.qualitymetrics as sqm

# Combine sorting and recording into a sorting_analyzer

contamination = sqm.compute_sliding_rp_violations(sorting_analyzer=sorting_analyzer, bin_size_ms=0.25)

References

spikeinterface.qualitymetrics.misc_metrics.compute_sliding_rp_violations(sorting_analyzer, min_spikes=0, bin_size_ms=0.25, window_size_s=1, exclude_ref_period_below_ms=0.5, max_ref_period_ms=10, contamination_values=None, unit_ids=None)

Compute sliding refractory period violations, a metric developed by IBL which computes contamination by using a sliding refractory period. This metric computes the minimum contamination with at least 90% confidence.

Parameters
sorting_analyzer: SortingAnalyzer

A SortingAnalyzer object

min_spikesint, default: 0

Contamination is set to np.nan if the unit has less than this many spikes across all segments.

bin_size_msfloat, default: 0.25

The size of binning for the autocorrelogram in ms

window_size_sfloat, default: 1

Window in seconds to compute correlogram

exclude_ref_period_below_msfloat, default: 0.5

Refractory periods below this value are excluded

max_ref_period_msfloat, default: 10

Maximum refractory period to test in ms

contamination_values1d array or None, default: None

The contamination values to test, If None, it is set to np.arange(0.5, 35, 0.5)

unit_idslist or None

List of unit ids to compute the sliding RP violations. If None, all units are used.

Returns
contaminationdict of floats

The minimum contamination at 90% confidence

References

Based on metrics described in [IBL] This code was adapted from: https://github.com/SteinmetzLab/slidingRefractory/blob/1.0.0/python/slidingRP/metrics.py

Literature

Metric introduced by [IBL].