Firing rate (firing_rate
)¶
Calculation¶
Firing rate is simply the average number of spikes within the recording per second.
\(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 firing rates can indicate errors. Highly contaminated units (type I error) may have high firing rates as a result of the 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 sqm
# Make recording, sorting and wvf_extractor object for your data.
firing_rate = sqm.compute_firing_rates(waveform_extractor=wvf_extractor)
# firing_rate is a dict containing the unit IDs as keys,
# and their firing rates across segments as values (in Hz).
References¶
- spikeinterface.qualitymetrics.misc_metrics.compute_firing_rates(waveform_extractor, unit_ids=None, **kwargs)¶
Compute the firing rate across segments.
- Parameters
- waveform_extractorWaveformExtractor
The waveform extractor object.
- unit_idslist or None
The list of unit ids to compute the firing rate. If None, all units are used.
- Returns
- firing_ratesdict of floats
The firing rate, across all segments, for each unit ID.
Links to original implementations¶
From the AllenSDK
Literature¶
Unknown origin. Widely discussed eg: [Buzsáki].