-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from OpenSourceBrain/test_xpp
XPP updates: Add JNeuroMLXppEngine and pyNEURON_XPP_LEMS
- Loading branch information
Showing
18 changed files
with
177 additions
and
10 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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,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 |
This file contains 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 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 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,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 | ||
|
This file contains 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 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 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,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 |
File renamed without changes.
This file contains 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,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 | ||
|
This file contains 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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
target: nca.ode | ||
engine: XPP | ||
|
||
mep: .test.xpp.mep | ||
mep: .test.nca.mep | ||
experiments: | ||
spikes: | ||
observables: | ||
|