aeif_cond_alpha#
- class brainpy.state.aeif_cond_alpha(in_size, V_peak=Quantity(0., "mV"), V_reset=Quantity(-60., "mV"), t_ref=Quantity(0., "ms"), g_L=Quantity(30., "nS"), C_m=Quantity(281., "pF"), E_ex=Quantity(0., "mV"), E_in=Quantity(-85., "mV"), E_L=Quantity(-70.6, "mV"), Delta_T=Quantity(2., "mV"), tau_w=Quantity(144., "ms"), a=Quantity(4., "nS"), b=Quantity(80.5, "pA"), V_th=Quantity(-50.4, "mV"), tau_syn_ex=Quantity(0.2, "ms"), tau_syn_in=Quantity(2., "ms"), I_e=Quantity(0., "pA"), gsl_error_tol=1e-06, V_initializer=Constant(value=-70.6 mV), g_ex_initializer=Constant(value=0. nS), g_in_initializer=Constant(value=0. nS), w_initializer=Constant(value=0. pA), spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='hard', ref_var=False, name=None)#
NEST-compatible
aeif_cond_alphaneuron model.Conductance-based adaptive exponential integrate-and-fire neuron with alpha-shaped synaptic conductances.
- Parameters:
in_size (
Size) – Population shape. States are broadcast/initialized overself.varshapederived fromin_size.V_peak (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.V_reset (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.V_th (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.E_ex (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.E_in (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.E_L (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.Delta_T (
ArrayLike) – Voltage-like parameters in mV, each broadcastable toself.varshape.t_ref (
ArrayLike) – Time constants in ms, broadcastable toself.varshape.tau_w (
ArrayLike) – Time constants in ms, broadcastable toself.varshape.tau_syn_ex (
ArrayLike) – Time constants in ms, broadcastable toself.varshape.tau_syn_in (
ArrayLike) – Time constants in ms, broadcastable toself.varshape.g_L (
ArrayLike) – Conductances in nS, broadcastable toself.varshape.a (
ArrayLike) – Conductances in nS, broadcastable toself.varshape.C_m (
ArrayLike) – Membrane capacitance in pF, broadcastable toself.varshape.b (
ArrayLike) – Currents in pA, broadcastable toself.varshape.I_e (
ArrayLike) – Currents in pA, broadcastable toself.varshape.gsl_error_tol (
ArrayLike) – Unitless local RKF45 error tolerance, broadcastable and strictly positive.V_initializer (
Callable) – Initializer callables used byinit_state()andreset_state().g_ex_initializer (
Callable) – Initializer callables used byinit_state()andreset_state().g_in_initializer (
Callable) – Initializer callables used byinit_state()andreset_state().w_initializer (
Callable) – Initializer callables used byinit_state()andreset_state().spk_fun (
Callable) – Surrogate spike function used byget_spike().spk_reset (
str) – Reset mode inherited fromNeuron.ref_var (
bool) – IfTrue, allocate and exposeself.refractorystate.name (
str | None) – Optional node name.
Parameter Mapping
Table 13 Parameter mapping to model symbols# Parameter
Type / shape / unit
Default
Math symbol
Semantics
in_sizeSize; scalar or tuplerequired
–
Population shape defining
self.varshape.V_peakArrayLike, broadcastable to
self.varshape(mV)0.0 * u.mV\(V_\mathrm{peak}\)
Spike detection threshold when
Delta_T > 0and RHS clamp limit via \(\min(V, V_{\mathrm{peak}})\).V_resetArrayLike, broadcastable (mV)
-60.0 * u.mV\(V_\mathrm{reset}\)
Membrane reset value and refractory clamp voltage.
t_refArrayLike, broadcastable (ms)
0.0 * u.ms\(t_\mathrm{ref}\)
Absolute refractory duration converted to integer step counts using
ceil(t_ref / dt).g_LandC_mArrayLike, broadcastable (nS, pF)
30.0 * u.nS,281.0 * u.pF\(g_L\), \(C_m\)
Leak conductance and membrane capacitance in the AdEx membrane ODE.
E_ex,E_in, andE_LArrayLike, broadcastable (mV)
0.0 * u.mV,-85.0 * u.mV,-70.6 * u.mV\(E_\mathrm{ex}\), \(E_\mathrm{in}\), \(E_L\)
Excitatory, inhibitory, and leak reversal potentials.
Delta_TandV_thArrayLike, broadcastable (mV)
2.0 * u.mV,-50.4 * u.mV\(\Delta_T\), \(V_\mathrm{th}\)
Exponential spike-initiation slope and soft-threshold location.
tau_w,a, andbArrayLike, broadcastable (ms, nS, pA)
144.0 * u.ms,4.0 * u.nS,80.5 * u.pA\(\tau_w\), \(a\), \(b\)
Adaptation time constant, subthreshold coupling, and spike-triggered jump amplitude.
tau_syn_exandtau_syn_inArrayLike, broadcastable (ms)
0.2 * u.ms,2.0 * u.ms\(\tau_{\mathrm{syn,ex}}\), \(\tau_{\mathrm{syn,in}}\)
Alpha conductance time constants for excitatory/inhibitory channels.
I_eArrayLike, broadcastable (pA)
0.0 * u.pA\(I_e\)
Constant injected current added every substep.
gsl_error_tolArrayLike, broadcastable, unitless,
> 01e-6–
Local absolute tolerance for the embedded RKF45 error estimate.
V_initializerCallable
Constant(-70.6 * u.mV)–
Initializer for membrane potential state
V.g_ex_initializerandg_in_initializerCallable
Constant(0.0 * u.nS)–
Initializers for
g_exandg_in;dg_exanddg_inalways start at zero.w_initializerCallable
Constant(0.0 * u.pA)–
Initializer for adaptation current
w.spk_funCallable
ReluGrad()–
Surrogate spike nonlinearity used by
get_spike().spk_resetstr
'hard'–
Reset policy inherited from
Neuron; hard reset matches NEST behavior.ref_varbool
False–
If
True, expose boolean stateself.refractory.namestr | None
None–
Optional node name.
- Returns:
out – Configured neuron node. Each
update()call returns a binary spike tensor (dtypefloat64) with shapeself.V.value.shape.- Return type:
Any
Description
aeif_cond_alphafollows NESTmodels/aeif_cond_alpha.{h,cpp}. The model combines:exponential spike-initiation current (AdEx),
spike-triggered and subthreshold adaptation current
w,alpha-shaped excitatory/inhibitory conductances.
1. Membrane, synapse, and adaptation dynamics
Let \(V\) be membrane voltage and \(w\) adaptation current.
\[C_m \frac{dV}{dt} = -g_L (V - E_L) + g_L \Delta_T \exp\!\left(\frac{V - V_{th}}{\Delta_T}\right) - g_{ex}(V - E_{ex}) - g_{in}(V - E_{in}) - w + I_e + I_{stim}.\]Adaptation dynamics:
\[\tau_w \frac{dw}{dt} = a (V - E_L) - w.\]Alpha conductance states (two states per channel):
\[\frac{d\,dg_{ex}}{dt} = -\frac{dg_{ex}}{\tau_{syn,ex}}, \qquad \frac{d g_{ex}}{dt} = dg_{ex} - \frac{g_{ex}}{\tau_{syn,ex}},\]\[\frac{d\,dg_{in}}{dt} = -\frac{dg_{in}}{\tau_{syn,in}}, \qquad \frac{d g_{in}}{dt} = dg_{in} - \frac{g_{in}}{\tau_{syn,in}}.\]Incoming spike weights are interpreted in nS and split by sign:
\[dg_{ex} \leftarrow dg_{ex} + \frac{e}{\tau_{syn,ex}} w_+, \qquad dg_{in} \leftarrow dg_{in} + \frac{e}{\tau_{syn,in}} |w_-|.\]2. Refractory and spike handling (NEST semantics)
During refractory integration, NEST clamps effective membrane voltage to
V_resetand sets \(dV/dt=0\). Otherwise the RHS uses \(\min(V, V_{peak})\) as effective voltage.Threshold detection uses:
V_peakifDelta_T > 0,V_thifDelta_T == 0(iaf-like limit).
On each detected spike:
Vis reset toV_reset,adaptation jump
w <- w + bis applied immediately,refractory counter is set to
refractory_counts + 1if refractory is enabled.
Spike handling occurs inside the adaptive RKF45 substep loop. Therefore, with
t_ref = 0multiple spikes can occur inside one simulation step, matching NEST behavior.3. Update order per simulation step
Integrate ODEs on \((t, t+dt]\) via adaptive RKF45.
Inside integration loop: apply refractory clamp and spike/reset/adaptation.
After loop: decrement refractory counter once.
Apply arriving spike weights to
dg_ex/dg_in.Store external current input
xinto one-step delayedI_stim.
- Raises:
ValueError – If parameters violate NEST-compatible constraints:
V_reset < V_peak,V_peak >= V_th,Delta_T >= 0,C_m > 0,t_ref >= 0, all time constants strictly positive, andgsl_error_tol > 0. Also raised when(V_peak - V_th) / Delta_Tcan overflow the exponential term, or if runtime states exceed stability guards inupdate().TypeError – If incompatible unitful/unitless values are passed and arithmetic fails during parameter broadcasting or updates.
- V#
Membrane potential \(V_m\) (mV).
- Type:
HiddenState
- dg_ex, dg_in
Alpha auxiliary states stored as numeric values representing \(\mathrm{nS}/\mathrm{ms}\).
- Type:
ShortTermState
- g_ex, g_in
Excitatory and inhibitory conductances (nS).
- Type:
HiddenState
- w#
Adaptation current (pA).
- Type:
HiddenState
- refractory_step_count#
Remaining refractory grid steps (
int32).- Type:
ShortTermState
- integration_step#
Persistent RKF45 substep size estimate (ms).
- Type:
ShortTermState
- I_stim#
One-step delayed injected current buffer (pA).
- Type:
ShortTermState
- last_spike_time#
Last emitted spike time (ms); written as
t + dton spike.- Type:
ShortTermState
- refractory#
Optional boolean refractory indicator, available only when
ref_var=True.- Type:
ShortTermState
See also
aeif_cond_expAdEx conductance model with exponential (single-state) synaptic kernels.
aeif_cond_alpha_multisynapseAdEx alpha-conductance model with receptor-indexed ports.
aeif_psc_alphaCurrent-based AdEx model with alpha PSCs.
Notes
The two-state alpha formulation is equivalent to a causal alpha kernel. With an event of effective conductance weight \(w\) applied at \(t=0\) through
dg += e w / \tau, the resulting conductance is:\[g(t) = w \cdot \frac{t}{\tau} \exp\!\left(1-\frac{t}{\tau}\right),\quad t \ge 0.\]Hence the kernel peaks at \(t=\tau\) with amplitude exactly \(w\), matching NEST’s interpretation of weight magnitudes in nS.
Additional implementation implications:
t_ref=0(default) allows multiple in-loop spikes within one grid step.Current input
xis delayed by one step viaI_stim(ring-buffer semantics), while spike events are applied after ODE integration.Runtime is dominated by per-neuron adaptive RKF45 loops and therefore scales with both population size and accepted substeps.
Spike output is binary per simulation step even though multiple internal spike/reset events can occur during a single
dtintegration window.
References
Examples
>>> import brainpy >>> import brainstate >>> import saiunit as u >>> neuron = brainpy.state.aeif_cond_alpha( ... in_size=3, ... V_peak=0.0 * u.mV, ... t_ref=2.0 * u.ms, ... ) >>> neuron.init_state() >>> with brainstate.environ.context(dt=0.1 * u.ms, t=0.0 * u.ms): ... spikes = neuron.update(x=120.0 * u.pA) >>> spikes.shape (3,)
- get_spike(V=None)[source]#
Evaluate surrogate spike output from membrane voltage.
- Parameters:
V (
ArrayLike, optional) – Voltage values with shape broadcastable toself.varshapeand units compatible with mV. IfNone, uses current stateself.V.value.- Returns:
Surrogate spike activation produced by
spk_fun((V - V_th) / (V_th - V_reset)).- Return type:
ArrayLike
- init_state(**kwargs)[source]#
Initialize persistent and short-term state variables.
- Parameters:
**kwargs – Unused compatibility parameters accepted by the base-state API.
- Raises:
ValueError – If an initializer cannot be broadcast to requested shape.
TypeError – If initializer outputs have incompatible units/dtypes for the corresponding state variables.
- update(x=Quantity(0., 'pA'))[source]#
Advance the neuron by one simulation step.
- Parameters:
x (
ArrayLike, optional) – Continuous external current input in pA, broadcastable toself.varshape. This value is stored intoI_stimand applied at the next simulation step (one-step delay).- Returns:
Binary spike tensor with dtype
jnp.float64and shapeself.V.value.shape. A value of1.0indicates at least one internal spike event occurred during the integrated interval \((t, t+dt]\).- Return type:
jax.Array- Raises:
ValueError – If RKF45 integration enters a guarded unstable regime (
V < -1e3 mVor|w| > 1e6 pA), indicating divergent dynamics for the current parameter/input regime.
Notes
Integration is performed with an adaptive vectorized RKF45 loop, including in-loop spike/reset/adaptation events and optional multiple spikes per step. All arithmetic is unit-aware via
saiunit.math.