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 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_rates(wvf_extractor)
# firing_rate is a dict containing the units' ID as keys,
# and their firing rate across segments as values (in Hz).
References¶
- spikeinterface.qualitymetrics.misc_metrics.compute_firing_rates(waveform_extractor)¶
Compute the firing rate across segments.
- Parameters
- waveform_extractorWaveformExtractor
The waveform extractor object.
- 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].