QIF

class QIF(shape: tuple[int, ...] | int, step_time: float, *, rest_v: float, crit_v: float, affinity: float, reset_v: float, thresh_v: float, refrac_t: float, time_constant: float, resistance: float = 1.0, batch_size: int = 1)[source]

Bases: VoltageMixin, SpikeRefractoryMixin, InfernoNeuron

Simulation of quadratic integrate-and-fire (QIF) neuron dynamics.

Implemented as an approximation using Euler’s method.

\[V_m(t + \Delta t) = \frac{\Delta t}{\tau_m} \left[ a \left(V_m(t) - V_\text{rest}\right)\left(V_m(t) - V_\text{crit}\right) + R_mI(t) \right]\]

If a spike was generated at time \(t\), then.

\[V_m(t) \leftarrow V_\text{reset}\]
Parameters:
  • shape (tuple[int, ...] | int) – shape of the group of neurons being simulated.

  • step_time (float) – length of a simulation time step, \(\Delta t\), in \(\text{ms}\).

  • rest_v (float) – membrane potential difference at equilibrium, \(V_\text{rest}\), in \(\text{mV}\).

  • crit_v (float) – membrane potential difference at which potential naturally increases, \(V_\text{crit}\), in \(\text{mV}\).

  • affinity (float) – controls the strength of the membrane potential’s drift towards \(V_\text{rest}\) and away from \(V_\text{crit}\), \(a\), unitless.

  • reset_v (float) – membrane voltage after an action potential is generated, \(V_\text{reset}\), in \(\text{mV}\).

  • thresh_v (float) – membrane voltage at which action potentials are generated, in \(\text{mV}\).

  • refrac_t (float) – length the absolute refractory period, in \(\text{ms}\).

  • time_constant (float) – time constant of exponential decay for membrane voltage, \(\tau_m\), in \(\text{ms}\).

  • resistance (float, optional) – resistance across the cell membrane, \(R_m\), in \(\text{M}\Omega\). Defaults to 1.0.

  • batch_size (int, optional) – size of input batches for simulation. Defaults to 1.

See also

For more details and references, visit Quadratic Integrate-and-Fire (QIF) in the zoo.

clear(**kwargs) None[source]

Resets neurons to their resting state.

property dt: float

Length of the simulation time step, in milliseconds.

Parameters:

value (float) – new simulation time step length.

Returns:

present simulation time step length.

Return type:

float

forward(inputs: Tensor, refrac_lock=True, **kwargs) Tensor[source]

Runs a simulation step of the neuronal dynamics.

Parameters:
  • inputs (torch.Tensor) – presynaptic currents, \(I(t)\), in \(\text{nA}\).

  • refrac_lock (bool, optional) – if membrane voltages should be fixed while in the refractory period. Defaults to True.

Returns:

if the corresponding neuron generated an action potential.

Return type:

torch.Tensor