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

Remove end keyword from NESTML models #866

Merged
merged 40 commits into from
Apr 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
1430667
Add lexer and parser for removing end keyword
pnbabu Feb 10, 2023
3bda3aa
Remove end keyword for neuron models
pnbabu Feb 15, 2023
1c44151
Remove end keyword for synapse models
pnbabu Feb 16, 2023
1e2831b
Remove end keyword in test model files
pnbabu Feb 16, 2023
4b0c500
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Feb 22, 2023
b926c3a
Add a small python script to replace the relative import in
pnbabu Feb 23, 2023
8e4daf9
Add PyNestMLLexerBase to __init__.py
pnbabu Feb 23, 2023
bac7e31
Github actions debugging
pnbabu Feb 23, 2023
e1d5ecd
Github actions debugging
pnbabu Feb 23, 2023
1d2c548
Github actions debugging
pnbabu Feb 24, 2023
d413517
Undo the delete of generated grammar files
pnbabu Mar 1, 2023
cea4e71
Fix comments parsing
pnbabu Mar 6, 2023
14125e2
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 6, 2023
741b96a
Remove post comments
pnbabu Mar 6, 2023
899a51c
Fix pycodestyle error
pnbabu Mar 6, 2023
8a7a70c
Remove post comments from models
pnbabu Mar 7, 2023
82698cd
Update docs
pnbabu Mar 7, 2023
a1a0d5b
Merge remote-tracking branch 'origin/remove_post_comments' into remov…
pnbabu Mar 7, 2023
54884e5
Fix comments parsing and ternary operators
pnbabu Mar 7, 2023
6f121d3
Fix unit tests
pnbabu Mar 7, 2023
300c36d
Update jupyter notebooks
pnbabu Mar 7, 2023
3734188
Fix multisynapse models
pnbabu Mar 8, 2023
3127314
Fix autodoc code generation
pnbabu Mar 7, 2023
bbb7f3f
Update docs
pnbabu Mar 7, 2023
4e45f4b
Remove end keyword from the doctrings
pnbabu Mar 9, 2023
80debe0
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 13, 2023
f7b0871
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 14, 2023
fef8a00
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 16, 2023
4a1e7a0
Fix comments parsing
pnbabu Mar 17, 2023
cd4d4d5
Update docs
pnbabu Mar 17, 2023
0a0c9f1
Address review comments
pnbabu Mar 17, 2023
ffd5797
Apply suggestions from code review
pnbabu Mar 20, 2023
6a7b67c
Update docs
pnbabu Mar 20, 2023
6464206
Fix test
pnbabu Mar 22, 2023
50d77ea
Revert index.rst to the upstream version
pnbabu Mar 22, 2023
28a1fc4
Fix comments parsing and update docs
pnbabu Mar 22, 2023
d100cf5
Fix unit test
pnbabu Mar 22, 2023
753f3a2
Update synapse .rst files
pnbabu Mar 23, 2023
d1bb5f4
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 28, 2023
6b45f1b
Merge remote-tracking branch 'upstream/master' into remove_end
pnbabu Mar 29, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .github/workflows/nestml-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,6 @@ jobs:

- name: Generate Lexer and Parser using Antlr4
run: |
find pynestml/generated -not -name __init__.py -a -not -name generated -delete
cd pynestml/grammars
./generate_lexer_parser

Expand Down
95 changes: 2 additions & 93 deletions doc/models_library/aeif_cond_alpha.rst
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,6 @@ iaf_cond_alpha, aeif_cond_exp

Parameters
++++++++++



.. csv-table::
:header: "Name", "Physical unit", "Default value", "Description"
:widths: auto
Expand All @@ -72,7 +69,6 @@ Parameters




State variables
+++++++++++++++

Expand All @@ -92,105 +88,18 @@ Equations




.. math::
\frac{ dV_{m} } { dt }= \frac 1 { C_{m} } \left( { (-g_{L} \cdot (V_{bounded} - E_{L}) + I_{spike} - I_{syn,exc} - I_{syn,inh} - w + I_{e} + I_{stim}) } \right)


.. math::
\frac{ dw } { dt }= \frac 1 { \tau_{w} } \left( { (a \cdot (V_{bounded} - E_{L}) - w) } \right)





Source code
+++++++++++

.. code-block:: nestml

neuron aeif_cond_alpha:
state:
V_m mV = E_L # Membrane potential
w pA = 0pA # Spike-adaptation current
end
equations:
inline V_bounded mV = min(V_m,V_peak) # prevent exponential divergence
kernel g_inh = (e / tau_syn_inh) * t * exp(-t / tau_syn_inh)
kernel g_exc = (e / tau_syn_exc) * t * exp(-t / tau_syn_exc)
# 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 = convolve(g_exc,exc_spikes) * (V_bounded - E_exc)
inline I_syn_inh pA = convolve(g_inh,inh_spikes) * (V_bounded - E_inh)
V_m'=(-g_L * (V_bounded - E_L) + I_spike - I_syn_exc - I_syn_inh - w + I_e + I_stim) / C_m
w'=(a * (V_bounded - E_L) - w) / tau_w
end

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

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

