firing_rate

Contents

firing_rate#

class brainpy.measure.firing_rate(spikes, width, dt=None, numpy=True)[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:
  • spikes (ndarray) – The spike matrix which record spiking activities.

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

  • dt (float, optional) – The sample rate.

  • numpy (bool) – Whether we use numpy array as the functional output. If False, this function can be JIT compiled.

Returns:

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

Return type:

ndarray