AdQuaIFRef#
- class brainpy.state.AdQuaIFRef(in_size, R=Quantity(1., "ohm"), tau=Quantity(10., "ms"), tau_w=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_c=Quantity(-50., "mV"), c=Quantity(0.07, "1 / mV"), a=Quantity(1., "S"), b=Quantity(0.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 Quadratic Integrate-and-Fire neuron model with refractory mechanism.
This model extends AdQuaIF by adding an absolute refractory period during which the neuron cannot fire regardless of input. The combination of adaptation and refractory period creates realistic firing patterns.
- 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_w (
ArrayLike, default10. * u.ms) – Adaptation current time constant.tau_ref (
ArrayLike, default1.7 * u.ms) – Absolute refractory period duration.V_th (
ArrayLike, default-30. * u.mV) – 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_c (
ArrayLike, default-50. * u.mV) – Critical voltage for spike initiation.c (
ArrayLike, default0.07 / u.mV) – Coefficient describing membrane potential update.a (
ArrayLike, default1. * u.siemens) – Coupling strength from voltage to adaptation current.b (
ArrayLike, default0.1 * u.mA) – Increment of 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, defaultsurrogate.ReluGrad()) – Surrogate gradient function.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
- 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
Combines spike-frequency adaptation with absolute refractory period.
During refractory period, neuron state is held at reset values.
Set ref_var=True to track refractory state as a boolean variable.
Refractory period prevents unrealistically high firing rates.
More biologically realistic than AdQuaIF without refractory period.
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> # Create an AdQuaIFRef neuron layer with refractory period >>> adquaif_ref = brainpy.state.AdQuaIFRef(10, tau=10*u.ms, ... tau_w=100*u.ms, tau_ref=2.0*u.ms, ref_var=True) >>> # Initialize the state >>> adquaif_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.