IzhikevichRef#
- class brainpy.state.IzhikevichRef(in_size, a=Quantity(0.02, "kHz"), b=Quantity(0.2, "kHz"), c=Quantity(-65., "mV"), d=Quantity(8., "mV / ms"), V_th=Quantity(30., "mV"), tau_ref=Quantity(0., "ms"), V_initializer=Constant(value=-65. mV), u_initializer=Constant(value=0. mV / ms), spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='hard', ref_var=False, name=None)#
Izhikevich neuron model with refractory period.
This class implements the Izhikevich neuron model with an absolute refractory period. During the refractory period after a spike, the neuron cannot fire regardless of input, which better captures the behavior of biological neurons that exhibit a recovery period after action potential generation.
The model is characterized by the following equations:
When not in refractory period:
\[ \frac{dV}{dt} = 0.04 V^2 + 5V + 140 - u + I(t) \]\[ \frac{du}{dt} = a(bV - u) \]During refractory period:
\[ V = c, \quad u = u \]Spike condition: If \(V \geq V_{th}\) and not in refractory period: emit spike, set \(V = c\), \(u = u + d\), and enter refractory period for \(\tau_{ref}\)
- Parameters:
in_size (
Size) – Size of the input to the neuron.a (
ArrayLike, default0.02 / u.ms) – Time scale of the recovery variable u.b (
ArrayLike, default0.2 / u.ms) – Sensitivity of the recovery variable u to the membrane potential V.c (
ArrayLike, default-65. * u.mV) – After-spike reset value of the membrane potential.d (
ArrayLike, default8. * u.mV / u.ms) – After-spike increment of the recovery variable u.V_th (
ArrayLike, default30. * u.mV) – Spike threshold voltage.tau_ref (
ArrayLike, default0. * u.ms) – Refractory period duration.V_initializer (
Callable) – Initializer for the membrane potential state.u_initializer (
Callable) – Initializer for the recovery variable state.spk_fun (
Callable, defaultsurrogate.ReluGrad()) – Surrogate gradient function for the non-differentiable spike generation.spk_reset (
str, default'hard') – Reset mechanism after spike generation.ref_var (
bool, defaultFalse) – Whether to expose a boolean refractory state variable.name (
str, optional) – Name of the neuron layer.
- V#
Membrane potential.
- Type:
HiddenState
- u#
Recovery variable.
- Type:
HiddenState
- last_spike_time#
Time of the last spike, used to implement refractory period.
- Type:
ShortTermState
- refractory#
Neuron refractory state (if ref_var=True).
- Type:
HiddenState
See also
IzhikevichIzhikevich model without refractory period.
Notes
The refractory period is implemented by tracking the time of the last spike and preventing membrane potential updates if the elapsed time is less than tau_ref.
During the refractory period, the membrane potential remains at the reset value c regardless of input current strength.
Refractory periods prevent high-frequency repetitive firing and are critical for realistic neural dynamics [1].
The simulation environment time variable ‘t’ is used to track the refractory state.
For parameter selection guidelines, see [2].
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> # Create an IzhikevichRef neuron layer with 10 neurons >>> izh_ref = brainpy.state.IzhikevichRef(10, tau_ref=2.*u.ms) >>> # Initialize the state >>> izh_ref.init_state(batch_size=1) >>> # Generate inputs and run simulation >>> time_steps = 100 >>> inputs = brainstate.random.randn(time_steps, 1, 10) * u.mV / u.ms >>> with brainstate.environ.context(dt=0.1 * u.ms): ... for t in range(time_steps): ... with brainstate.environ.context(t=t*0.1*u.ms): ... spikes = izh_ref.update(x=inputs[t])
- get_spike(V=None)[source]#
Generate spikes based on neuron state variables.
This abstract method must be implemented by subclasses to define the spike generation mechanism. The method should use the surrogate gradient function
self.spk_funto enable gradient-based learning.- Parameters:
*args – Positional arguments (typically state variables like membrane potential)
**kwargs – Keyword arguments
- Returns:
Binary spike tensor where 1 indicates a spike and 0 indicates no spike.
- Return type:
ArrayLike- Raises:
NotImplementedError – If the subclass does not implement this method.