Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduces Initial values block (cf. #368 for the discussion) #382

Merged
merged 17 commits into from
Oct 4, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
134 changes: 61 additions & 73 deletions models/aeif_cond_alpha.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -32,17 +32,17 @@ SeeAlso: iaf_cond_alpha, aeif_cond_exp
*/
neuron aeif_cond_alpha_neuron:

state:
V_m mV = E_L ## Membrane potential
w pA = 0pA ## Spike-adaptation current
initial_values:
V_m mV = E_L # Membrane potential
w pA = 0pA # Spike-adaptation current
end

equations:
function V_bounded mV = bounded_min(V_m, V_peak) # prevent exponential divergence
shape g_in = (e/tau_syn_in) * t * exp(-t/tau_syn_in)
shape g_ex = (e/tau_syn_ex) * t * exp(-t/tau_syn_ex)

## Add functions to simplify the equation definition of V_m
# Add functions to simplify the equation definition of V_m
function exp_arg real = (V_bounded-V_th)/Delta_T
function I_spike pA = g_L*Delta_T*exp(exp_arg)
function I_syn_exc pA = cond_sum(g_ex, spikesExc) * ( V_bounded - E_ex )
Expand All @@ -55,46 +55,45 @@ neuron aeif_cond_alpha_neuron:

parameters:
# membrane parameters
C_m pF = 281.0pF ## Membrane Capacitance in pF
t_ref ms = 0.0ms ## Refractory period in ms
V_reset mV = -60.0mV ## Reset Potential in mV
g_L nS = 30.0nS ## Leak Conductance in nS
E_L mV = -70.6mV ## Leak reversal Potential (aka resting potential) in mV
I_e pA = 0pA ## Constant Current in pA
C_m pF = 281.0pF # Membrane Capacitance in pF
t_ref ms = 0.0ms # Refractory period in ms
V_reset mV = -60.0mV # Reset Potential in mV
g_L nS = 30.0nS # Leak Conductance in nS
E_L mV = -70.6mV # Leak reversal Potential (aka resting potential) in mV
I_e pA = 0pA # Constant Current in pA

# spike adaptation parameters
a nS = 4nS ## Subthreshold adaptation
b pA = 80.5pA ## pike-triggered adaptation
Delta_T mV = 2.0mV ## Slope factor
tau_w ms = 144.0ms ## Adaptation time constant
V_th mV = -50.4mV ## Threshold Potential in mV
V_peak mV = 0mV ## Spike detection threshold
a nS = 4nS # Subthreshold adaptation
b pA = 80.5pA # pike-triggered adaptation
Delta_T mV = 2.0mV # Slope factor
tau_w ms = 144.0ms # Adaptation time constant
V_th mV = -50.4mV # Threshold Potential in mV
V_peak mV = 0mV # Spike detection threshold

# synaptic parameters
E_ex mV = 0mV ## Excitatory reversal Potential in mV
tau_syn_ex ms = 0.2ms ## Synaptic Time Constant Excitatory Synapse in ms
E_in mV = -85.0mV ## Inhibitory reversal Potential in mV
tau_syn_in ms = 2.0ms ## Synaptic Time Constant for Inhibitory Synapse in ms

## Input current injected by CurrentEvent.
## This variable is used to transport the current applied into the
## _dynamics function computing the derivative of the state vector.
E_ex mV = 0mV # Excitatory reversal Potential in mV
tau_syn_ex ms = 0.2ms # Synaptic Time Constant Excitatory Synapse in ms
E_in mV = -85.0mV # Inhibitory reversal Potential in mV
tau_syn_in ms = 2.0ms # Synaptic Time Constant for Inhibitory Synapse in ms

# Input current injected by CurrentEvent.
# This variable is used to transport the current applied into the
# _dynamics function computing the derivative of the state vector.
I_stim pA = 0pA
end

internals:

## Impulse to add to DG_EXC on spike arrival to evoke unit-amplitude
## conductance excursion.
# Impulse to add to DG_EXC on spike arrival to evoke unit-amplitude
# conductance excursion.
PSConInit_E nS/ms = nS * e / tau_syn_ex

## Impulse to add to DG_INH on spike arrival to evoke unit-amplitude
## conductance excursion.
# Impulse to add to DG_INH on spike arrival to evoke unit-amplitude
# conductance excursion.
PSConInit_I nS/ms = nS * e / tau_syn_in

## refractory time in steps
# refractory time in steps
RefractoryCounts integer = steps(t_ref)
## counts number of tick during the refractory period
# counts number of tick during the refractory period
r integer
end

Expand All @@ -119,7 +118,6 @@ neuron aeif_cond_alpha_neuron:
emit_spike()
end


end

end
Expand Down Expand Up @@ -159,24 +157,25 @@ SeeAlso: iaf_cond_alpha, aeif_cond_exp
neuron aeif_cond_alpha_implicit:

state:
V_m mV = E_L ## Membrane potential
w pA = 0 pA ## Spike-adaptation current
g_in nS = 0 nS ## Excitatory synaptic conductance
g_in' nS/mS = 0 nS/ms ## Excitatory synaptic conductance
g_ex nS = 0 nS ## Inhibitory synaptic conductance in nS
g_ex' nS/mS = 0 nS/ms ## Inhibitory synaptic conductance in nS
r integer ## counts number of tick during the refractory period
r integer # counts number of tick during the refractory period
end

initial_values:
V_m mV = E_L # Membrane potential
w pA = 0 pA # Spike-adaptation current
g_in nS = 0 nS # Excitatory synaptic conductance
g_in' nS/mS = nS * e / tau_syn_in # Excitatory synaptic conductance
g_ex nS = 0 nS # Inhibitory synaptic conductance in nS
g_ex' nS/mS = nS * e / tau_syn_ex # Inhibitory synaptic conductance in nS
end

equations:
function V_bounded mV = min(V_m, V_peak) # prevent exponential divergence
## alpha function for the g_in
g_in'' = (-2/tau_syn_in) * g_in'-(1/tau_syn_in**2) * g_in
g_in' = g_in'
# alpha function for the g_in
shape g_in'' = (-2/tau_syn_in) * g_in'-(1/tau_syn_in**2) * g_in

## alpha function for the g_ex
g_ex'' = (-2/tau_syn_ex) * g_ex'-(1/tau_syn_ex**2) * g_ex
g_ex' = g_ex'
# alpha function for the g_ex
shape g_ex'' = (-2/tau_syn_ex) * g_ex'-(1/tau_syn_ex**2) * g_ex

# Add aliases to simplify the equation definition of V_m
function exp_arg real = (V_bounded-V_th)/Delta_T
Expand All @@ -190,39 +189,30 @@ neuron aeif_cond_alpha_implicit:

parameters:
# membrane parameters
C_m pF = 281.0 pF ## Membrane Capacitance in pF
t_ref ms = 0.0 ms ## Refractory period in ms
V_reset mV = -60.0 mV ## Reset Potential in mV
g_L nS = 30.0 nS ## Leak Conductance in nS
E_L mV = -70.6 mV ## Leak reversal Potential (aka resting potential) in mV
I_e pA = 0 pA ## Constant Current in pA
C_m pF = 281.0 pF # Membrane Capacitance in pF
t_ref ms = 0.0 ms # Refractory period in ms
V_reset mV = -60.0 mV # Reset Potential in mV
g_L nS = 30.0 nS # Leak Conductance in nS
E_L mV = -70.6 mV # Leak reversal Potential (aka resting potential) in mV
I_e pA = 0 pA # Constant Current in pA

# spike adaptation parameters
a nS = 4 nS ## Subthreshold adaptation
b pA = 80.5 pA ## pike-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 in mV
V_peak mV = 0 mV ## Spike detection threshold
a nS = 4 nS # Subthreshold adaptation
b pA = 80.5 pA # pike-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 in mV
V_peak mV = 0 mV # Spike detection threshold

# synaptic parameters
E_ex mV = 0 mV ## Excitatory reversal Potential in mV
tau_syn_ex ms = 0.2 ms ## Synaptic Time Constant Excitatory Synapse in ms
E_in mV = -85.0 mV ## Inhibitory reversal Potential in mV
tau_syn_in ms = 2.0 ms ## Synaptic Time Constant for Inhibitory Synapse in ms
E_ex mV = 0 mV # Excitatory reversal Potential in mV
tau_syn_ex ms = 0.2 ms # Synaptic Time Constant Excitatory Synapse in ms
E_in mV = -85.0 mV # Inhibitory reversal Potential in mV
tau_syn_in ms = 2.0 ms # Synaptic Time Constant for Inhibitory Synapse in ms
end

internals:

## Impulse to add to DG_EXC on spike arrival to evoke unit-amplitude
## conductance excursion.
PSConInit_E nS/ms = nS * e / tau_syn_ex

## Impulse to add to DG_INH on spike arrival to evoke unit-amplitude
## conductance excursion.
PSConInit_I nS/ms = nS * e / tau_syn_in

## refractory time in steps
# refractory time in steps
RefractoryCounts integer = steps(t_ref)
end

Expand All @@ -247,8 +237,6 @@ neuron aeif_cond_alpha_implicit:
emit_spike()
end

g_ex' += spikesExc * PSConInit_E
g_in' += spikesInh * PSConInit_I
end

end
17 changes: 9 additions & 8 deletions models/aeif_cond_exp.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ SeeAlso: iaf_cond_alpha, aeif_cond_exp
*/
neuron aeif_cond_exp_neuron:

state:
initial_values:
V_m mV = E_L # Membrane potential
w pA = 0 pA # Spike-adaptation current
end
Expand Down Expand Up @@ -153,18 +153,21 @@ SeeAlso: iaf_cond_alpha, aeif_cond_exp
neuron aeif_cond_exp_implicit:

state:
r integer # counts number of tick during the refractory period
end

initial_values:
V_m mV = E_L # Membrane potential
w pA = 0pA # Spike-adaptation current
g_in nS = 0nS # Inhibitory synaptic conductance
g_ex nS = 0nS # Excitatory synaptic conductance
r integer # counts number of tick during the refractory period
g_in nS = 1nS # Inhibitory synaptic conductance
g_ex nS = 1nS # Excitatory synaptic conductance
end

equations:
function V_bounded mV = min(V_m, V_peak) # prevent exponential divergence
# exp function for the g_in, g_ex
g_in' = -g_in/tau_syn_in
g_ex' = -g_ex/tau_syn_ex
shape g_in' = -g_in/tau_syn_in
shape g_ex' = -g_ex/tau_syn_ex

# Add aliases to simplify the equation definition of V_m
function exp_arg real = (V_bounded-V_th)/Delta_T
Expand Down Expand Up @@ -226,8 +229,6 @@ neuron aeif_cond_exp_implicit:
emit_spike()
end

g_ex += spikeExc * nS
g_in += spikeInh * nS
end

end
46 changes: 19 additions & 27 deletions models/hh_cond_exp_traub.nestml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@ SeeAlso: hh_psc_alpha
neuron hh_cond_exp_traub_neuron:

state:
V_m mV = E_L # Membrane potential
r integer # counts number of tick during the refractory period
end

g_in nS = 0nS # Inhibitory synaptic conductance
g_ex nS = 0nS # Excitatory synaptic conductance
initial_values:
V_m mV = E_L # Membrane potential

function alpha_n_init 1/ms = 0.032/(ms* mV ) * ( 15. mV - V_m) / ( exp( ( 15. mV - V_m) / 5. mV ) - 1. )
function beta_n_init 1/ms = 0.5 /ms * exp( ( 10. mV - V_m ) / 40. mV )
Expand All @@ -49,16 +50,18 @@ neuron hh_cond_exp_traub_neuron:
Act_m real = alpha_m_init / ( alpha_m_init + beta_m_init )
Act_h real = alpha_h_init / ( alpha_h_init + beta_h_init )
Inact_n real = alpha_n_init / ( alpha_n_init + beta_n_init )

r integer # counts number of tick during the refractory period

end

equations:
# synapses: exponential conductance
shape g_in = exp(-1/tau_syn_in*t)
shape g_ex = exp(-1/tau_syn_ex*t)

# Add aliases to simplify the equation definition of V_m
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 )

function I_syn_exc pA = cond_sum(g_ex, spikeExc) * ( V_m - E_ex )
function I_syn_inh pA = cond_sum(g_in, spikeInh) * ( V_m - E_in )

Expand All @@ -77,9 +80,6 @@ neuron hh_cond_exp_traub_neuron:
Act_h' = ( alpha_h - ( alpha_h + beta_h ) * Act_h )
Inact_n' = ( alpha_n - ( alpha_n + beta_n ) * Inact_n )

# synapses: exponential conductance
g_ex' = -g_ex / tau_syn_ex
g_in' = -g_in / tau_syn_in
end

parameters:
Expand Down Expand Up @@ -123,10 +123,6 @@ neuron hh_cond_exp_traub_neuron:
emit_spike()
end



g_ex += spikeExc * nS
g_in += spikeInh * nS
end

end
Expand Down Expand Up @@ -167,10 +163,14 @@ SeeAlso: hh_psc_alpha
neuron hh_cond_exp_traub_implicit:

state:
r integer # counts number of tick during the refractory period
end

initial_values:
V_m mV = E_L # Membrane potential

g_in nS = 0nS # Inhibitory synaptic conductance
g_ex nS = 0nS # Excitatory synaptic conductance
g_in nS = 1nS # Inhibitory synaptic conductance
g_ex nS = 1nS # Excitatory synaptic conductance