# synaptic parameters
E_exc mV = 0mV # Excitatory reversal Potential
tau_syn_exc ms = 0.2ms # Synaptic Time Constant Excitatory Synapse
E_inh mV = -85.0mV # Inhibitory reversal Potential
tau_syn_inh ms = 2.0ms # Synaptic Time Constant for Inhibitory Synapse
# constant external input current

# constant external input current
I_e pA = 0pA
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_exc
# Impulse to add to DG_INH on spike arrival to evoke unit-amplitude conductance excursion
PSConInit_I nS/ms = nS * e / tau_syn_inh
# 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
input:
inh_spikes nS <-inhibitory spike
exc_spikes nS <-excitatory spike
I_stim pA <-current
end

output: spike

update:
integrate_odes()
if r > 0: # refractory
r -= 1 # decrement refractory ticks count
V_m = V_reset # clamp potential
elif V_m >= V_peak:
r = RefractoryCounts
V_m = V_reset # clamp potential
w += b
emit_spike()
end
end

end


The model source code can be found in the NESTML models repository here: `aeif_cond_alpha <https://github.com/nest/nestml/tree/master/models/neurons/aeif_cond_alpha.nestml>`_.

Characterisation
++++++++++++++++
Expand All @@ -200,4 +109,4 @@ Characterisation

.. footer::

Generated at 2022-03-28 19:04:29.432312
Generated at 2023-03-22 17:48:48.943078
91 changes: 2 additions & 89 deletions doc/models_library/aeif_cond_exp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -46,9 +46,6 @@ iaf_cond_exp, aeif_cond_alpha

Parameters
++++++++++



.. csv-table::
:header: "Name", "Physical unit", "Default value", "Description"
:widths: auto
Expand All @@ -73,7 +70,6 @@ Parameters




State variables
+++++++++++++++

Expand All @@ -93,101 +89,18 @@ Equations




.. math::
\frac{ dV_{m} } { dt }= \frac 1 { C_{m} } \left( { (-g_{L} \cdot (V_{bounded} - E_{L}) + I_{spike} - I_{syn,exc} - I_{syn,inh} - w + I_{e} + I_{stim}) } \right)


.. math::
\frac{ dw } { dt }= \frac 1 { \tau_{w} } \left( { (a \cdot (V_{bounded} - E_{L}) - w) } \right)





Source code
+++++++++++

.. code-block:: nestml

neuron aeif_cond_exp:
state:
V_m mV = E_L # Membrane potential
w pA = 0pA # Spike-adaptation current
end
equations:
inline V_bounded mV = min(V_m,V_peak) # prevent exponential divergence
kernel g_inh = exp(-t / tau_syn_inh)
kernel g_exc = exp(-t / tau_syn_exc)
# 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 = convolve(g_exc,exc_spikes) * (V_bounded - E_exc)
inline I_syn_inh pA = convolve(g_inh,inh_spikes) * (V_bounded - E_inh)
V_m'=(-g_L * (V_bounded - E_L) + I_spike - I_syn_exc - I_syn_inh - w + I_e + I_stim) / C_m
w'=(a * (V_bounded - E_L) - w) / tau_w
end

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

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

# synaptic parameters
E_exc mV = 0mV # Excitatory reversal Potential
tau_syn_exc ms = 0.2ms # Synaptic Time Constant Excitatory Synapse
E_inh mV = -85.0mV # Inhibitory reversal Potential
tau_syn_inh ms = 2.0ms # Synaptic Time Constant for Inhibitory Synapse
# constant external input current

# constant external input current
I_e pA = 0pA
end
internals:
# 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
input:
inh_spikes nS <-inhibitory spike
exc_spikes nS <-excitatory spike
I_stim pA <-current
end

output: spike

update:
integrate_odes()
if r > 0: # refractory
r -= 1 # decrement refractory ticks count
V_m = V_reset # clamp potential
elif V_m >= V_peak:
r = RefractoryCounts + 1
V_m = V_reset # clamp potential
w += b
emit_spike()
end
end

end


The model source code can be found in the NESTML models repository here: `aeif_cond_exp <https://github.com/nest/nestml/tree/master/models/neurons/aeif_cond_exp.nestml>`_.

Characterisation
++++++++++++++++
Expand All @@ -197,4 +110,4 @@ Characterisation

.. footer::

Generated at 2022-03-28 19:04:29.501988
Generated at 2023-03-22 17:48:48.899673
Loading