forked from nest/nestml
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix bug with
integrate_odes()
for numeric solver (nest#1147)
- Loading branch information
Showing
3 changed files
with
199 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
120 changes: 120 additions & 0 deletions
120
tests/nest_tests/resources/aeif_cond_alpha_alt_neuron.nestml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,120 @@ | ||
""" | ||
aeif_cond_alpha - Conductance based exponential integrate-and-fire neuron model | ||
############################################################################### | ||
|
||
Description | ||
+++++++++++ | ||
|
||
aeif_psc_alpha is the adaptive exponential integrate and fire neuron according to Brette and Gerstner (2005), with post-synaptic conductances in the form of a bi-exponential ("alpha") function. | ||
|
||
The membrane potential is given by the following differential equation: | ||
|
||
.. math:: | ||
|
||
C_m \frac{dV_m}{dt} = | ||
-g_L(V_m-E_L)+g_L\Delta_T\exp\left(\frac{V_m-V_{th}}{\Delta_T}\right) - | ||
g_e(t)(V_m-E_e) \\ | ||
-g_i(t)(V_m-E_i)-w + I_e | ||
|
||
and | ||
|
||
.. math:: | ||
|
||
\tau_w \frac{dw}{dt} = a(V_m-E_L) - w | ||
|
||
Note that the membrane potential can diverge to positive infinity due to the exponential term. To avoid numerical instabilities, instead of :math:`V_m`, the value :math:`\min(V_m,V_{peak})` is used in the dynamical equations. | ||
|
||
|
||
References | ||
++++++++++ | ||
|
||
.. [1] Brette R and Gerstner W (2005). Adaptive exponential | ||
integrate-and-fire model as an effective description of neuronal | ||
activity. Journal of Neurophysiology. 943637-3642 | ||
DOI: https://doi.org/10.1152/jn.00686.2005 | ||
|
||
|
||
See also | ||
++++++++ | ||
|
||
iaf_psc_alpha, aeif_psc_exp | ||
""" | ||
model aeif_cond_alpha_alt_neuron: | ||
|
||
state: | ||
V_m mV = E_L # Membrane potential | ||
w pA = 0 pA # Spike-adaptation current | ||
refr_t ms = 0 ms # Refractory period timer | ||
g_exc nS = 0 nS # AHP conductance | ||
g_exc' nS/ms = 0 nS/ms # AHP conductance | ||
g_inh nS = 0 nS # AHP conductance | ||
g_inh' nS/ms = 0 nS/ms # AHP conductance | ||
|
||
equations: | ||
inline V_bounded mV = min(V_m, V_peak) # prevent exponential divergence | ||
|
||
g_exc'' = -2 * g_exc' / tau_syn_exc - g_exc / tau_syn_exc**2 | ||
g_inh'' = -2 * g_inh' / tau_syn_inh - g_inh / tau_syn_inh**2 | ||
|
||
# Add inlines to simplify the equation definition of V_m | ||
inline exp_arg real = (V_bounded - V_th) / Delta_T | ||
inline I_spike pA = g_L * Delta_T * exp(exp_arg) | ||
|
||
V_m' = (-g_L * (V_bounded - E_L) + I_spike - g_exc * (V_bounded - E_exc) - g_inh * (V_bounded - E_inh) - w + I_e + I_stim) / C_m | ||
w' = (a * (V_bounded - E_L) - w) / tau_w | ||
|
||
refr_t' = -1e3 * ms/s # refractoriness is implemented as an ODE, representing a timer counting back down to zero. XXX: TODO: This should simply read ``refr_t' = -1 / s`` (see https://github.com/nest/nestml/issues/984) | ||
|
||
parameters: | ||
# membrane parameters | ||
C_m pF = 281.0 pF # Membrane Capacitance | ||
refr_T ms = 2 ms # Duration of refractory period | ||
V_reset mV = -60.0 mV # Reset Potential | ||
g_L nS = 30.0 nS # Leak Conductance | ||
E_L mV = -70.6 mV # Leak reversal Potential (aka resting potential) | ||
|
||
# spike adaptation parameters | ||
a nS = 4 nS # Subthreshold adaptation | ||
b pA = 80.5 pA # Spike-triggered adaptation | ||
Delta_T mV = 2.0 mV # Slope factor | ||
tau_w ms = 144.0 ms # Adaptation time constant | ||
V_th mV = -50.4 mV # Threshold Potential | ||
V_peak mV = 0 mV # Spike detection threshold | ||
|
||
# synaptic parameters | ||
tau_syn_exc ms = 0.2 ms # Synaptic Time Constant Excitatory Synapse | ||
tau_syn_inh ms = 2.0 ms # Synaptic Time Constant for Inhibitory Synapse | ||
E_exc mV = 0 mV # Excitatory reversal Potential | ||
E_inh mV = -85.0 mV # Inhibitory reversal Potential | ||
|
||
# constant external input current | ||
I_e pA = 0 pA | ||
|
||
input: | ||
exc_spikes <- excitatory spike | ||
inh_spikes <- inhibitory spike | ||
I_stim pA <- continuous | ||
|
||
output: | ||
spike | ||
|
||
update: | ||
if refr_t > 0 ms: | ||
# neuron is absolute refractory, do not evolve V_m | ||
integrate_odes(g_exc, g_inh, w, refr_t) | ||
else: | ||
# neuron not refractory | ||
integrate_odes(g_exc, g_inh, V_m, w) | ||
|
||
onReceive(exc_spikes): | ||
g_exc' += exc_spikes * (e / tau_syn_exc) * nS * s | ||
|
||
onReceive(inh_spikes): | ||
g_inh' += inh_spikes * (e / tau_syn_inh) * nS * s | ||
|
||
onCondition(refr_t <= 0 ms and V_m >= V_th): | ||
# threshold crossing | ||
refr_t = refr_T # start of the refractory period | ||
V_m = V_reset | ||
w += b | ||
emit_spike() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters