# brainpy.measure.firing_rate¶

brainpy.measure.firing_rate(sp_matrix, width, window='gaussian')[source]

Calculate the mean firing rate over in a neuron group.

This method is adopted from Brian2.

The firing rate in trial $$k$$ is the spike count $$n_{k}^{sp}$$ in an interval of duration $$T$$ divided by $$T$$:

$v_k = {n_k^{sp} \over T}$
Parameters
• sp_matrix (bnp.ndarray) – The spike matrix which record spiking activities.

• width (int, float) – The width of the window in millisecond.

• window (str) –

The window to use for smoothing. It can be a string to chose a predefined window:

• flat: a rectangular,

• gaussian: a Gaussian-shaped window.

For the Gaussian window, the width parameter specifies the standard deviation of the Gaussian, the width of the actual window is 4 * width + dt. For the flat window, the width of the actual window is 2 * width/2 + dt.

Returns

rate – The population rate in Hz, smoothed with the given window.

Return type

numpy.ndarray