Firing rate (firing_rate)

Calculation

Firing rate is simply the average number of spikes within the recording per second.

\[\textrm{firing rate} = \frac{N_s}{T_r}\]
  • \(N_s\) : number of spikes observed in full recording.

  • \(T_r\) : duration of recording in seconds.

Expectation and use

Both very high and very low values of firing rate can indicate errors. Highly contaminated units (type I error) may have high firing rates as a result of inclusion of other neurons’ spikes. Low firing rate units are likely to be incomplete (type II error), although this is not always the case (some neurons have highly selective firing patterns). The firing rate is expected to be approximately log-normally distributed [Buzsáki].

Example code

Without SpikeInterface:

spike_train = ...
t_recording = ...    # Length of recording (in s).

firing_rate = len(spike_train) / t_recording

With SpikeInterface:

import spikeinterface.qualitymetrics as qm

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

firing_rate = qm.compute_firing_rate(wvf_extractor)
# firing_rate is a dict containing the units' ID as keys,
# and their firing rate across segments as values (in Hz).

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.qualitymetrics.misc_metrics.compute_firing_rate(waveform_extractor, **kwargs)

Compute the firing rate across segments.

Parameters
waveform_extractorWaveformExtractor

The waveform extractor object.

Returns
firing_ratesdict

The firing rate, across all segments, for each unit ID.

Literature

Unknown origin. Widely discussed eg: Buzsáki.

Citations

Buzsáki

Buzsáki, György, and Kenji Mizuseki. “The Log-Dynamic Brain: How Skewed Distributions Affect Network Operations.” Nature reviews. Neuroscience 15.4 (2014): 264–278. Web.