-
Notifications
You must be signed in to change notification settings - Fork 53
Add a Transformer to support multiple backends with different preferred prefixes a.k.a Non-dimensionalisation-transformer #1234
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
Draft
mwhy
wants to merge
49
commits into
nest:master
Choose a base branch
from
mwhy:non-dim-trafo
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from all commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
4bde5db
initial commit
mwhy a6d3918
Update .gitignore
mwhy 91b085a
Merge branch 'master' of https://github.com/nest/nestml
mwhy 2e4679c
add model transformer for non-dimensionalisation
7d56517
add model transformer for non-dimensionalisation
df6119d
Update necessary SpiNNaker2 code generation templates
mwhy 2f58435
Add setter for ASTVariables and ASTDataType
mwhy 69e0c85
Add a more robust dynamic import function for generated python package
mwhy 8551db8
Add generation of parameter - value dict needed for initialisation of…
mwhy 1a4bcac
Uncomment synapse section even if not used at the moment
mwhy 770748d
Add SpiNNaker2 to use AddTimestepToInternalsTransformer
mwhy ed1a6e5
Add SpiNNaker2CodeGeneratorUtils analogous to SpiNNaker1 implementation
mwhy 6ff5d6c
Update spinnaker2_code_generator.py to use namespaces
mwhy 7a0a043
Add filepath to ASTModel as it's needed for use of python_standalone_…
mwhy 06dd673
Remove np.int from list of datatypes during cloning of numeric litera…
mwhy cbcf018
Add generation of updated state dict - dict with initial values for n…
mwhy 54d460a
Update SpiNNaker2 builder
mwhy ab5304a
Add iaf_psc_exp neuron model without additional external I_stim curre…
mwhy 0e9e9c6
Add c function call and variable printers for SpiNNaker2
mwhy 2f4769f
Add code generation resources for C and Python
mwhy 83ed260
Add SpiNNaker2TargetTools
mwhy 9bad001
Add test for iaf_psc_exp_neuron_NO_ISTIM to NEST tests
mwhy 976c1db
WIP: development of non-dimensionalisation transformer
mwhy f91fda6
add factors to the AST (proof-of-concept)
7d894ad
WIP: add tests for Non- Dimensionalisation- Transformer and package i…
mwhy 4aeddbb
WIP: split up .NESTML test files for Non- Dimensionalisation- Transfo…
mwhy f06a2c4
WIP: split up PyTest test files for Non- Dimensionalisation- Transfor…
mwhy 91da378
WIP: add a numpy refernce implementation for non dimensinalisation tr…
mwhy ff34c41
WIP: non dimensinalisation transformer add isinstance() checks
mwhy cabe11c
Move weight_scaling_factor and simulation_timestep_in_s to neuron par…
mwhy 8ad064e
WIP: Update tests and Unit Transformer
mwhy 7503eac
update tests for non dimensionalisation transformer
mwhy 225d9eb
WIP: split transformer into multiple parts to prevent errors during m…
mwhy 119f3f8
Comment out unused transformer import
mwhy 9ab2422
Set correct memory addresses for code generation
mwhy f3e651a
Refactoring, put functions in ast_utils and ast_model instead of NEST…
mwhy d1504d1
merge upstream master
mwhy 04aa8f8
Merge remote-tracking branch 'origin/master' into non-dim-trafo
mwhy 145bec2
update transformer, split into multiple visitors implementing differe…
mwhy f5d4162
code cleanup
mwhy 888c464
Update non-dim-transformer and test-cases
mwhy 0896801
update non-dim-trafo and tests
mwhy 308dc5c
update non-dim-trafo and tests
mwhy 6865ad0
update transformer to correctly distinguish between variables and uni…
mwhy 283857f
make changing of data type in input port more explicit
mwhy 2d819f4
add Izhikevich neuron numerical integrtation test to non-dim-transformer
mwhy ad2fb61
comment out functionality in attempt_magnitude_cast() - function shou…
mwhy 96cd7e8
make nest_code_generator consistent with main branch
mwhy a8c6f08
update gitignore
mwhy File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
---|---|---|
|
@@ -7,14 +7,20 @@ target/ | |
build/ | ||
buildNest/ | ||
venv/ | ||
spinnaker-install/ | ||
tests/spinnaker_tests/bak/spinnaker-install/ | ||
spinnaker-target/ | ||
report/ | ||
reports/ | ||
nestml-*/ | ||
*.egg-info | ||
stash/ | ||
|
||
tests/spinnaker2_tests/spinnaker2-install | ||
tests/spinnaker2_tests/spinnaker2-target | ||
tests/spinnaker_tests/report | ||
tests/spinnaker_tests/spinnaker-install | ||
tests/spinnaker_tests/spinnaker-target | ||
tests/nest_tests/target_*/ | ||
tests/spinnaker2_tests/nestml_*/ | ||
|
||
__* | ||
|
||
|
@@ -35,3 +41,27 @@ venv | |
*.gdf | ||
*~ | ||
*.iml | ||
tests/nest_tests/non_dimensionalisation_transformer/resources/non_dimensionalisation_transformer_test_neuron.nestml.bak | ||
tests/nest_tests/non_dimensionalisation_transformer/tests/reference_test_non_dim_transformer_function_call_in_equation_block.png | ||
tests/nest_tests/non_dimensionalisation_transformer/tests/transformed_model_test_exp_in_equation_block.txt | ||
tests/nest_tests/non_dimensionalisation_transformer/tests/transformed_model.txt | ||
pynestml/codegeneration/resources_spinnaker2/bak/@[email protected] | ||
pynestml/codegeneration/resources_spinnaker2/bak/@[email protected] | ||
pynestml/codegeneration/resources_spinnaker2/bak/decay.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/global_params.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/maths-util.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron_model_@NEURON_NAME@_impl.c.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron_model_@NEURON_NAME@_impl.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron_model.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron-typedefs.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron.c.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/neuron.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/param_defs.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/population_table.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/regions.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/simulation.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/synapse_row.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/synapse_types_exponential_impl.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/synapse_types.h.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/synapses.c.jinja2 | ||
pynestml/codegeneration/resources_spinnaker2/bak/synapses.h.jinja2 |
This file contains hidden or 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,130 @@ | ||
# iaf_psc_exp_NO_ISTIM - Leaky integrate-and-fire neuron model | ||
# ################################################### | ||
# | ||
# Description | ||
# +++++++++++ | ||
# | ||
# iaf_psc_exp is an implementation of a leaky integrate-and-fire model | ||
# with exponentially decaying synaptic currents according to [1]_. | ||
# Thus, postsynaptic currents have an infinitely short rise time. | ||
# The input current I_stim is removed for code generation testing purposes. | ||
# | ||
# The threshold crossing is followed by an absolute refractory period | ||
# during which the membrane potential is clamped to the resting potential | ||
# and spiking is prohibited. | ||
# | ||
# The general framework for the consistent formulation of systems with | ||
# neuron like dynamics interacting by point events is described in | ||
# [1]_. A flow chart can be found in [2]_. | ||
# | ||
# Critical tests for the formulation of the neuron model are the | ||
# comparisons of simulation results for different computation step | ||
# sizes. | ||
# | ||
# .. note:: | ||
# | ||
# If tau_m is very close to tau_syn_exc or tau_syn_inh, numerical problems | ||
# may arise due to singularities in the propagator matrics. If this is | ||
# the case, replace equal-valued parameters by a single parameter. | ||
# | ||
# For details, please see ``IAF_neurons_singularity.ipynb`` in | ||
# the NEST source code (``docs/model_details``). | ||
# | ||
# | ||
# References | ||
# ++++++++++ | ||
# | ||
# .. [1] Rotter S, Diesmann M (1999). Exact simulation of | ||
# time-invariant linear systems with applications to neuronal | ||
# modeling. Biologial Cybernetics 81:381-402. | ||
# DOI: https://doi.org/10.1007/s004220050570 | ||
# .. [2] Diesmann M, Gewaltig M-O, Rotter S, & Aertsen A (2001). State | ||
# space analysis of synchronous spiking in cortical neural | ||
# networks. Neurocomputing 38-40:565-571. | ||
# DOI: https://doi.org/10.1016/S0925-2312(01)00409-X | ||
# .. [3] Morrison A, Straube S, Plesser H E, Diesmann M (2006). Exact | ||
# subthreshold integration with continuous spike times in discrete time | ||
# neural network simulations. Neural Computation, in press | ||
# DOI: https://doi.org/10.1162/neco.2007.19.1.47 | ||
# | ||
# | ||
# See also | ||
# ++++++++ | ||
# | ||
# iaf_psc_delta, iaf_psc_alpha, iaf_cond_exp | ||
# | ||
# | ||
# Copyright statement | ||
# +++++++++++++++++++ | ||
# | ||
# This file is part of NEST. | ||
# | ||
# Copyright (C) 2004 The NEST Initiative | ||
# | ||
# NEST is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 2 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# NEST is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with NEST. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# | ||
model iaf_psc_exp_neuron_NO_ISTIM: | ||
|
||
state: | ||
V_m mV = E_L # Membrane potential | ||
refr_t ms = 0 ms # Refractory period timer | ||
I_syn_exc pA = 0 pA | ||
I_syn_inh pA = 0 pA | ||
|
||
equations: | ||
I_syn_exc' = -I_syn_exc / tau_syn_exc | ||
I_syn_inh' = -I_syn_inh / tau_syn_inh | ||
V_m' = -(V_m - E_L) / tau_m + (I_syn_exc - I_syn_inh + I_e) / C_m | ||
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: | ||
C_m pF = 250 pF # Capacitance of the membrane | ||
tau_m ms = 10 ms # Membrane time constant | ||
tau_syn_inh ms = 2 ms # Time constant of inhibitory synaptic current | ||
tau_syn_exc ms = 2 ms # Time constant of excitatory synaptic current | ||
refr_T ms = 2 ms # Duration of refractory period | ||
E_L mV = -70 mV # Resting potential | ||
V_reset mV = -70 mV # Reset value of the membrane potential | ||
V_th mV = -55 mV # Spike threshold potential | ||
|
||
# constant external input current | ||
I_e pA = 0 pA | ||
|
||
input: | ||
exc_spikes <- excitatory spike | ||
inh_spikes <- inhibitory spike | ||
|
||
output: | ||
spike | ||
|
||
update: | ||
if refr_t > 0 ms: | ||
# neuron is absolute refractory, do not evolve V_m | ||
integrate_odes(I_syn_exc, I_syn_inh, refr_t) | ||
else: | ||
# neuron not refractory | ||
integrate_odes(I_syn_exc, I_syn_inh, V_m) | ||
|
||
onReceive(exc_spikes): | ||
I_syn_exc += exc_spikes * pA * s | ||
|
||
onReceive(inh_spikes): | ||
I_syn_inh += inh_spikes * pA * 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 | ||
emit_spike() |
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
This file contains hidden or 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
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you remove this file from the PR and also all of the SpiNNaker-2 related files from this PR? Cheers!