StepCurrentEncoder#
- class braintools.spike.StepCurrentEncoder(current_scale=10.0, offset=0.0, normalize=True, min_val=None, max_val=None)#
Encode inputs as step current injections for LIF neurons.
Converts input values to constant current levels \(I = x \cdot \text{current_scale} + \text{offset}\) that can be injected into integrate-and-fire neurons; the neuron model then produces the spikes, with a firing rate set by the current amplitude. The values are plain numbers: multiply by a unit (e.g.
u.nA) when the model expects a Quantity.- Parameters:
See also
DeltaEncoderSpikes on changes of a time series.
Examples
>>> import jax.numpy as jnp >>> import braintools >>> encoder = braintools.spike.StepCurrentEncoder(current_scale=10.0) >>> currents = encoder(jnp.array([0.1, 0.5, 1.0]), n_time=100) >>> currents.shape (100, 3) >>> currents[0] Array([ 1., 5., 10.], dtype=float32)