PoissonSpike

Contents

PoissonSpike#

class brainpy.state.PoissonSpike(in_size, freqs, spk_type=<class 'bool'>, name=None)#

Poisson spike generator with fixed firing rates.

Generates independent Poisson spike trains for each neuron at every time step. The probability of a spike in each time bin is:

\[P(\text{spike}) = \text{freq} \cdot dt\]

where freq is the firing frequency and dt is the simulation time step.

Parameters:
  • in_size (Size) – Number of neurons (spike channels) to generate.

  • freqs (ArrayLike or Callable) – Firing frequency for each neuron. Can be a scalar (same rate for all neurons), an array of shape in_size, or a callable initializer.

  • spk_type (DTypeLike, default bool) – Data type of the output spike array. Use bool for binary spikes or a float type for weighted spikes.

  • name (str, optional) – Name of the module.

See also

PoissonEncoder

Poisson encoder that accepts dynamic firing rates.

PoissonInput

Efficient Poisson input applied directly to a state variable.

SpikeTime

Deterministic spike generator at specified times.

Notes

  • Unlike PoissonEncoder, the firing rates are fixed at construction time and cannot be changed during simulation.

  • Each call to update() generates a fresh independent sample; there is no memory of previous spikes (renewal process).

  • For large populations, consider using PoissonInput which avoids materializing the full spike array.

References

Examples

>>> import brainpy
>>> import brainstate
>>> import saiunit as u
>>> # Create 100 Poisson neurons firing at 50 Hz
>>> poisson = brainpy.state.PoissonSpike(100, freqs=50.*u.Hz)
>>> with brainstate.environ.context(dt=0.1*u.ms):
...     spikes = poisson.update()