Izhikevich, Hodgkin-Huxley, Morris-Lecar
Single-compartment models with two exponentially decaying conductances ge, gi (targets :ge, :gi); no synapse or spike field.
Izhikevich model: IZ
\[\begin{aligned} \frac{dv}{dt} &= 0.04 v^2 + 5 v + 140 - u + I + g_e (E_e - v) + g_i (E_i - v) \\ \frac{du}{dt} &= a\,(b v - u) \\ \frac{dg_e}{dt} &= -\frac{g_e}{\tau_e}, \qquad \frac{dg_i}{dt} = -\frac{g_i}{\tau_i} \end{aligned}\]
When $v > 30$ mV: $v \leftarrow c$, $u \leftarrow u + d$. $I$ is in mV/ms.
| Field | Default | Units | Meaning |
|---|---|---|---|
a | 0.01 | 1/ms | recovery time scale |
b | 0.2 | - | sensitivity of $u$ to $v$ |
c | -65 | mV | reset value of $v$ |
d | 2 | - | reset increment of $u$ |
τe | 5ms | ms | decay of ge |
τi | 10ms | ms | decay of gi |
Ee | 0mV | mV | excitatory reversal potential |
Ei | -80mV | mV | inhibitory reversal potential |
Reference: Izhikevich (2003), IEEE Trans. Neural Netw. 14:1569-1572.
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.IZ(N = 10, param = SNN.IZParameter(a = 0.02, b = 0.2, c = -65, d = 8)) # regular spiking
E.I .= 10
SNN.monitor!(E, [:v, :fire])
SNN.sim!([E]; duration = 200ms, dt = 0.5ms)SNNModels.IZ — Type
IZ(; N = 100, param = IZParameter(), name = "IZ", kwargs...)Population of Izhikevich neurons with conductance-based excitatory (ge) and inhibitory (gi) synapses. Connections target :ge or :gi directly.
Equations
\[\begin{aligned} \frac{dv}{dt} &= 0.04 v^2 + 5 v + 140 - u + I + g_e (E_e - v) + g_i (E_i - v) \\ \frac{du}{dt} &= a\,(b v - u) \\ \frac{dg_e}{dt} &= -\frac{g_e}{\tau_e}, \qquad \frac{dg_i}{dt} = -\frac{g_i}{\tau_i} \end{aligned}\]
with $v$ in mV and $t$ in ms. When $v > 30$ mV: $v \leftarrow c$, $u \leftarrow u + d$. There is no capacitance: $I$ and $g (E - v)$ enter directly in mV/ms.
Integration
Per step: the conductances decay (forward Euler); $v$ is advanced with two forward-Euler half steps of dt/2 of the quadratic part (as in Izhikevich 2003), $u$ with one Euler step using the new $v$, then the synaptic term dt * (ge * (Ee - v) + gi * (Ei - v)) is added; finally spikes are detected (v > 30) and reset. No refractory period.
Fields
id::String = randstring(12),name::String = "IZ",param::IZParameter = IZParameter().N::Int32 = 100.VFT = Vector{Float32}: type of the state vectors;Vector{Float64}gives aFloat64population (seefloat_type).v::VFT = fill(-65, N): membrane potential (mV).u::VFT = param.b * v: recovery variable.fire::Vector{Bool};I::VFT: external input (mV/ms), zeros.spikes::SpikeIndex: neurons that fired in the step (seespike_index).ge::VFT = (1.5randn(N) .+ 4) .* 10nS: excitatory conductance, random initial values (mean 40 nS).gi::VFT = (12randn(N) .+ 20) .* 10nS: inhibitory conductance, random initial values (mean 200 nS, can be negative).records::Dict.
References
Izhikevich, E. M. (2003). Simple model of spiking neurons. IEEE Transactions on Neural Networks, 14(6), 1569-1572.
Example
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.IZ(N = 10, param = SNN.IZParameter(a = 0.02, b = 0.2, c = -65, d = 8))
E.I .= 10
SNN.monitor!(E, [:v, :fire])
SNN.sim!([E]; duration = 200ms, dt = 0.5ms)SNNModels.IZParameter — Type
IZParameter{FT = Float32}(; a = 0.01, b = 0.2, c = -65, d = 2, τe = 5ms, τi = 10ms,
Ee = 0mV, Ei = -80mV)Parameters of the Izhikevich neuron model (IZ) with two conductance-based, exponentially decaying synapses.
IZParameter <: AbstractPopulationParameter, so IZ populations run under both sim! and train! (the population has no plasticity of its own; update_traces! and plasticity! are the no-op fallbacks). Up to SNNModels 1.8.4 the type had no supertype and train! raised a MethodError.
Fields
a::FT = 0.01: time scale of the recovery variable $u$ (1/ms).b::FT = 0.2: sensitivity of $u$ to $v$.c::FT = -65: after-spike reset value of $v$ (mV).d::FT = 2: after-spike increment of $u$.τe::FT = 5ms: decay time constant of the excitatory conductancege(ms).τi::FT = 10ms: decay time constant of the inhibitory conductancegi(ms).Ee::FT = 0mV: excitatory reversal potential (mV).Ei::FT = -80mV: inhibitory reversal potential (mV).
The defaults a = 0.01, b = 0.2, c = -65, d = 2 are not one of the named firing classes of Izhikevich (2003) (regular spiking is a = 0.02, b = 0.2, c = -65, d = 8).
References
Izhikevich, E. M. (2003). Simple model of spiking neurons. IEEE Transactions on Neural Networks, 14(6), 1569-1572.
SNNModels.integrate! — Method
integrate!(p::IZ, param::IZParameter, dt)One step of the Izhikevich population: exponential decay of ge, gi (forward Euler), two half steps of the quadratic membrane equation, one step of u, the synaptic term, then spike detection (v > 30) with reset v = c, u += d. See IZ.
Hodgkin-Huxley model: HH
\[\begin{aligned} C_m \frac{dv}{dt} &= I + g_l (E_l - v) + g_e (E_e - v) + g_i (E_i - v) + g_n m^3 h (E_n - v) + g_k n^4 (E_k - v) \\ \frac{dx}{dt} &= \alpha_x(v)\,(1 - x) - \beta_x(v)\, x, \qquad x \in \{m, n, h\} \end{aligned}\]
with $u = v - V_t$ (mV) and rates in 1/ms:
\[\begin{aligned} \alpha_m &= \frac{0.32\,(13 - u)}{e^{(13 - u)/4} - 1}, & \beta_m &= \frac{0.28\,(u - 40)}{e^{(u - 40)/5} - 1}, \\ \alpha_n &= \frac{0.032\,(15 - u)}{e^{(15 - u)/5} - 1}, & \beta_n &= 0.5\, e^{(10 - u)/40}, \\ \alpha_h &= 0.128\, e^{(17 - u)/18}, & \beta_h &= \frac{4}{1 + e^{(40 - u)/5}}. \end{aligned}\]
A spike is flagged when $v$ crosses -20 mV upwards; no reset. Use dt of 0.01-0.05 ms.
| Field | Default | Value | Meaning |
|---|---|---|---|
Cm | 1uF * cm^(-2) * 20000um^2 | 200 pF | membrane capacitance |
gl | 5e-5siemens * cm^(-2) * 20000um^2 | 10 nS | leak conductance |
El | -65mV | leak reversal potential | |
Ek | -90mV | potassium reversal potential | |
En | 50mV | sodium reversal potential | |
gn | 100msiemens * cm^(-2) * 20000um^2 | 20000 nS | maximal sodium conductance |
gk | 30msiemens * cm^(-2) * 20000um^2 | 6000 nS | maximal potassium conductance |
Vt | -63mV | offset of the gating kinetics (not a threshold) | |
τe, τi | 5ms, 10ms | decay of ge, gi | |
Ee, Ei | 0mV, -80mV | synaptic reversal potentials |
Reference: Hodgkin and Huxley (1952), J. Physiol. 117:500-544; Traub-Miles kinetics as in the COBAHH benchmark of Brette et al. (2007).
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.HH(N = 5)
E.ge .= 0; E.gi .= 0 # remove the random initial conductances
E.I .= 500pA
SNN.monitor!(E, [:v])
SNN.sim!([E]; duration = 50ms, dt = 0.01ms)SNNModels.HH — Type
HH(; N = 100, param = HHParameter(), name = "HH", kwargs...)Population of single-compartment Hodgkin-Huxley neurons (sodium, delayed-rectifier potassium and leak currents) with conductance-based exponential synapses ge, gi. Connections target :ge or :gi.
Equations
\[\begin{aligned} C_m \frac{dv}{dt} &= I + g_l (E_l - v) + g_e (E_e - v) + g_i (E_i - v) + g_n m^3 h (E_n - v) + g_k n^4 (E_k - v) \\ \frac{dx}{dt} &= \alpha_x(v)\,(1 - x) - \beta_x(v)\, x, \qquad x \in \{m, n, h\} \\ \frac{dg_e}{dt} &= -\frac{g_e}{\tau_e}, \qquad \frac{dg_i}{dt} = -\frac{g_i}{\tau_i} \end{aligned}\]
with $u = v - V_t$ (mV) and rates in 1/ms:
\[\begin{aligned} \alpha_m &= \frac{0.32\,(13 - u)}{e^{(13 - u)/4} - 1}, & \beta_m &= \frac{0.28\,(u - 40)}{e^{(u - 40)/5} - 1}, \\ \alpha_n &= \frac{0.032\,(15 - u)}{e^{(15 - u)/5} - 1}, & \beta_n &= 0.5\, e^{(10 - u)/40}, \\ \alpha_h &= 0.128\, e^{(17 - u)/18}, & \beta_h &= \frac{4}{1 + e^{(40 - u)/5}}. \end{aligned}\]
Integration
Forward Euler, sequential: m, n, h are updated first, then $v$ with the new gating variables, then ge, gi decay. A spike is flagged (fire[i] = true) in the step in which $v$ crosses -20 mV upwards (v_old <= -20mV < v), so each action potential gives exactly one flag. There is no reset and no refractory period. A small dt (e.g. 0.01-0.05 ms) is needed for stability.
Fields
name::String = "HH",id::String = randstring(12),param::HHParameter = HHParameter().N::Int32 = 100.VFT = Vector{Float32}: type of the state vectors;Vector{Float64}gives aFloat64population (seefloat_type).v = El .+ 5(randn(N) .- 1): membrane potential (mV).m = zeros(N),n = zeros(N),h = ones(N): gating variables.ge = (1.5randn(N) .+ 4) .* 10nS,gi = (12randn(N) .+ 20) .* 10nS: synaptic conductances (nS), random initial values.fire::Vector{Bool};I: external current (pA);records::Dict.spikes::SpikeIndex: neurons that fired in the step (seespike_index).
References
Hodgkin A. L., Huxley A. F. (1952). A quantitative description of membrane current and its application to conduction and excitation in nerve. J. Physiol. 117:500-544. The rate functions and conductance densities above have the Traub-Miles form used in the COBAHH benchmark of Brette et al. (2007, J. Comput. Neurosci.).
Example
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.HH(N = 5)
E.ge .= 0; E.gi .= 0
E.I .= 500pA
SNN.monitor!(E, [:v])
SNN.sim!([E]; duration = 50ms, dt = 0.01ms)SNNModels.HHParameter — Type
HHParameter{FT = Float32}(; Cm, gl, El = -65mV, Ek = -90mV, En = 50mV, gn, gk, Vt = -63mV,
τe = 5ms, τi = 10ms, Ee = 0mV, Ei = -80mV)Parameters of the Hodgkin-Huxley population HH. Capacitance and maximal conductances are specified as densities times a membrane area of 20000 μm²:
Cm::FT = 1uF * cm^(-2) * 20000um^2: membrane capacitance, 200 pF.gl::FT = 5e-5siemens * cm^(-2) * 20000um^2: leak conductance, 10 nS.El::FT = -65mV: leak reversal potential (mV).Ek::FT = -90mV: potassium reversal potential (mV).En::FT = 50mV: sodium reversal potential (mV).gn::FT = 100msiemens * cm^(-2) * 20000um^2: maximal sodium conductance, 20000 nS.gk::FT = 30msiemens * cm^(-2) * 20000um^2: maximal potassium conductance, 6000 nS.Vt::FT = -63mV: offset of the gating kinetics (mV); it is not a spike threshold.τe::FT = 5ms,τi::FT = 10ms: decay time constants ofge,gi(ms).Ee::FT = 0mV,Ei::FT = -80mV: synaptic reversal potentials (mV).
In Float32 the four area-scaled defaults carry the rounding of the Float32 unit constants (199.99998 pF, ...); with FT = Float64 they are the decimal values 200, 10, 20000 and 6000.
Morris-Lecar model: MorrisLecar
\[\begin{aligned} C_m \frac{dv}{dt} &= I + g_l (E_l - v) + g_{Ca}\, m_\infty(v) (E_{Ca} - v) + g_K\, w\, (E_K - v) + g_e (E_e - v) + g_i (E_i - v) \\ \frac{dw}{dt} &= \frac{w_\infty(v) - w}{\tau_w(v)} \end{aligned}\]
\[m_\infty(v) = \tfrac12 \left(1 + \tanh\frac{v - V_1}{V_2}\right), \quad w_\infty(v) = \tfrac12 \left(1 + \tanh\frac{v - V_3}{V_4}\right), \quad \tau_w(v) = \frac{1}{\phi \cosh\left(\frac{v - V_3}{2 V_4}\right)}\]
A spike is flagged when $v$ crosses 20 mV upwards; no reset.
| Field | Default | Units | Meaning |
|---|---|---|---|
Cm | 6.69pF | pF | membrane capacitance |
El, EK, ECa | -50mV, -70mV, 100mV | mV | reversal potentials |
gl, gK, gCa | 0.5nS, 2nS, 1.1nS | nS | leak, potassium, calcium conductances |
τe, τi | 5ms, 10ms | ms | decay of ge, gi |
V1, V2 | 30mV, 15mV | mV | calcium activation midpoint and slope |
V3, V4 | 0mV, 30mV | mV | potassium activation midpoint and slope |
ϕ | 25Hz | 1/ms | potassium rate scale (0.025 per ms) |
Ee, Ei | 0mV, -75mV | mV | synaptic reversal potentials |
Reference: Morris and Lecar (1981), Biophys. J. 35:193-213.
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.MorrisLecar(N = 5)
E.I .= 100pA
SNN.monitor!(E, [:v, :w])
SNN.sim!([E]; duration = 200ms, dt = 0.05ms)SNNModels.MorrisLecar — Type
MorrisLecar(; N = 100, param = MorrisLecarParameter(), name = "MorrisLecar", kwargs...)Population of Morris-Lecar neurons (instantaneous calcium activation, slow potassium activation $w$) with conductance-based exponential synapses ge, gi. Connections target ge or gi: SpikingSynapse(pre, post, :ge; conn) (:glu is mapped to :ge, :gaba to :gi); a presynaptic spike of weight $w$ (nS) increments the conductance by $w$.
Equations
\[\begin{aligned} C_m \frac{dv}{dt} &= I + g_l (E_l - v) + g_{Ca}\, m_\infty(v) (E_{Ca} - v) + g_K\, w\, (E_K - v) + g_e (E_e - v) + g_i (E_i - v) \\ \frac{dw}{dt} &= \frac{w_\infty(v) - w}{\tau_w(v)} \\ m_\infty(v) &= \tfrac12 \left(1 + \tanh\frac{v - V_1}{V_2}\right), \quad w_\infty(v) = \tfrac12 \left(1 + \tanh\frac{v - V_3}{V_4}\right), \quad \tau_w(v) = \frac{1}{\phi \cosh\left(\frac{v - V_3}{2 V_4}\right)} \\ \frac{dg_e}{dt} &= -\frac{g_e}{\tau_e}, \qquad \frac{dg_i}{dt} = -\frac{g_i}{\tau_i} \end{aligned}\]
Integration
Forward Euler, sequential per neuron: $v$ is advanced with the intrinsic and external currents (old $w$), then $w$ with the new $v$, then the synaptic term dt / Cm * (ge * (Ee - v) + gi * (Ei - v)) is added, then ge, gi decay. A spike is flagged in the step in which $v$ crosses 20 mV upwards (one flag per action potential); there is no reset.
Fields
name::String = "MorrisLecar",id::String = randstring(12),param::MorrisLecarParameter = MorrisLecarParameter(),N::Int32 = 100.VFT = Vector{Float32}: type of the state vectors;Vector{Float64}gives aFloat64population (seefloat_type).v = -52.14 .+ zeros(N)(mV),w = 0.2 .+ zeros(N).ge,gi: synaptic conductances (nS), zeros.fire::Vector{Bool};I: external current (pA);records::Dict.spikes::SpikeIndex: neurons that fired in the step (seespike_index).
References
Morris C., Lecar H. (1981). Voltage oscillations in the barnacle giant muscle fiber. Biophys. J. 35:193-213. Parameters from the NEST ode-toolbox test morris_lecar.json.
Example
using SpikingNeuralNetworks
SNN.@load_units
E = SNN.MorrisLecar(N = 5)
E.I .= 100pA
SNN.monitor!(E, [:v, :w])
SNN.sim!([E]; duration = 200ms, dt = 0.05ms)SNNModels.MorrisLecarParameter — Type
MorrisLecarParameter{FT = Float32}(; Cm = 6.69pF, El = -50mV, EK = -70mV, ECa = 100mV,
gl = 0.5nS, gK = 2nS, gCa = 1.1nS, τe = 5ms, τi = 10ms,
V1 = 30mV, V2 = 15mV, V3 = 0mV, V4 = 30mV, ϕ = 25Hz,
Ee = 0mV, Ei = -75mV)Parameters of the Morris-Lecar population MorrisLecar. The values are taken from the NEST ode-toolbox test file morris_lecar.json (cited in the code).
Fields
Cm::FT = 6.69pF: membrane capacitance (pF).El::FT = -50mV,EK::FT = -70mV,ECa::FT = 100mV: leak, potassium and calcium reversal potentials (mV).gl::FT = 0.5nS,gK::FT = 2nS,gCa::FT = 1.1nS: leak, maximal potassium and maximal calcium conductances (nS).τe::FT = 5ms,τi::FT = 10ms: decay time constants ofge,gi(ms).V1::FT = 30mV,V2::FT = 15mV: midpoint and slope of the calcium activation $m_\infty$.V3::FT = 0mV,V4::FT = 30mV: midpoint and slope of the potassium activation $w_\infty$.ϕ::FT = 25Hz: rate scale of the potassium gating (0.025 per ms).Ee::FT = 0mV,Ei::FT = -75mV: synaptic reversal potentials (mV).
MorrisLecarParameter <: AbstractPopulationParameter, so MorrisLecar runs under sim! and train!. Up to SNNModels 1.8.4 train! raised a MethodError (no update_traces! method).