Skip to content

Commit

Permalink
Add an alternative version of aeif_cond_alpha neuron model
Browse files Browse the repository at this point in the history
  • Loading branch information
pnbabu committed Dec 9, 2024
1 parent 0861ddb commit cf4193e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 19 deletions.
31 changes: 13 additions & 18 deletions models/neurons/aeif_cond_alpha_alt_neuron.nestml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"""
aeif_psc_alpha - Conductance based exponential integrate-and-fire neuron model
aeif_cond_alpha - Conductance based exponential integrate-and-fire neuron model
###############################################################################

Description
Expand Down Expand Up @@ -39,13 +39,12 @@ See also

iaf_psc_alpha, aeif_psc_exp
"""
model aeif_psc_alpha_neuron:
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
is_refractory integer = 0
g_exc nS = 0 nS # AHP conductance
g_exc' nS/ms = 0 nS/ms # AHP conductance
g_inh nS = 0 nS # AHP conductance
Expand All @@ -60,12 +59,14 @@ model aeif_psc_alpha_neuron:
# 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)
inline I_syn_exc pA = g_exc / nS * pA
inline I_syn_inh pA = g_inh / nS * pA
# inline I_syn_exc pA = g_exc / nS * pA
# inline I_syn_inh pA = g_inh / nS * pA

V_m' = is_refractory * (-g_L * (V_bounded - E_L) + I_spike + I_syn_exc * (V_bounded - E_exc) * nS / pA - I_syn_inh * (V_bounded - E_exc) * nS / pA - w + I_e + I_stim) / C_m
V_m' = (-g_L * (V_bounded - E_L) + I_spike + g_exc * (V_bounded - E_exc) - g_inh * (V_bounded - E_exc) - 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
Expand Down Expand Up @@ -100,28 +101,22 @@ model aeif_psc_alpha_neuron:
spike

update:
if is_refractory == 1:
if refr_t > 0 ms:
# neuron is absolute refractory, do not evolve V_m
refr_t -= resolution()

# always evolve all ODEs; V_m
integrate_odes()
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_exc) * nS * s

onReceive(inh_spikes):
g_inh' += inh_spikes * (e / tau_inh) * nS * s

onCondition(V_m >= V_th):
onCondition(refr_t <= 0 ms and V_m >= V_th):
# threshold crossing
refr_t = refr_T # start of the refractory period
is_refractory = 1
V_m = V_reset
w += b
emit_spike()

onCondition(is_refractory == 1 and refr_t <= resolution() / 2):
# end of refractory period
refr_t = 0 ms
is_refractory = 0
3 changes: 2 additions & 1 deletion tests/nest_gpu_tests/nest_gpu_code_generator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ def test_nest_gpu_code_generator_analytic(self):
suffix=suffix)

def test_nest_gpu_code_generator_numeric(self):
model_files = ["aeif_psc_exp_neuron.nestml"]
# model_files = ["aeif_psc_exp_neuron.nestml"]
model_files = ["aeif_cond_alpha_alt_neuron.nestml"]
input_path = [os.path.join(os.path.realpath(os.path.join(os.path.dirname(__file__), os.path.join(
os.pardir, os.pardir, "models", "neurons", model)))) for model in model_files]
target_path = "target_gpu_numeric"
Expand Down

0 comments on commit cf4193e

Please sign in to comment.