diff --git a/pynestml/codegeneration/nest_code_generator.py b/pynestml/codegeneration/nest_code_generator.py
index 1e5888a47..b7da7067b 100644
--- a/pynestml/codegeneration/nest_code_generator.py
+++ b/pynestml/codegeneration/nest_code_generator.py
@@ -301,10 +301,13 @@ def _get_module_namespace(self, neurons: List[ASTModel], synapses: List[ASTModel
namespace = {"neurons": neurons,
"synapses": synapses,
"moduleName": FrontendConfiguration.get_module_name(),
+ "nestml_version": pynestml.__version__,
"now": datetime.datetime.utcnow()}
+
# NEST version
if self.option_exists("nest_version"):
namespace["nest_version"] = self.get_option("nest_version")
+
return namespace
def analyse_transform_neurons(self, neurons: List[ASTModel]) -> None:
@@ -469,9 +472,9 @@ def analyse_synapse(self, synapse: ASTModel) -> Dict[str, ASTAssignment]:
return spike_updates
def _get_model_namespace(self, astnode: ASTModel) -> Dict:
-
namespace = {}
+ namespace["nestml_version"] = pynestml.__version__
namespace["now"] = datetime.datetime.utcnow()
namespace["tracing"] = FrontendConfiguration.is_dev
diff --git a/pynestml/codegeneration/nest_compartmental_code_generator.py b/pynestml/codegeneration/nest_compartmental_code_generator.py
index 00f061775..fd75c4d6c 100644
--- a/pynestml/codegeneration/nest_compartmental_code_generator.py
+++ b/pynestml/codegeneration/nest_compartmental_code_generator.py
@@ -240,6 +240,7 @@ def _get_module_namespace(self, neurons: List[ASTModel]) -> Dict:
namespace = {"neurons": neurons,
"nest_version": self.get_option("nest_version"),
"moduleName": FrontendConfiguration.get_module_name(),
+ "nestml_version": pynestml.__version__,
"now": datetime.datetime.utcnow()}
# auto-detect NEST Simulator installed version
@@ -577,6 +578,7 @@ def _get_neuron_model_namespace(self, neuron: ASTModel) -> Dict:
namespace = {}
+ namespace["nestml_version"] = pynestml.__version__
namespace["now"] = datetime.datetime.utcnow()
namespace["tracing"] = FrontendConfiguration.is_dev
diff --git a/pynestml/codegeneration/nest_desktop_code_generator.py b/pynestml/codegeneration/nest_desktop_code_generator.py
index dddf431b4..bc47db218 100644
--- a/pynestml/codegeneration/nest_desktop_code_generator.py
+++ b/pynestml/codegeneration/nest_desktop_code_generator.py
@@ -21,6 +21,7 @@
from typing import Sequence, Optional, Mapping, Any, Dict
+import pynestml
from pynestml.codegeneration.code_generator import CodeGenerator
from pynestml.codegeneration.code_generator_utils import CodeGeneratorUtils
from pynestml.meta_model.ast_model import ASTModel
@@ -64,6 +65,7 @@ def _get_neuron_model_namespace(self, neuron: ASTModel) -> Dict:
from pynestml.codegeneration.nest_tools import NESTTools
namespace = dict()
+ namespace["nestml_version"] = pynestml.__version__
namespace["neuronName"] = neuron.get_name()
namespace["neuron"] = neuron
namespace["parameters"] = NESTTools.get_neuron_parameters(neuron.get_name())
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronClass.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronClass.jinja2
index 8cc3dd0dc..cbcc55d5b 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronClass.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronClass.jinja2
@@ -45,7 +45,7 @@ along with NEST. If not, see .
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
- * Generated from NESTML at time: {{now}}
+ * Generated from NESTML {{ nestml_version }} at time: {{ now }}
**/
// C++ includes:
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronHeader.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronHeader.jinja2
index 457b84381..ea479f7d9 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronHeader.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/common/NeuronHeader.jinja2
@@ -45,7 +45,7 @@ along with NEST. If not, see .
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
- * Generated from NESTML at time: {{now}}
+ * Generated from NESTML {{ nestml_version }} at time: {{ now }}
**/
#ifndef {{neuronName.upper()}}
#define {{neuronName.upper()}}
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/common/SynapseHeader.h.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/common/SynapseHeader.h.jinja2
index cdd30c610..cb328bbdc 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/common/SynapseHeader.h.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/common/SynapseHeader.h.jinja2
@@ -40,7 +40,7 @@ along with NEST. If not, see .
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
- * Generated from NESTML at time: {{now}}
+ * Generated from NESTML {{ nestml_version }} at time: {{ now }}
**/
#ifndef {{synapseName.upper()}}_H
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClass.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClass.jinja2
index 3a0655b99..3f6646d42 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClass.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClass.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
-* {{now}}
+* Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
// Includes from nestkernel:
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClassMaster.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClassMaster.jinja2
index 6fc833d58..fe2d49582 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClassMaster.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleClassMaster.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
-* {{now}}
+* Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
// Include from NEST
diff --git a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleHeader.jinja2 b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleHeader.jinja2
index 68d42939a..ce1e560e5 100644
--- a/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleHeader.jinja2
+++ b/pynestml/codegeneration/resources_nest/point_neuron/setup/common/ModuleHeader.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
- * {{now}}
+ * Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
#ifndef {{upperModuleName}}_H
diff --git a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClass.jinja2 b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClass.jinja2
index 8e78a130d..a79d0179d 100644
--- a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClass.jinja2
+++ b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClass.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
-* {{now}}
+* Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
// Includes from nestkernel:
diff --git a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClassMaster.jinja2 b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClassMaster.jinja2
index a5053d159..51c823e81 100644
--- a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClassMaster.jinja2
+++ b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleClassMaster.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
-* {{now}}
+* Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
// Include from NEST
diff --git a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleHeader.jinja2 b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleHeader.jinja2
index 68d42939a..ce1e560e5 100644
--- a/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleHeader.jinja2
+++ b/pynestml/codegeneration/resources_nest_compartmental/cm_neuron/setup/common/ModuleHeader.jinja2
@@ -40,7 +40,7 @@
* You should have received a copy of the GNU General Public License
* along with NEST. If not, see .
*
- * {{now}}
+ * Generated from NESTML {{ nestml_version }} at time: {{ now }}
*/
#ifndef {{upperModuleName}}_H
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/@NEURON_NAME@.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/@NEURON_NAME@.py.jinja2
index 33574910a..fa9e06118 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/@NEURON_NAME@.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/@NEURON_NAME@.py.jinja2
@@ -39,7 +39,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
{% if tracing %}# generated by {{self._TemplateReference__context.name}}
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/@SYNAPSE_NAME@.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/@SYNAPSE_NAME@.py.jinja2
index fee9771d0..99890c0ab 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/@SYNAPSE_NAME@.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/@SYNAPSE_NAME@.py.jinja2
@@ -39,7 +39,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
{% if tracing %}# generated by {{self._TemplateReference__context.name}}
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/neuron.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/neuron.py.jinja2
index dd41d9ce2..f0e3e8f3b 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/neuron.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/neuron.py.jinja2
@@ -18,7 +18,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
from typing import List
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/simulator.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/simulator.py.jinja2
index e8b1cab52..85bf27e8b 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/simulator.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/simulator.py.jinja2
@@ -39,7 +39,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
from typing import List, Mapping, Optional, Union
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/spike_generator.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/spike_generator.py.jinja2
index f394cccc9..7677be94f 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/spike_generator.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/spike_generator.py.jinja2
@@ -18,7 +18,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
from .neuron import Neuron
diff --git a/pynestml/codegeneration/resources_python_standalone/point_neuron/synapse.py.jinja2 b/pynestml/codegeneration/resources_python_standalone/point_neuron/synapse.py.jinja2
index 9d3cca8e5..404ead318 100644
--- a/pynestml/codegeneration/resources_python_standalone/point_neuron/synapse.py.jinja2
+++ b/pynestml/codegeneration/resources_python_standalone/point_neuron/synapse.py.jinja2
@@ -18,7 +18,7 @@ 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 .
-Generated from NESTML at time: {{now}}
+Generated from NESTML {{ nestml_version }} at time: {{ now }}
"""
from typing import List
diff --git a/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@.py.jinja2 b/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@.py.jinja2
index b4ddf41ca..ee843dcb1 100644
--- a/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@.py.jinja2
+++ b/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@.py.jinja2
@@ -18,7 +18,8 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see .
#
-# Generated from NESTML at time: {{now}}
+# Generated from NESTML {{ nestml_version }} at time: {{ now }}
+
from numpy import exp, ceil
from spynnaker.pyNN.models.neuron import AbstractPyNNNeuronModel
@@ -54,7 +55,7 @@ class {{neuronName}}(AbstractPyNNNeuronModel):
{%- for variable_symbol in neuron.get_spike_input_ports() %}
{%- if variable_symbol.get_initial_value() == None %}
-{{variable_symbol.get_symbol_name()}} = 0.0,
+{{variable_symbol.get_symbol_name()}} = 0.0,
{%- else %}
{{variable_symbol.get_symbol_name()}} = {{variable_symbol.get_initial_value()}} ,
{%- endif %}
@@ -62,7 +63,7 @@ class {{neuronName}}(AbstractPyNNNeuronModel):
{%- for variable_symbol in neuron.get_continuous_input_ports() %}
{%- if variable_symbol.get_initial_value() == None %}
-{{variable_symbol.get_symbol_name()}} = 0.0,
+{{variable_symbol.get_symbol_name()}} = 0.0,
{%- else %}
{{variable_symbol.get_symbol_name()}} = {{variable_symbol.get_initial_value()}} ,
{%- endif %}
diff --git a/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@_impl.py.jinja2 b/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@_impl.py.jinja2
index b3c0b150b..63b4310a4 100644
--- a/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@_impl.py.jinja2
+++ b/pynestml/codegeneration/resources_spinnaker/@NEURON_NAME@_impl.py.jinja2
@@ -18,7 +18,7 @@
# You should have received a copy of the GNU General Public License
# along with NEST. If not, see .
#
-# Generated from NESTML at time: {{now}}
+# Generated from NESTML {{ nestml_version }} at time: {{ now }}
from spinn_front_end_common.interface.ds import DataType
from spinn_front_end_common.utilities.constants import BYTES_PER_WORD
@@ -147,7 +147,7 @@ class {{neuronName}}Impl(AbstractNeuronImpl):
return [
{%- for sym in neuron.get_state_symbols() | sort(attribute="name")%}
"{{sym.get_symbol_name()}}",
-{%- endfor %}
+{%- endfor %}
]
@overrides(AbstractNeuronImpl.get_recordable_data_types)