function alpha_n_init 1/ms = 0.032/(ms* mV ) * ( 15. mV - V_m) / ( exp( ( 15. mV - V_m) / 5. mV ) - 1. )
function beta_n_init 1/ms = 0.5 /ms * exp( ( 10. mV - V_m ) / 40. mV )
Expand All @@ -182,12 +182,13 @@ neuron hh_cond_exp_traub_implicit:
Act_m real = alpha_m_init / ( alpha_m_init + beta_m_init )
Act_h real = alpha_h_init / ( alpha_h_init + beta_h_init )
Inact_n real = alpha_n_init / ( alpha_n_init + beta_n_init )

r integer # counts number of tick during the refractory period

end

equations:
# synapses: exponential conductance
shape g_ex' = -g_ex / tau_syn_ex
shape g_in' = -g_in / tau_syn_in

# Add aliases to simplify the equation definition of V_m
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 )
Expand All @@ -209,10 +210,6 @@ neuron hh_cond_exp_traub_implicit:
Act_m' = ( alpha_m - ( alpha_m + beta_m ) * Act_m )
Act_h' = ( alpha_h - ( alpha_h + beta_h ) * Act_h )
Inact_n' = ( alpha_n - ( alpha_n + beta_n ) * Inact_n )

# synapses: exponential conductance
g_ex' = -g_ex / tau_syn_ex
g_in' = -g_in / tau_syn_in
end

parameters:
Expand Down Expand Up @@ -255,11 +252,6 @@ neuron hh_cond_exp_traub_implicit:
r = RefractoryCounts
emit_spike()
end



g_ex += spikeExc * nS
g_in += spikeInh * nS
end

end