-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_hh.nestml
89 lines (68 loc) · 2.82 KB
/
custom_hh.nestml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
neuron custom_hh:
state:
r integer # number of steps in the current refractory phase
end
initial_values:
V_m mV = -70. mV # Membrane potential
function alpha_m_init real = (0.4 * (V_m / mV + 66.)) / (1. - exp(-(V_m / mV + 66.)/5.))
function beta_m_init real = (0.4 * (-(V_m / mV + 32.))) / (1. - exp((V_m / mV + 32.)/5.))
Act_m real = alpha_m_init / ( alpha_m_init + beta_m_init )
function h_inf_init real = 1. / (1. + exp((V_m / mV + 65.)/7.))
Act_h real = h_inf_init
function n_inf_init real = 1. / (1. + exp(-(V_m / mV + 38.)/15.))
Inact_n real = n_inf_init
end
equations:
# synapses: alpha functions
shape I_syn_in = (e/tau_syn_in) * t * exp(-t/tau_syn_in)
shape I_syn_ex = (e/tau_syn_ex) * t * exp(-t/tau_syn_ex)
function I_syn_exc pA = convolve(I_syn_ex, spikeExc)
function I_syn_inh pA = convolve(I_syn_in, spikeInh)
function I_Na pA = g_Na * Act_m * Act_m * Act_m * Act_h * ( V_m - E_Na )
function I_K pA = g_K * Inact_n * Inact_n * Inact_n * Inact_n * ( V_m - E_K )
function I_L pA = g_L * ( V_m - E_L )
V_m' =( -( I_Na + I_K + I_L ) + currents + I_e + I_syn_inh + I_syn_exc ) / C_m
function n_inf real = 1. / (1. + exp(-(V_m / mV + 38.)/15.))
function n_tau ms = 5. / (exp((V_m / mV + 50.)/40.) + exp(-(V_m / mV + 50.)/50.))
Inact_n' = (n_inf - Inact_n) / n_tau
function alpha_m real = (0.4 * (V_m / mV + 66.)) / (1. - exp(-(V_m / mV + 66.)/5.))
function beta_m real = (0.4 * (-(V_m / mV + 32.))) / (1. - exp((V_m / mV + 32.)/5.))
Act_m' = (alpha_m * (1. - Act_m) - beta_m * Act_m) / ms
function h_inf real = 1. / (1. + exp((V_m / mV + 65.)/7.))
function h_tau ms = 30. / (exp((V_m / mV + 60.)/15.) + exp(-(V_m / mV + 60.)/16.))
Act_h' = (h_inf - Act_h) / h_tau
end
parameters:
t_ref ms = 2.0ms # Refractory period
g_Na nS = 5000.0nS # Sodium peak conductance
g_L nS = 200.0nS # Leak conductance
g_K nS = 30000.0nS # Potassium peak conductance
C_m pF = 100.0pF # Membrane capacitance
E_Na mV = 50.0mV
E_K mV = -80.0mV
E_L mV = -70.0mV
tau_syn_ex ms = 0.2ms # Rise time of the excitatory synaptic alpha function i
tau_syn_in ms = 2.0ms # Rise time of the inhibitory synaptic alpha function
I_e pA = 0pA # Constant Current in pA
end
internals:
RefractoryCounts integer = steps(t_ref) # refractory time in steps
end
input:
spikeInh pA <- inhibitory spike
spikeExc pA <- excitatory spike
currents <- current
end
output: spike
update:
U_old mV = V_m
integrate_odes()
# sending spikes: crossing 0 mV, pseudo-refractoriness and local maximum...
if r > 0: # is refractory?
r -= 1
elif V_m > 0 mV and U_old > V_m: # threshold && maximum
r = RefractoryCounts
emit_spike()
end
end
end