ExpIFRef#
- class brainpy.state.ExpIFRef(in_size, R=Quantity(1., "ohm"), tau=Quantity(10., "ms"), tau_ref=Quantity(1.7, "ms"), V_th=Quantity(-30., "mV"), V_reset=Quantity(-68., "mV"), V_rest=Quantity(-65., "mV"), V_T=Quantity(-59.9, "mV"), delta_T=Quantity(3.48, "mV"), V_initializer=Constant(value=-65. mV), spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='soft', ref_var=False, name=None)#
Exponential Integrate-and-Fire neuron model with refractory mechanism.
This neuron adds an absolute refractory period to
ExpIF. While the exponential spike-initiation term keeps the membrane potential dynamics smooth, the refractory mechanism prevents the neuron from firing withintau_refafter a spike.- Parameters:
in_size (
Size) – Size of the input to the neuron.R (
ArrayLike, default1. * u.ohm) – Membrane resistance.tau (
ArrayLike, default10. * u.ms) – Membrane time constant.tau_ref (
ArrayLike, default1.7 * u.ms) – Absolute refractory period duration.V_th (
ArrayLike, default-30. * u.mV) – Numerical firing threshold voltage.V_reset (
ArrayLike, default-68. * u.mV) – Reset voltage after spike.V_rest (
ArrayLike, default-65. * u.mV) – Resting membrane potential.V_T (
ArrayLike, default-59.9 * u.mV) – Threshold potential of the exponential term.delta_T (
ArrayLike, default3.48 * u.mV) – Spike slope factor controlling spike initiation sharpness.V_initializer (
Callable) – Initializer for the membrane potential state.spk_fun (
Callable, defaultsurrogate.ReluGrad()) – Surrogate gradient function for the spike generation.spk_reset (
str, default'soft') – 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
- last_spike_time#
Last spike time recorder.
- Type:
ShortTermState
- refractory#
Neuron refractory state.
- Type:
HiddenState
Notes
The refractory mechanism prevents the neuron from firing within
tau_refafter a spike by holding the membrane potential at the reset value.The simulation environment time variable
tmust be available viabrainstate.environ.get('t')for refractory tracking.
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> # Create an ExpIFRef neuron layer with 10 neurons >>> expif = brainpy.state.ExpIFRef(10, tau=10*u.ms, tau_ref=1.7*u.ms) >>> expif.init_state(batch_size=1)
- 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.