OSBModelValidation 0.2.18__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (98) hide show
  1. OSBModelValidation-0.2.18.dist-info/METADATA +184 -0
  2. OSBModelValidation-0.2.18.dist-info/RECORD +98 -0
  3. OSBModelValidation-0.2.18.dist-info/WHEEL +5 -0
  4. OSBModelValidation-0.2.18.dist-info/entry_points.txt +2 -0
  5. OSBModelValidation-0.2.18.dist-info/top_level.txt +1 -0
  6. omv/__init__.py +8 -0
  7. omv/analyzers/__init__.py +21 -0
  8. omv/analyzers/activation.py +24 -0
  9. omv/analyzers/analyzer.py +80 -0
  10. omv/analyzers/dryrun.py +13 -0
  11. omv/analyzers/input_resistance.py +47 -0
  12. omv/analyzers/morphology.py +16 -0
  13. omv/analyzers/rates.py +97 -0
  14. omv/analyzers/resting.py +37 -0
  15. omv/analyzers/spikes.py +113 -0
  16. omv/analyzers/temperature.py +12 -0
  17. omv/analyzers/timeseries.py +57 -0
  18. omv/analyzers/utils/__init__.py +0 -0
  19. omv/analyzers/utils/filenode.py +73 -0
  20. omv/analyzers/utils/timeseries.py +293 -0
  21. omv/autogen.py +106 -0
  22. omv/common/__init__.py +0 -0
  23. omv/common/inout.py +154 -0
  24. omv/engines/__init__.py +53 -0
  25. omv/engines/arbor_.py +57 -0
  26. omv/engines/brian1.py +59 -0
  27. omv/engines/brian2_.py +57 -0
  28. omv/engines/eden_.py +63 -0
  29. omv/engines/engine.py +111 -0
  30. omv/engines/genesis.py +86 -0
  31. omv/engines/getarbor.py +15 -0
  32. omv/engines/getbrian1.py +42 -0
  33. omv/engines/getbrian2.py +17 -0
  34. omv/engines/geteden.py +17 -0
  35. omv/engines/getgenesis.py +56 -0
  36. omv/engines/getjlems.py +20 -0
  37. omv/engines/getjnml.py +48 -0
  38. omv/engines/getlibsbml.py +13 -0
  39. omv/engines/getmoose.py +15 -0
  40. omv/engines/getnest.py +62 -0
  41. omv/engines/getnetpyne.py +52 -0
  42. omv/engines/getneuroconstruct.py +31 -0
  43. omv/engines/getnml2.py +26 -0
  44. omv/engines/getnrn.py +60 -0
  45. omv/engines/getoctave.py +11 -0
  46. omv/engines/getpylems.py +13 -0
  47. omv/engines/getpyneuroml.py +14 -0
  48. omv/engines/getpynn.py +40 -0
  49. omv/engines/jlems.py +48 -0
  50. omv/engines/jneuroml.py +101 -0
  51. omv/engines/jneuromlbrian.py +65 -0
  52. omv/engines/jneuromlbrian2.py +61 -0
  53. omv/engines/jneuromleden.py +61 -0
  54. omv/engines/jneuromlmoose.py +63 -0
  55. omv/engines/jneuromlnetpyne.py +73 -0
  56. omv/engines/jneuromlnetpyne_np2.py +45 -0
  57. omv/engines/jneuromlnetpyne_np4.py +45 -0
  58. omv/engines/jneuromlnrn.py +78 -0
  59. omv/engines/jneuromlpynnnrn.py +75 -0
  60. omv/engines/jneuromlvalidate.py +62 -0
  61. omv/engines/jneuromlvalidatev1.py +58 -0
  62. omv/engines/moose_.py +86 -0
  63. omv/engines/nestsli.py +84 -0
  64. omv/engines/netpyne_.py +120 -0
  65. omv/engines/netpyne__np2.py +47 -0
  66. omv/engines/netpyne__np4.py +47 -0
  67. omv/engines/neuron_.py +205 -0
  68. omv/engines/octave.py +51 -0
  69. omv/engines/pylems.py +57 -0
  70. omv/engines/pylemsnml2.py +59 -0
  71. omv/engines/pynest.py +111 -0
  72. omv/engines/pyneuroconstruct.py +67 -0
  73. omv/engines/pyneuroml_.py +55 -0
  74. omv/engines/pyneuromlvalidatesbml.py +83 -0
  75. omv/engines/pyneuron.py +94 -0
  76. omv/engines/pynn.py +63 -0
  77. omv/engines/pynnbrian1.py +59 -0
  78. omv/engines/pynnbrian2.py +60 -0
  79. omv/engines/pynnnest.py +56 -0
  80. omv/engines/pynnneuroml.py +57 -0
  81. omv/engines/pynnneuron.py +94 -0
  82. omv/engines/utils/__init__.py +21 -0
  83. omv/engines/utils/genesis_utils.g +26 -0
  84. omv/engines/utils/wdir.py +15 -0
  85. omv/experiment.py +18 -0
  86. omv/find_tests.py +126 -0
  87. omv/omt_mep_parser.py +59 -0
  88. omv/omv_util.py +439 -0
  89. omv/parse_omt.py +118 -0
  90. omv/tally.py +112 -0
  91. omv/test/__init__.py +0 -0
  92. omv/test/test_rates.py +38 -0
  93. omv/test/test_types.py +29 -0
  94. omv/validation/__init__.py +0 -0
  95. omv/validation/rx_validator.py +35 -0
  96. omv/validation/utils.py +51 -0
  97. omv/validation/validate.py +53 -0
  98. omv/validation/validate_mep.py +15 -0
