gif_psc_exp#

class brainpy.state.gif_psc_exp(in_size, g_L=Quantity(4., "nS"), E_L=Quantity(-70., "mV"), C_m=Quantity(80., "pF"), V_reset=Quantity(-55., "mV"), Delta_V=Quantity(0.5, "mV"), V_T_star=Quantity(-35., "mV"), lambda_0=1.0, t_ref=Quantity(4., "ms"), tau_syn_ex=Quantity(2., "ms"), tau_syn_in=Quantity(2., "ms"), I_e=Quantity(0., "pA"), tau_sfa=(), q_sfa=(), tau_stc=(), q_stc=(), rng_key=None, V_initializer=Constant(value=-70. mV), spk_fun=ReluGrad(alpha=0.3, width=1.0), spk_reset='hard', ref_var=False, name=None)#

Current-based generalized integrate-and-fire neuron (GIF) model.

This is a brainpy.state re-implementation of the NEST simulator’s gif_psc_exp model according to Mensi et al. (2012) [1] and Pozzorini et al. (2015) [2], using NEST-standard parameterization and exact integration.

The GIF model features both spike-triggered adaptation currents and a dynamic firing threshold for spike-frequency adaptation. It generates spikes stochastically based on a point process with intensity that depends on the distance between the membrane potential and the adaptive threshold.

1. Mathematical Model

1.1 Membrane Dynamics

The membrane potential \(V\) is governed by:

\[C_\mathrm{m} \frac{dV(t)}{dt} = -g_\mathrm{L}(V(t) - E_\mathrm{L}) - \eta_1(t) - \eta_2(t) - \ldots - \eta_n(t) + I(t)\]

where:

  • \(C_\mathrm{m}\) is the membrane capacitance

  • \(g_\mathrm{L}\) is the leak conductance

  • \(E_\mathrm{L}\) is the leak reversal potential

  • \(\eta_i(t)\) are spike-triggered currents (stc)

  • \(I(t) = I_\mathrm{syn,ex}(t) + I_\mathrm{syn,in}(t) + I_\mathrm{e} + I_\mathrm{stim}(t)\)

1.2 Synaptic Currents

Synaptic currents decay exponentially:

\[\frac{dI_{\mathrm{syn,ex}}}{dt} = -\frac{I_{\mathrm{syn,ex}}}{\tau_{\mathrm{syn,ex}}}, \qquad \frac{dI_{\mathrm{syn,in}}}{dt} = -\frac{I_{\mathrm{syn,in}}}{\tau_{\mathrm{syn,in}}}\]

Incoming spike weights (in pA) are routed by sign: positive weights to \(I_{\mathrm{syn,ex}}\), negative to \(I_{\mathrm{syn,in}}\).

1.3 Spike-Triggered Currents (STC)

Each spike-triggered current element \(\eta_i\) evolves as:

\[\tau_{\eta_i} \frac{d\eta_i}{dt} = -\eta_i\]

On spike emission:

\[\eta_i \leftarrow \eta_i + q_{\eta_i}\]

1.4 Spike-Frequency Adaptation (SFA)

The neuron fires stochastically with intensity:

\[\lambda(t) = \lambda_0 \cdot \exp\left(\frac{V(t) - V_T(t)}{\Delta_V}\right)\]

where the dynamic threshold \(V_T(t)\) is:

\[V_T(t) = V_{T^*} + \gamma_1(t) + \gamma_2(t) + \ldots + \gamma_m(t)\]

Each adaptation element \(\gamma_i\) evolves as:

\[\tau_{\gamma_i} \frac{d\gamma_i}{dt} = -\gamma_i\]

On spike emission:

\[\gamma_i \leftarrow \gamma_i + q_{\gamma_i}\]

1.5 Stochastic Spiking

The probability of firing within a time step \(dt\) is:

\[P(\text{spike}) = 1 - \exp(-\lambda(t) \cdot dt)\]

A uniformly distributed random number is drawn each (non-refractory) time step and compared to this probability to determine spike emission.

1.6 Refractory Period

