spiketools.measures.spikes.compute_firing_rate¶
- spiketools.measures.spikes.compute_firing_rate(spikes, time_range=None)[source]¶
Estimate firing rate from a vector of spike times, in seconds.
- Parameters:
- spikes1d array
Spike times, in seconds.
- time_rangelist of [float, float], optional
Time range, in seconds, to calculate the firing rate across.
- Returns:
- frfloat
Average firing rate.
Examples
Compute spike rate from spike times:
>>> spikes = np.array([0.5, 1, 1.5, 2, 2.5, 3]) >>> compute_firing_rate(spikes) 2.4