@@ -0,0 +1,101 @@
1
+ import os
2
+ import shutil
3
+ import subprocess as sp
4
+ from pathlib import Path
5
+ import platform
6
+
7
+ from omv.common.inout import inform, trim_path, is_verbose, check_output
8
+ from omv.engines.engine import OMVEngine, EngineExecutionError
9
+
10
+
11
+ class JNeuroMLEngine(OMVEngine):
12
+ name = "jNeuroML"
13
+
14
+ @staticmethod
15
+ def get_environment():
16
+ if "JNML_HOME" in os.environ:
17
+ jnmlhome = os.environ["JNML_HOME"]
18
+ elif shutil.which("jnml") is not None:
19
+ jnmlhome = Path(shutil.which("jnml")).parent
20
+ else:
21
+ osname = platform.system()
22
+ if osname == "Linux":
23
+ try:
24
+ jnmlhome = os.path.join(
25
+ os.environ["XDG_DATA_HOME"], "jnml/jNeuroMLJar"
26
+ )
27
+ except KeyError as e:
28
+ localsharepath = os.path.join(os.environ["HOME"], ".local/share")
29
+ if os.path.isdir(localsharepath):
30
+ jnmlhome = os.path.join(
31
+ os.environ["HOME"], ".local/share/jnml/jNeuroMLJar"
32
+ )
33
+ else:
34
+ jnmlhome = os.path.join(os.environ["HOME"], "jnml/jNeuroMLJar")
35
+
36
+ elif osname == "Darwin":
37
+ jnmlhome = os.path.join(os.environ["HOME"], "Library/jnml/jNeuroMLJar")
38
+ else:
39
+ jnmlhome = os.path.join(os.environ["HOME"], "jnml/jNeuroMLJar")
40
+
41
+ environment_vars = {"JNML_HOME": jnmlhome}
42
+
43
+ return environment_vars
44
+
45
+ @staticmethod
46
+ def get_executable():
47
+ environment_vars = JNeuroMLEngine.get_environment()
48
+ jnml = os.path.join(
49
+ environment_vars["JNML_HOME"], "jnml" if os.name != "nt" else "jnml.bat"
50
+ )
51
+ return jnml
52
+
53
+ @staticmethod
54
+ def is_installed():
55
+ ret = True
56
+ try:
57
+ if is_verbose():
58
+ inform(
59
+ "Checking whether %s is installed..." % JNeuroMLEngine.name,
60
+ indent=1,
61
+ )
62
+ FNULL = open(os.devnull, "w")
63
+ jnml = JNeuroMLEngine.get_executable()
64
+ r = check_output(
65
+ [jnml, "-v"], verbosity=2, env=JNeuroMLEngine.get_environment()
66
+ )
67
+ ret = "%s" % r.split()[1]
68
+
69
+ if is_verbose():
70
+ inform("%s %s is installed..." % (JNeuroMLEngine.name, ret), indent=2)
71
+ except OSError as err:
72
+ if is_verbose():
73
+ inform("Couldn't execute/import jNeuroML: ", err, indent=1)
74
+ ret = False
75
+ return ret
76
+
77
+ @staticmethod
78
+ def install(version):
79
+ from omv.engines.getjnml import install_jnml
80
+
81
+ inform("Will fetch and install jNeuroML jar", indent=2)
82
+ install_jnml(version)
83
+
84
+ def run(self):
85
+ try:
86
+ inform(
87
+ "Running file %s with %s" % (trim_path(self.modelpath), self.name),
88
+ indent=1,
89
+ )
90
+
91
+ jnml = JNeuroMLEngine.get_executable()
92
+ self.stdout = sp.check_output(
93
+ [jnml, self.modelpath, "-nogui"],
94
+ cwd=os.path.dirname(self.modelpath),
95
+ env=JNeuroMLEngine.get_environment(),
96
+ )
97
+ self.returncode = 0
98
+ except sp.CalledProcessError as err:
99
+ self.returncode = err.returncode
100
+ self.stdout = err.output
101
+ raise EngineExecutionError
@@ -0,0 +1,65 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.brian1 import Brian1Engine
6
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+
10
+ class JNeuroMLBrianEngine(JNeuroMLEngine):
11
+ name = "jNeuroML_Brian"
12
+
13
+ python3_compatible = Brian1Engine.python3_compatible
14
+
15
+ @staticmethod
16
+ def is_installed():
17
+ if is_verbose():
18
+ inform(
19
+ "Checking whether %s is installed..." % JNeuroMLBrianEngine.name,
20
+ indent=1,
21
+ )
22
+ return JNeuroMLEngine.is_installed() and Brian1Engine.is_installed()
23
+
24
+ @staticmethod
25
+ def install(version):
26
+ if not JNeuroMLEngine.is_installed():
27
+ JNeuroMLEngine.install(None)
28
+ if not Brian1Engine.is_installed():
29
+ Brian1Engine.install(None)
30
+
31
+ JNeuroMLBrianEngine.path = JNeuroMLEngine.path + ":" + Brian1Engine.path
32
+ JNeuroMLBrianEngine.environment_vars = {}
33
+ JNeuroMLBrianEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
34
+ JNeuroMLBrianEngine.environment_vars.update(Brian1Engine.environment_vars)
35
+ inform("PATH: " + JNeuroMLBrianEngine.path)
36
+ inform("Env vars: %s" % JNeuroMLBrianEngine.environment_vars)
37
+
38
+ def run(self):
39
+ try:
40
+ inform(
41
+ "Running file %s with %s"
42
+ % (trim_path(self.modelpath), JNeuroMLBrianEngine.name),
43
+ indent=1,
44
+ )
45
+
46
+ from omv.engines.jneuroml import JNeuroMLEngine
47
+
48
+ jnml = JNeuroMLEngine.get_executable()
49
+
50
+ self.stdout = check_output(
51
+ [jnml, self.modelpath, "-brian"],
52
+ cwd=os.path.dirname(self.modelpath),
53
+ env=JNeuroMLEngine.get_environment(),
54
+ )
55
+ self.stdout += check_output(
56
+ ["python", self.modelpath.replace(".xml", "_brian.py"), "-nogui"],
57
+ cwd=os.path.dirname(self.modelpath),
58
+ )
59
+ inform("Success with running ", JNeuroMLBrianEngine.name, indent=1)
60
+ self.returncode = 0
61
+ except sp.CalledProcessError as err:
62
+ inform("Error with ", JNeuroMLBrianEngine.name, indent=1)
63
+ self.returncode = err.returncode
64
+ self.stdout = err.output
65
+ raise EngineExecutionError
@@ -0,0 +1,61 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.brian2_ import Brian2Engine
6
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+
10
+ class JNeuroMLBrian2Engine(JNeuroMLEngine):
11
+ name = "jNeuroML_Brian2"
12
+
13
+ @staticmethod
14
+ def is_installed():
15
+ if is_verbose():
16
+ inform(
17
+ "Checking whether %s is installed..." % JNeuroMLBrian2Engine.name,
18
+ indent=1,
19
+ )
20
+ return JNeuroMLEngine.is_installed() and Brian2Engine.is_installed()
21
+
22
+ @staticmethod
23
+ def install(brian2_version):
24
+ if not JNeuroMLEngine.is_installed():
25
+ JNeuroMLEngine.install(None)
26
+ if not Brian2Engine.is_installed():
27
+ Brian2Engine.install(brian2_version)
28
+
29
+ JNeuroMLBrian2Engine.path = JNeuroMLEngine.path + ":" + Brian2Engine.path
30
+ JNeuroMLBrian2Engine.environment_vars = {}
31
+ JNeuroMLBrian2Engine.environment_vars.update(JNeuroMLEngine.environment_vars)
32
+ JNeuroMLBrian2Engine.environment_vars.update(Brian2Engine.environment_vars)
33
+ inform("PATH: " + JNeuroMLBrian2Engine.path)
34
+ inform("Env vars: %s" % JNeuroMLBrian2Engine.environment_vars)
35
+
36
+ def run(self):
37
+ try:
38
+ inform(
39
+ "Running file %s with %s"
40
+ % (trim_path(self.modelpath), JNeuroMLBrian2Engine.name),
41
+ indent=1,
42
+ )
43
+ from omv.engines.jneuroml import JNeuroMLEngine
44
+
45
+ jnml = JNeuroMLEngine.get_executable()
46
+ self.stdout = check_output(
47
+ [jnml, self.modelpath, "-brian2"],
48
+ cwd=os.path.dirname(self.modelpath),
49
+ env=JNeuroMLEngine.get_environment(),
50
+ )
51
+ self.stdout += check_output(
52
+ ["python", self.modelpath.replace(".xml", "_brian2.py"), "-nogui"],
53
+ cwd=os.path.dirname(self.modelpath),
54
+ )
55
+ inform("Success with running ", JNeuroMLBrian2Engine.name, indent=1)
56
+ self.returncode = 0
57
+ except sp.CalledProcessError as err:
58
+ inform("Error with ", JNeuroMLBrian2Engine.name, indent=1)
59
+ self.returncode = err.returncode
60
+ self.stdout = err.output
61
+ raise EngineExecutionError
@@ -0,0 +1,61 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.eden_ import EdenEngine
6
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+
10
+ class JNeuroMLEdenEngine(JNeuroMLEngine):
11
+ name = "jNeuroML_EDEN"
12
+
13
+ @staticmethod
14
+ def is_installed():
15
+ if is_verbose():
16
+ inform(
17
+ "Checking whether %s is installed..." % JNeuroMLEdenEngine.name,
18
+ indent=1,
19
+ )
20
+ return JNeuroMLEngine.is_installed() and EdenEngine.is_installed()
21
+
22
+ @staticmethod
23
+ def install(version):
24
+ if not JNeuroMLEngine.is_installed():
25
+ JNeuroMLEngine.install(None)
26
+ if not EdenEngine.is_installed():
27
+ EdenEngine.install(version)
28
+
29
+ JNeuroMLEdenEngine.path = JNeuroMLEngine.path + ":" + EdenEngine.path
30
+ JNeuroMLEdenEngine.environment_vars = {}
31
+ JNeuroMLEdenEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
32
+ JNeuroMLEdenEngine.environment_vars.update(EdenEngine.environment_vars)
33
+ inform("PATH: " + JNeuroMLEdenEngine.path)
34
+ inform("Env vars: %s" % JNeuroMLEdenEngine.environment_vars)
35
+
36
+ def run(self):
37
+ try:
38
+ inform(
39
+ "Running file %s with %s"
40
+ % (trim_path(self.modelpath), JNeuroMLEdenEngine.name),
41
+ indent=1,
42
+ )
43
+ from omv.engines.jneuroml import JNeuroMLEngine
44
+
45
+ jnml = JNeuroMLEngine.get_executable()
46
+ self.stdout = check_output(
47
+ [jnml, self.modelpath, "-eden"],
48
+ cwd=os.path.dirname(self.modelpath),
49
+ env=JNeuroMLEngine.get_environment(),
50
+ )
51
+ self.stdout += check_output(
52
+ ["python", self.modelpath.replace(".xml", "_eden.py")],
53
+ cwd=os.path.dirname(self.modelpath),
54
+ )
55
+ inform("Success with running ", JNeuroMLEdenEngine.name, indent=1)
56
+ self.returncode = 0
57
+ except sp.CalledProcessError as err:
58
+ inform("Error with ", JNeuroMLEdenEngine.name, indent=1)
59
+ self.returncode = err.returncode
60
+ self.stdout = err.output
61
+ raise EngineExecutionError
@@ -0,0 +1,63 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.moose_ import MooseEngine
6
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+
10
+ class JNeuroMLMooseEngine(JNeuroMLEngine):
11
+ name = "jNeuroML_Moose"
12
+
13
+ @staticmethod
14
+ def is_installed():
15
+ if is_verbose():
16
+ inform(
17
+ "Checking whether %s is installed..." % JNeuroMLMooseEngine.name,
18
+ indent=1,
19
+ )
20
+ return JNeuroMLEngine.is_installed() and MooseEngine.is_installed()
21
+
22
+ @staticmethod
23
+ def install(version):
24
+ if not JNeuroMLEngine.is_installed():
25
+ JNeuroMLEngine.install(None)
26
+ if not MooseEngine.is_installed():
27
+ MooseEngine.install(None)
28
+
29
+ JNeuroMLMooseEngine.path = JNeuroMLEngine.path + ":" + JNeuroMLMooseEngine.path
30
+ JNeuroMLMooseEngine.environment_vars = {}
31
+ JNeuroMLMooseEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
32
+ JNeuroMLMooseEngine.environment_vars.update(MooseEngine.environment_vars)
33
+ inform("PATH: " + JNeuroMLMooseEngine.path)
34
+ inform("Env vars: %s" % JNeuroMLMooseEngine.environment_vars)
35
+
36
+ def run(self):
37
+ try:
38
+ inform(
39
+ "Running file %s with %s"
40
+ % (trim_path(self.modelpath), JNeuroMLMooseEngine.name),
41
+ indent=1,
42
+ )
43
+
44
+ from omv.engines.jneuroml import JNeuroMLEngine
45
+
46
+ jnml = JNeuroMLEngine.get_executable()
47
+
48
+ self.stdout = check_output(
49
+ [jnml, self.modelpath, "-moose"],
50
+ cwd=os.path.dirname(self.modelpath),
51
+ env=JNeuroMLEngine.get_environment(),
52
+ )
53
+ self.stdout += check_output(
54
+ ["python", self.modelpath.replace(".xml", "_moose.py"), "-nogui"],
55
+ cwd=os.path.dirname(self.modelpath),
56
+ )
57
+ inform("Success with running ", JNeuroMLMooseEngine.name, indent=1)
58
+ self.returncode = 0
59
+ except sp.CalledProcessError as err:
60
+ inform("Error with ", JNeuroMLMooseEngine.name, indent=1)
61
+ self.returncode = err.returncode
62
+ self.stdout = err.output
63
+ raise EngineExecutionError
@@ -0,0 +1,73 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.netpyne_ import NetPyNEEngine
6
+ from omv.engines.neuron_ import NeuronEngine
7
+
8
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
9
+ from omv.engines.engine import EngineExecutionError
10
+
11
+
12
+ class JNeuroMLNetPyNEEngine(JNeuroMLEngine):
13
+ name = "jNeuroML_NetPyNE"
14
+
15
+ @staticmethod
16
+ def is_installed():
17
+ if is_verbose():
18
+ inform(
19
+ "Checking whether %s is installed..." % JNeuroMLNetPyNEEngine.name,
20
+ indent=1,
21
+ )
22
+ return JNeuroMLEngine.is_installed() and NetPyNEEngine.is_installed()
23
+
24
+ @staticmethod
25
+ def install(version):
26
+ if not JNeuroMLEngine.is_installed():
27
+ JNeuroMLEngine.install(None)
28
+ inform(
29
+ "%s installed JNeuroML..." % JNeuroMLNetPyNEEngine.name,
30
+ indent=2,
31
+ verbosity=1,
32
+ )
33
+ if not NetPyNEEngine.is_installed():
34
+ NetPyNEEngine.install(None)
35
+ inform(
36
+ "%s installed NetPyNE (& NEURON)..." % JNeuroMLNetPyNEEngine.name,
37
+ indent=2,
38
+ verbosity=1,
39
+ )
40
+
41
+ environment_vars_nrn, path_nrn = NeuronEngine.get_nrn_environment()
42
+
43
+ JNeuroMLNetPyNEEngine.path = JNeuroMLEngine.path + ":" + path_nrn
44
+ JNeuroMLNetPyNEEngine.environment_vars = {}
45
+ JNeuroMLNetPyNEEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
46
+ JNeuroMLNetPyNEEngine.environment_vars.update(NetPyNEEngine.environment_vars)
47
+ JNeuroMLNetPyNEEngine.environment_vars.update(environment_vars_nrn)
48
+ inform("PATH: " + JNeuroMLNetPyNEEngine.path)
49
+ inform("Env vars: %s" % JNeuroMLNetPyNEEngine.environment_vars)
50
+
51
+ def run(self):
52
+ try:
53
+ inform(
54
+ "Running file %s with %s"
55
+ % (trim_path(self.modelpath), JNeuroMLNetPyNEEngine.name),
56
+ indent=1,
57
+ )
58
+
59
+ from omv.engines.jneuroml import JNeuroMLEngine
60
+
61
+ jnml = JNeuroMLEngine.get_executable()
62
+ self.stdout = check_output(
63
+ [jnml, self.modelpath, "-netpyne", "-nogui", "-run"],
64
+ cwd=os.path.dirname(self.modelpath),
65
+ env=JNeuroMLEngine.get_environment(),
66
+ )
67
+ inform("Success with running ", JNeuroMLNetPyNEEngine.name, indent=1)
68
+ self.returncode = 0
69
+ except sp.CalledProcessError as err:
70
+ inform("Error with ", JNeuroMLNetPyNEEngine.name, indent=1)
71
+ self.returncode = err.returncode
72
+ self.stdout = err.output
73
+ raise EngineExecutionError
@@ -0,0 +1,45 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuromlnetpyne import JNeuroMLNetPyNEEngine
5
+
6
+ from omv.common.inout import inform, trim_path, check_output
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+ """
10
+ A temporary engine for testing running jNeuroML_NetPyNE models in parallel mode.
11
+ Would require update of NEURON installation process to ensure parallel
12
+ NEURON correctly installed, so mainly useful for local testing presently.
13
+ Would also be better to incorporate this into netpyne_.py, and have correct
14
+ handling of variables specified in *.omt files
15
+ """
16
+
17
+
18
+ class JNeuroMLNetPyNENP2Engine(JNeuroMLNetPyNEEngine):
19
+ name = "jNeuroML_NetPyNE_NP2"
20
+
21
+ def run(self):
22
+ np = 2
23
+
24
+ try:
25
+ inform(
26
+ "Running file %s with %s"
27
+ % (trim_path(self.modelpath), JNeuroMLNetPyNEEngine.name),
28
+ indent=1,
29
+ )
30
+
31
+ from omv.engines.jneuroml import JNeuroMLEngine
32
+
33
+ jnml = JNeuroMLEngine.get_executable()
34
+ self.stdout = check_output(
35
+ [jnml, self.modelpath, "-netpyne", "-nogui", "-run", "-np", "%s" % np],
36
+ cwd=os.path.dirname(self.modelpath),
37
+ env=JNeuroMLEngine.get_environment(),
38
+ )
39
+ inform("Success with running ", JNeuroMLNetPyNEEngine.name, indent=1)
40
+ self.returncode = 0
41
+ except sp.CalledProcessError as err:
42
+ inform("Error with ", JNeuroMLNetPyNEEngine.name, indent=1)
43
+ self.returncode = err.returncode
44
+ self.stdout = err.output
45
+ raise EngineExecutionError
@@ -0,0 +1,45 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuromlnetpyne import JNeuroMLNetPyNEEngine
5
+
6
+ from omv.common.inout import inform, trim_path, check_output
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+ """
10
+ A temporary engine for testing running jNeuroML_NetPyNE models in parallel mode.
11
+ Would require update of NEURON installation process to ensure parallel
12
+ NEURON correctly installed, so mainly useful for local testing presently.
13
+ Would also be better to incorporate this into netpyne_.py, and have correct
14
+ handling of variables specified in *.omt files
15
+ """
16
+
17
+
18
+ class JNeuroMLNetPyNENP4Engine(JNeuroMLNetPyNEEngine):
19
+ name = "jNeuroML_NetPyNE_NP4"
20
+
21
+ def run(self):
22
+ np = 4
23
+
24
+ try:
25
+ inform(
26
+ "Running file %s with %s"
27
+ % (trim_path(self.modelpath), JNeuroMLNetPyNEEngine.name),
28
+ indent=1,
29
+ )
30
+
31
+ from omv.engines.jneuroml import JNeuroMLEngine
32
+
33
+ jnml = JNeuroMLEngine.get_executable()
34
+ self.stdout = check_output(
35
+ [jnml, self.modelpath, "-netpyne", "-nogui", "-run", "-np", "%s" % np],
36
+ cwd=os.path.dirname(self.modelpath),
37
+ env=JNeuroMLEngine.get_environment(),
38
+ )
39
+ inform("Success with running ", JNeuroMLNetPyNEEngine.name, indent=1)
40
+ self.returncode = 0
41
+ except sp.CalledProcessError as err:
42
+ inform("Error with ", JNeuroMLNetPyNEEngine.name, indent=1)
43
+ self.returncode = err.returncode
44
+ self.stdout = err.output
45
+ raise EngineExecutionError
@@ -0,0 +1,78 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.neuron_ import NeuronEngine
6
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
7
+ from omv.engines.engine import EngineExecutionError
8
+
9
+
10
+ class JNeuroMLNRNEngine(JNeuroMLEngine):
11
+ name = "jNeuroML_NEURON"
12
+
13
+ @staticmethod
14
+ def is_installed():
15
+ if is_verbose():
16
+ inform(
17
+ "Checking whether %s is installed..." % JNeuroMLNRNEngine.name, indent=1
18
+ )
19
+ return JNeuroMLEngine.is_installed() and NeuronEngine.is_installed()
20
+
21
+ @staticmethod
22
+ def install(nrn_version):
23
+ if not JNeuroMLEngine.is_installed():
24
+ JNeuroMLEngine.install(None)
25
+ if not NeuronEngine.is_installed():
26
+ NeuronEngine.install(nrn_version)
27
+
28
+ JNeuroMLNRNEngine.get_jnmlnrnenv()
29
+
30
+ @staticmethod
31
+ def get_jnmlnrnenv():
32
+ environment_vars_nrn, path_nrn = NeuronEngine.get_nrn_environment()
33
+
34
+ JNeuroMLNRNEngine.path = JNeuroMLEngine.path + ":" + path_nrn
35
+ JNeuroMLNRNEngine.environment_vars = {}
36
+ JNeuroMLNRNEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
37
+ JNeuroMLNRNEngine.environment_vars.update(environment_vars_nrn)
38
+
39
+ JNeuroMLNRNEngine.environment_vars.update(JNeuroMLEngine.get_environment())
40
+
41
+ inform("PATH: " + JNeuroMLNRNEngine.path)
42
+ inform("Env vars: %s" % JNeuroMLNRNEngine.environment_vars)
43
+ del JNeuroMLNRNEngine.environment_vars["PYTHONPATH"]
44
+
45
+ return JNeuroMLNRNEngine.environment_vars
46
+
47
+ def run(self):
48
+ self.stdout, self.returncode = JNeuroMLNRNEngine.run_using_jnmlnrn_env(
49
+ JNeuroMLNRNEngine.name, self.modelpath, ["-neuron", "-nogui", "-run"]
50
+ )
51
+
52
+ if self.returncode != 0:
53
+ raise EngineExecutionError
54
+
55
+ @staticmethod
56
+ def run_using_jnmlnrn_env(engine, modelpath, args):
57
+ try:
58
+ env = JNeuroMLNRNEngine.get_jnmlnrnenv()
59
+ inform(
60
+ "Running file %s with %s, env: %s"
61
+ % (trim_path(modelpath), engine, env),
62
+ indent=1,
63
+ )
64
+ from omv.engines.jneuroml import JNeuroMLEngine
65
+
66
+ jnml = JNeuroMLEngine.get_executable()
67
+ cmds = [jnml, modelpath]
68
+ cmds.extend(args)
69
+ stdout = check_output(cmds, cwd=os.path.dirname(modelpath), env=env)
70
+
71
+ inform("Success with running ", engine, indent=1)
72
+ returncode = 0
73
+ return stdout, returncode
74
+ except sp.CalledProcessError as err:
75
+ inform("Error with ", engine, indent=1)
76
+ returncode = err.returncode
77
+ stdout = err.output
78
+ return stdout, returncode
@@ -0,0 +1,75 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.engines.jneuroml import JNeuroMLEngine
5
+ from omv.engines.pynnneuron import PyNNNRNEngine
6
+ from omv.engines.neuron_ import NeuronEngine
7
+ from omv.engines.pynn import PyNNEngine
8
+
9
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
10
+ from omv.engines.engine import EngineExecutionError
11
+
12
+
13
+ class JNeuroMLPyNNNRNEngine(JNeuroMLEngine):
14
+ name = "jNeuroML_PyNN_NEURON"
15
+
16
+ @staticmethod
17
+ def is_installed():
18
+ if is_verbose():
19
+ inform(
20
+ "Checking whether %s is installed..." % JNeuroMLPyNNNRNEngine.name,
21
+ indent=1,
22
+ )
23
+ return JNeuroMLEngine.is_installed() and PyNNNRNEngine.is_installed()
24
+
25
+ @staticmethod
26
+ def install(version):
27
+ if not JNeuroMLEngine.is_installed():
28
+ JNeuroMLEngine.install(None)
29
+ inform(
30
+ "%s installed JNeuroML..." % JNeuroMLPyNNNRNEngine.name,
31
+ indent=2,
32
+ verbosity=1,
33
+ )
34
+ if not PyNNNRNEngine.is_installed():
35
+ PyNNNRNEngine.install(None)
36
+ inform(
37
+ "%s installed PyNN & NRN..." % JNeuroMLPyNNNRNEngine.name,
38
+ indent=2,
39
+ verbosity=1,
40
+ )
41
+
42
+ environment_vars_nrn, path_nrn = NeuronEngine.get_nrn_environment()
43
+
44
+ JNeuroMLPyNNNRNEngine.path = JNeuroMLEngine.path + ":" + path_nrn
45
+ JNeuroMLPyNNNRNEngine.environment_vars = {}
46
+ JNeuroMLPyNNNRNEngine.environment_vars.update(JNeuroMLEngine.environment_vars)
47
+ JNeuroMLPyNNNRNEngine.environment_vars.update(PyNNEngine.environment_vars)
48
+ JNeuroMLPyNNNRNEngine.environment_vars.update(environment_vars_nrn)
49
+ inform("PATH: " + JNeuroMLPyNNNRNEngine.path)
50
+ inform("Env vars: %s" % JNeuroMLPyNNNRNEngine.environment_vars)
51
+
52
+ def run(self):
53
+ try:
54
+ inform(
55
+ "Running file %s with %s"
56
+ % (trim_path(self.modelpath), JNeuroMLPyNNNRNEngine.name),
57
+ indent=1,
58
+ )
59
+
60
+ from omv.engines.jneuroml import JNeuroMLEngine
61
+
62
+ jnml = JNeuroMLEngine.get_executable()
63
+
64
+ self.stdout = check_output(
65
+ [jnml, self.modelpath, "-pynn", "-run-neuron"],
66
+ cwd=os.path.dirname(self.modelpath),
67
+ env=JNeuroMLEngine.get_environment(),
68
+ )
69
+ inform("Success with running ", JNeuroMLPyNNNRNEngine.name, indent=1)
70
+ self.returncode = 0
71
+ except sp.CalledProcessError as err:
72
+ inform("Error with ", JNeuroMLPyNNNRNEngine.name, indent=1)
73
+ self.returncode = err.returncode
74
+ self.stdout = err.output
75
+ raise EngineExecutionError