After a spike, the neuron enters an absolute refractory period of duration \(t_\mathrm{ref}\). During this period:

  • The refractory counter decrements each step

  • \(V_\mathrm{m}\) is clamped to \(V_\mathrm{reset}\)

  • Synaptic currents continue to decay and receive inputs

  • No spike checks are performed

2. Numerical Integration

The model uses exact matrix-exponential integration, matching NEST’s update order precisely. The discrete-time update per simulation step is:

  1. STC/SFA totals: Sum adaptation elements (before decay), then decay.

  2. Synaptic decay: \(I_\mathrm{syn} \leftarrow I_\mathrm{syn} \cdot e^{-dt/\tau}\).

  3. Spike weights: Add arriving spike weights to \(I_\mathrm{syn,ex}\) / \(I_\mathrm{syn,in}\).

  4. V update: If not refractory, apply exact propagator using post-weight synaptic currents. If refractory, clamp \(V\) to \(V_\mathrm{reset}\) and decrement counter.

  5. Store I_stim: Buffer external input for next step (NEST ring buffer semantics).

Parameters:
  • in_size (int, tuple of int) – Shape of the neuron population.

  • g_L (ArrayLike, optional) – Leak conductance. Default: 4.0 nS.

  • E_L (ArrayLike, optional) – Leak reversal potential. Default: -70.0 mV.

  • C_m (ArrayLike, optional) – Membrane capacitance. Default: 80.0 pF.

  • V_reset (ArrayLike, optional) – Reset potential after spike. Default: -55.0 mV.

  • Delta_V (ArrayLike, optional) – Stochasticity level. Default: 0.5 mV.

  • V_T_star (ArrayLike, optional) – Base firing threshold. Default: -35.0 mV.

  • lambda_0 (float, optional) – Stochastic intensity at threshold in 1/s. Default: 1.0 /s.

  • t_ref (ArrayLike, optional) – Absolute refractory period. Default: 4.0 ms.

  • tau_syn_ex (ArrayLike, optional) – Excitatory synaptic time constant. Default: 2.0 ms.

  • tau_syn_in (ArrayLike, optional) – Inhibitory synaptic time constant. Default: 2.0 ms.

  • I_e (ArrayLike, optional) – Constant external current. Default: 0.0 pA.

  • tau_sfa (Sequence[float], optional) – SFA time constants in ms. Default: () (no SFA).

  • q_sfa (Sequence[float], optional) – SFA jump values in mV. Default: () (no SFA).

  • tau_stc (Sequence[float], optional) – STC time constants in ms. Default: () (no STC).

  • q_stc (Sequence[float], optional) – STC jump values in pA. Default: () (no STC).

  • rng_key (jax.Array, optional) – JAX PRNG key for stochastic spiking. Default: None (seed 0).

  • V_initializer (Callable, optional) – Initializer for membrane potential. Default: Constant(-70 mV).

  • spk_fun (Callable, optional) – Surrogate gradient function. Default: ReluGrad().

  • spk_reset (str, optional) – Spike reset mode. Default: ‘hard’.

  • ref_var (bool, optional) – If True, expose boolean refractory state. Default: False.

  • name (str, optional) – Name of the neuron group. Default: None.

References

See also

gif_cond_exp

Conductance-based GIF model.

iaf_psc_exp

Simple IAF neuron with exponential synapses.

gif_psc_exp_multisynapse

GIF model with multiple receptor ports.

get_spike(V=None)[source]#

Generate surrogate spike output for gradient-based learning.

init_state(**kwargs)[source]#

Initialize persistent and short-term state variables.

update(x=Quantity(0., 'pA'))[source]#

Advance the neuron by one simulation step.

Follows NEST’s gif_psc_exp update order exactly:

  1. STC/SFA totals (before decay) + decay elements.

  2. Decay synaptic currents.

  3. Add arriving spike weights.

  4. Update V via exact propagator (non-refractory) or clamp to V_reset (refractory).

  5. Stochastic spike check; on spike: STC/SFA jumps, set refractory counter.

  6. Buffer external current for next step.

Parameters:

x (ArrayLike, optional) – External current input (pA). Buffered for the NEXT time step (NEST ring buffer semantics). Default: 0.0 pA.

Returns:

spike – Binary spike output as float array matching population shape.

Return type:

jax.Array