braintools.cogtask.rate_to_prob

Contents

braintools.cogtask.rate_to_prob#

braintools.cogtask.rate_to_prob(base, dt)[source]#

Convert a firing rate to a spike probability per time step.

Computes base * dt / 1000: the probability that a Poisson neuron firing at base Hz emits a spike within one step of dt ms. This function was called firing_rate before braintools 0.4.0; that name remains as a deprecated alias.

Parameters:
  • base (float) – Firing rate in Hz.

  • dt (float) – Time step in ms.

Returns:

Spike probability per time step, base * dt / 1e3.

Return type:

float

Raises:

ValueError – If base * dt > 1e3, i.e. the probability would exceed 1.

Examples

>>> from braintools.cogtask import rate_to_prob
>>> rate_to_prob(100.0, 1.0)
0.1