diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8c13683..9547460 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -46,9 +46,11 @@ jobs: - jNeuroML_PyNN_NEURON - jNeuroML_validate - jNeuroML_validatev1 + - jNeuroML_XPP - Py_neuroConstruct - pyNeuroML - pyNeuroML_validate_sbml + - pyNEURON_XPP_LEMS - jNeuroML_Moose - MOOSE:3.1.5 - XPP diff --git a/.gitignore b/.gitignore index 64ffc9c..a06ac28 100644 --- a/.gitignore +++ b/.gitignore @@ -123,3 +123,8 @@ report*.txt /utilities/tests/*_eden.py arm64 /*ken.sh +/utilities/tests/LEMS_NML2_Ex9_FN.ode +/utilities/tests/LEMS_nca.xml +/utilities/tests/nca.model.xml +/utilities/tests/NML2_SingleCompHHCell.nml__flattened.xml +/utilities/tests/lems/simp2.dat diff --git a/omv/engines/__init__.py b/omv/engines/__init__.py index 4c43969..31dbc34 100644 --- a/omv/engines/__init__.py +++ b/omv/engines/__init__.py @@ -12,6 +12,7 @@ # from omv.engines.jneuromlbrian import JNeuroMLBrianEngine from omv.engines.jneuromleden import JNeuroMLEdenEngine from omv.engines.jneuromlbrian2 import JNeuroMLBrian2Engine +from omv.engines.jneuromlxpp import JNeuroMLXppEngine from omv.engines.jneuromlmoose import JNeuroMLMooseEngine from omv.engines.jneuromlvalidate import JNeuroMLValidateEngine from omv.engines.jneuromlvalidatev1 import JNeuroMLValidateV1Engine @@ -43,6 +44,7 @@ from omv.engines.pyneuroconstruct import PyneuroConstructEngine from omv.engines.pyneuroml_ import PyNeuroMLEngine from omv.engines.pyneuromlvalidatesbml import PyNeuroMLValidateSBMLEngine +from omv.engines.pyneuromlxpp import PyNeuroMLXppEngine OMVEngines = { diff --git a/omv/engines/jneuromlbrian.py b/omv/engines/jneuromlbrian.py index 69dbf34..333743b 100644 --- a/omv/engines/jneuromlbrian.py +++ b/omv/engines/jneuromlbrian.py @@ -26,7 +26,7 @@ def install(version): if not JNeuroMLEngine.is_installed(): JNeuroMLEngine.install(None) if not Brian1Engine.is_installed(): - Brian1Engine.install(None) + Brian1Engine.install(version) JNeuroMLBrianEngine.path = JNeuroMLEngine.path + ":" + Brian1Engine.path JNeuroMLBrianEngine.environment_vars = {} diff --git a/omv/engines/jneuromlnetpyne.py b/omv/engines/jneuromlnetpyne.py index 5235121..939a296 100644 --- a/omv/engines/jneuromlnetpyne.py +++ b/omv/engines/jneuromlnetpyne.py @@ -31,7 +31,7 @@ def install(version): verbosity=1, ) if not NetPyNEEngine.is_installed(): - NetPyNEEngine.install(None) + NetPyNEEngine.install(version) inform( "%s installed NetPyNE (& NEURON)..." % JNeuroMLNetPyNEEngine.name, indent=2, diff --git a/omv/engines/jneuromlpynnnrn.py b/omv/engines/jneuromlpynnnrn.py index 64e8cf0..a345d29 100644 --- a/omv/engines/jneuromlpynnnrn.py +++ b/omv/engines/jneuromlpynnnrn.py @@ -32,7 +32,7 @@ def install(version): verbosity=1, ) if not PyNNNRNEngine.is_installed(): - PyNNNRNEngine.install(None) + PyNNNRNEngine.install(version) inform( "%s installed PyNN & NRN..." % JNeuroMLPyNNNRNEngine.name, indent=2, diff --git a/omv/engines/jneuromlvalidate.py b/omv/engines/jneuromlvalidate.py index 5ef3600..984e6ec 100644 --- a/omv/engines/jneuromlvalidate.py +++ b/omv/engines/jneuromlvalidate.py @@ -16,7 +16,7 @@ def is_installed(): @staticmethod def install(version): if not JNeuroMLEngine.is_installed(): - JNeuroMLEngine.install(None) + JNeuroMLEngine.install(version) JNeuroMLValidateEngine.path = JNeuroMLEngine.path JNeuroMLValidateEngine.environment_vars = {} diff --git a/omv/engines/jneuromlvalidatev1.py b/omv/engines/jneuromlvalidatev1.py index 6d4719b..4b41e97 100644 --- a/omv/engines/jneuromlvalidatev1.py +++ b/omv/engines/jneuromlvalidatev1.py @@ -17,7 +17,7 @@ def is_installed(): @staticmethod def install(version): if not JNeuroMLEngine.is_installed(): - JNeuroMLEngine.install(None) + JNeuroMLEngine.install(version) JNeuroMLValidateV1Engine.path = JNeuroMLEngine.path JNeuroMLValidateV1Engine.environment_vars = {} diff --git a/omv/engines/jneuromlxpp.py b/omv/engines/jneuromlxpp.py new file mode 100644 index 0000000..a48cfdc --- /dev/null +++ b/omv/engines/jneuromlxpp.py @@ -0,0 +1,59 @@ +import os +import subprocess as sp + +from omv.engines.jneuroml import JNeuroMLEngine +from omv.engines.xpp import XppEngine +from omv.common.inout import inform, trim_path, check_output, is_verbose +from omv.engines.engine import EngineExecutionError + + +class JNeuroMLXppEngine(JNeuroMLEngine): + name = "jNeuroML_XPP" + + @staticmethod + def is_installed(): + if is_verbose(): + inform( + "Checking whether %s is installed..." % JNeuroMLXppEngine.name, + indent=1, + ) + return JNeuroMLEngine.is_installed() and XppEngine.is_installed() + + @staticmethod + def install(xpp_version): + if not JNeuroMLEngine.is_installed(): + JNeuroMLEngine.install(None) + if not XppEngine.is_installed(): + XppEngine.install(xpp_version) + + + def run(self): + self.environment_vars = XppEngine.get_xpp_environment() + self.set_environment() + try: + inform( + "Running file %s with %s" + % (trim_path(self.modelpath), JNeuroMLXppEngine.name), + indent=1, + ) + from omv.engines.jneuroml import JNeuroMLEngine + + jnml = JNeuroMLEngine.get_executable() + self.stdout = check_output( + [jnml, self.modelpath, "-xpp"], + cwd=os.path.dirname(self.modelpath), + env=JNeuroMLEngine.get_environment(), + ) + + self.stdout = check_output( + [self.environment_vars["XPP_HOME"] + "/xppaut", self.modelpath.replace('.xml','.ode'), '-silent'], + cwd=os.path.dirname(self.modelpath), + ) + + inform("Success with running ", JNeuroMLXppEngine.name, indent=1) + self.returncode = 0 + except sp.CalledProcessError as err: + inform("Error with ", JNeuroMLXppEngine.name, indent=1) + self.returncode = err.returncode + self.stdout = err.output + raise EngineExecutionError diff --git a/omv/engines/netpyne_.py b/omv/engines/netpyne_.py index 82b50d5..84e1e18 100644 --- a/omv/engines/netpyne_.py +++ b/omv/engines/netpyne_.py @@ -73,7 +73,7 @@ def install(version): home = os.environ["HOME"] inform("Will fetch and install the latest NetPyNE..", indent=2) - install_netpyne() + install_netpyne(version) inform("Done, NetPyNE is correctly installed...", indent=2) NetPyNEEngine.path = PyNRNEngine.path diff --git a/omv/engines/pylemsnml2.py b/omv/engines/pylemsnml2.py index 550092f..6b20732 100644 --- a/omv/engines/pylemsnml2.py +++ b/omv/engines/pylemsnml2.py @@ -28,7 +28,7 @@ def is_installed(): def install(self, version): if not PyLemsEngine.is_installed(): - PyLemsEngine.install(None) + PyLemsEngine.install(version) if not os.path.isdir(default_nml2_dir): install_nml2() diff --git a/omv/engines/pyneuromlxpp.py b/omv/engines/pyneuromlxpp.py new file mode 100644 index 0000000..5708f68 --- /dev/null +++ b/omv/engines/pyneuromlxpp.py @@ -0,0 +1,56 @@ +import os +import subprocess as sp + +from omv.common.inout import inform, trim_path, check_output +from omv.engines.engine import EngineExecutionError +from omv.engines.pyneuroml_ import PyNeuroMLEngine +from omv.engines.engine import PATH_DELIMITER +from omv.engines.utils import resolve_paths + +class PyNeuroMLXppEngine(PyNeuroMLEngine): + name = "pyNEURON_XPP_LEMS" + + @staticmethod + def is_installed(): + pynml_ver = PyNeuroMLEngine.is_installed() + if not pynml_ver: + return False + else: + return pynml_ver + + + @staticmethod + def install(version): + if not PyNeuroMLEngine.is_installed(): PyNeuroMLEngine.install(version) + + + def run(self): + try: + + #pynml = PyNeuroMLEngine.get_executable() #could implement more flexible way to find the executeable + cmds = ["pynml-xpp"] + cmds.append(self.modelpath) + cmds.append('-lems') + cmds.append('-run') + + inform( + "Running with %s, using: %s..." % (PyNeuroMLXppEngine.name, cmds), + indent=1, + ) + self.stdout = check_output( + cmds, + cwd=os.path.dirname(self.modelpath) + ) + inform( + "Success with running ", + PyNeuroMLXppEngine.name, + indent=1, + verbosity=1, + ) + self.returncode = 0 + except sp.CalledProcessError as err: + inform("Error with ", PyNeuroMLXppEngine.name, indent=1, verbosity=1) + self.returncode = err.returncode + self.stdout = err.output + raise EngineExecutionError + diff --git a/omv/engines/pynnneuroml.py b/omv/engines/pynnneuroml.py index a239a7c..fd86a38 100644 --- a/omv/engines/pynnneuroml.py +++ b/omv/engines/pynnneuroml.py @@ -22,7 +22,7 @@ def is_installed(): @staticmethod def install(version): if not PyNeuroMLEngine.is_installed(): - PyNeuroMLEngine.install(None) + PyNeuroMLEngine.install(version) inform( "%s installed PyNeuroML..." % PyNNNeuroMLEngine.name, indent=2, diff --git a/omv/engines/pynnneuron.py b/omv/engines/pynnneuron.py index eb92841..7a5e0b8 100644 --- a/omv/engines/pynnneuron.py +++ b/omv/engines/pynnneuron.py @@ -25,7 +25,7 @@ def is_installed(): @staticmethod def install(version=None): if not NeuronEngine.is_installed(): - NeuronEngine.install(None) + NeuronEngine.install(version) inform("%s installed NEURON..." % PyNNNRNEngine.name, indent=2, verbosity=1) if not PyNNEngine.is_installed(): PyNNEngine.install(None) diff --git a/utilities/test_all_osb_projects.py b/utilities/test_all_osb_projects.py index d60bb7c..883dd7a 100644 --- a/utilities/test_all_osb_projects.py +++ b/utilities/test_all_osb_projects.py @@ -40,6 +40,8 @@ "d-olfactory-bulb-network", "zetterbergjansenritmodel", "test_net", + "neuroml2", + "multiscale", ] if "-q" in sys.argv: diff --git a/utilities/tests/.test.ex9.jnmlxpp.omt b/utilities/tests/.test.ex9.jnmlxpp.omt new file mode 100644 index 0000000..10f198e --- /dev/null +++ b/utilities/tests/.test.ex9.jnmlxpp.omt @@ -0,0 +1,26 @@ +# Script for running automated tests on OSB using Travis-CI, see https://github.com/OpenSourceBrain/osb-model-validation + +target: LEMS_NML2_Ex9_FN.xml +engine: jNeuroML_XPP +mep: .test.ex9.mep +experiments: + V: + observables: + spike times: + file: + path: output.dat + columns: [0,1] + scaling: [1000, 1000] + spike detection: + method: derivative + tolerance: 0.004098360655737705 + W: + observables: + spike times: + file: + path: output.dat + columns: [0,2] + scaling: [1000, 1] + spike detection: + method: derivative + tolerance: 0.00033585982982530405 diff --git a/utilities/tests/.test.xpp.mep b/utilities/tests/.test.nca.mep similarity index 100% rename from utilities/tests/.test.xpp.mep rename to utilities/tests/.test.nca.mep diff --git a/utilities/tests/.test.nca.pynmlxpplems.omt b/utilities/tests/.test.nca.pynmlxpplems.omt new file mode 100644 index 0000000..a0a0bae --- /dev/null +++ b/utilities/tests/.test.nca.pynmlxpplems.omt @@ -0,0 +1,17 @@ +target: nca.ode +engine: pyNEURON_XPP_LEMS + +mep: .test.nca.mep +experiments: + spikes: + observables: + spike times: + file: + path: output.dat + columns: [0,14] + scaling: [1000, 1] + spike detection: + method: threshold + threshold: 0 + tolerance: 0.009999966556292568 + diff --git a/utilities/tests/.test.xpp.omt b/utilities/tests/.test.xpp.omt index 9be032c..4fbe939 100644 --- a/utilities/tests/.test.xpp.omt +++ b/utilities/tests/.test.xpp.omt @@ -1,7 +1,7 @@ target: nca.ode engine: XPP -mep: .test.xpp.mep +mep: .test.nca.mep experiments: spikes: observables: