Presence ratio (presence_ratio
)¶
Calculation¶
Presence ratio is the proportion of discrete time bins in which at least one spike occurred.
\(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 sqm
# Combine sorting and recording into a sorting_analyzer
presence_ratio = sqm.compute_presence_ratios(sorting_analyzer=sorting_analyzer)
# presence_ratio is a dict containing the unit IDs as keys
# and their presence ratio (between 0 and 1) as values.
Links to original implementations¶
From the AllenSDK
References¶
- spikeinterface.qualitymetrics.misc_metrics.compute_presence_ratios(sorting_analyzer, bin_duration_s=60.0, mean_fr_ratio_thresh=0.0, unit_ids=None, **kwargs)¶
Calculate the presence ratio, the fraction of time the unit is firing above a certain threshold.
- Parameters
- sorting_analyzer: SortingAnalyzer
A SortingAnalyzer object
- bin_duration_sfloat, default: 60
The duration of each bin in seconds. If the duration is less than this value, presence_ratio is set to NaN
- mean_fr_ratio_thresh: float, default: 0
The unit is considered active in a bin if its firing rate during that bin is strictly above mean_fr_ratio_thresh times its mean firing rate throughout the recording.
- unit_idslist or None
The list of unit ids to compute the presence ratio. If None, all units are used.
- Returns
- presence_ratiodict of flaots
The presence ratio for each unit ID.
Notes
The total duration, across all segments, is divided into “num_bins”. To do so, spike trains across segments are concatenated to mimic a continuous segment.
Literature¶
Unknown origin.