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
freqis the firing frequency anddtis the simulation time step.- Parameters:
in_size (
Size) – Number of neurons (spike channels) to generate.freqs (
ArrayLikeorCallable) – Firing frequency for each neuron. Can be a scalar (same rate for all neurons), an array of shapein_size, or a callable initializer.spk_type (
DTypeLike, defaultbool) – Data type of the output spike array. Useboolfor binary spikes or a float type for weighted spikes.name (
str, optional) – Name of the module.
See also
PoissonEncoderPoisson encoder that accepts dynamic firing rates.
PoissonInputEfficient Poisson input applied directly to a state variable.
SpikeTimeDeterministic 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
PoissonInputwhich 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()