AdExIFRef#
- class brainpy.state.AdExIFRef(in_size, R=Quantity(1., "ohm"), tau=Quantity(10., "ms"), tau_w=Quantity(30., "ms"), tau_ref=Quantity(1.7, "ms"), V_th=Quantity(-55., "mV"), V_reset=Quantity(-68., "mV"), V_rest=Quantity(-65., "mV"), V_T=Quantity(-59.9, "mV"), delta_T=Quantity(3.48, "mV"), a=Quantity(1., "S"), b=Quantity(1., "mA"), V_initializer=Constant(value=-65. mV), w_initializer=Constant(value=0. mA), spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='soft', ref_var=False, name=None)#
Adaptive exponential Integrate-and-Fire neuron model with refractory mechanism.
This model extends
AdExIFby adding an absolute refractory period. While the exponential spike-initiation term and adaptation current keep the membrane potential dynamics biologically realistic, the refractory mechanism prevents the neuron from firing withintau_refafter a spike.The membrane dynamics are governed by two coupled differential equations:
\[ \tau \frac{dV}{dt} = -(V - V_{rest}) + \Delta_T \exp\left(\frac{V - V_T}{\Delta_T}\right) - R w + R \cdot I(t) \]\[ \tau_w \frac{dw}{dt} = a (V - V_{rest}) - w \]After each spike the membrane potential is reset and the adaptation current increases by
b. During the refractory period, the membrane potential remains at the reset value.- Parameters:
in_size (
Union[int,Sequence[int],integer,Sequence[integer]]) – Size of the input to the neuron.R (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Membrane resistance.tau (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Membrane time constant.tau_w (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Adaptation current time constant.tau_ref (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Absolute refractory period duration.V_th (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Spike threshold used for reset.V_reset (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Reset potential after spike.V_rest (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Resting membrane potential.V_T (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Threshold of the exponential term.delta_T (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Spike slope factor controlling the sharpness of spike initiation.a (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Coupling strength from voltage to adaptation current.b (
Union[Array,ndarray,bool,number,bool,int,float,complex,Quantity]) – Increment of the adaptation current after a spike.V_initializer (
Callable) – Initializer for the membrane potential state.w_initializer (
Callable) – Initializer for the adaptation current.spk_fun (
Callable) – Surrogate gradient function for the spike generation.spk_reset (
str) – Reset mechanism after spike generation.ref_var (
bool) – Whether to expose a boolean refractory state variable.name (
str) – Name of the neuron layer.
- V#
Membrane potential.
- Type:
HiddenState
- w#
Adaptation current.
- Type:
HiddenState
- last_spike_time#
Last spike time recorder.
- Type:
ShortTermState
- refractory#
Neuron refractory state (if ref_var=True).
- Type:
HiddenState
See also
Notes
The AdExIF model with refractory period combines adaptation dynamics with an absolute refractory period for more biologically realistic behavior.
References
See also
brainpy.dyn.AdExIFReffor the dynamical-system counterpart.Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> # Create an AdExIFRef neuron layer with 10 neurons >>> adexif_ref = brainpy.state.AdExIFRef(10, tau=10*u.ms, tau_ref=2*u.ms) >>> # Initialize the state >>> adexif_ref.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.