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,42 @@
1
+ import os
2
+ import pip
3
+ from omv.common.inout import inform, check_output
4
+ from omv.engines.utils.wdir import working_dir
5
+
6
+
7
+ def check_scipy_dev():
8
+ try:
9
+ import scipy
10
+ except ImportError:
11
+ # Compiling from source is terribly slow, and requires Blas/Lapack...
12
+ # print('Installing scipy dev...')
13
+ # pip.main(['install', 'cython'])
14
+ # pip.main(['install', 'git+http://github.com/scipy/scipy/'])
15
+ print(
16
+ "\n***************************************************************************************"
17
+ )
18
+ print("\n* ")
19
+ print("\n** ERROR: Brian requires scipy. Please install it manually.")
20
+ print(
21
+ "\n** If running OMV on Travis-CI, see https://github.com/OpenSourceBrain/BrianShowcase/blob/master/.travis.yml."
22
+ )
23
+ print("\n* ")
24
+ print(
25
+ "\n***************************************************************************************"
26
+ )
27
+ raise ImportError
28
+
29
+
30
+ def install_brian():
31
+ install_root = os.environ["HOME"]
32
+
33
+ with working_dir(install_root):
34
+ check_output(["git", "clone", "https://github.com/brian-team/brian.git"])
35
+ inform("Successfully cloned Brian", indent=2, verbosity=1)
36
+
37
+ path = os.path.join(install_root, "brian")
38
+
39
+ with working_dir(path):
40
+ check_output(["git", "checkout", "master"])
41
+ check_output(["python", "setup.py", "install"])
42
+ inform("Successfully installed Brian", indent=2, verbosity=1)
@@ -0,0 +1,17 @@
1
+ from omv.common.inout import pip_install
2
+
3
+ from omv.engines.getbrian1 import check_scipy_dev
4
+
5
+
6
+ def install_brian2(version):
7
+ if not version:
8
+ version = "2.5.3"
9
+ try:
10
+ pip_install("brian2", version)
11
+ import brian2
12
+
13
+ m = "Successfully installed Brian2..."
14
+ except Exception as e:
15
+ m = "ERROR installing Brian2: " + str(e)
16
+ finally:
17
+ print(m)
omv/engines/geteden.py ADDED
@@ -0,0 +1,17 @@
1
+ from omv.common.inout import pip_install
2
+
3
+ DEFAULT_VERSION = "0.2.3"
4
+
5
+
6
+ def install_eden(version=None):
7
+ if not version:
8
+ version = DEFAULT_VERSION
9
+ try:
10
+ pip_install("eden-simulator", version)
11
+ import eden_simulator
12
+
13
+ m = "Successfully installed EDEN..."
14
+ except Exception as e:
15
+ m = "ERROR installing EDEN: " + str(e)
16
+ finally:
17
+ print(m)
@@ -0,0 +1,56 @@
1
+ import os
2
+ from subprocess import check_output as co
3
+
4
+ from omv.engines.utils.wdir import working_dir
5
+
6
+ simrc = """
7
+ // .simrc file to go in the home directory of all GENESIS users
8
+ //===========================================================================
9
+ // environment variables
10
+ //===========================================================================
11
+ // SIMPATH - path to search for scripts (includes the startup path)
12
+ // SIMNOTES - default file for simulator notes
13
+ //===========================================================================
14
+ setenv SIMPATH {getenv HOME}/genesis/genesis2.4gamma-master/src/startup \
15
+ {getenv HOME}/genesis/genesis2.4gamma-master/Scripts/neurokit \
16
+ {getenv HOME}/genesis/genesis2.4gamma-master/Scripts/neurokit/prototypes
17
+
18
+ // This adds the Xodus 1 compatability library directory to the
19
+ // SIMPATH. If you are not expecting to use X1compat, you can
20
+ // comment out the following line.
21
+ setenv SIMPATH {getenv SIMPATH} \
22
+ {getenv HOME}/genesis/genesis2.4gamma-master/Scripts/X1compat
23
+
24
+ setenv SIMNOTES {getenv HOME}/genesis/genesis2.4gamma-master/.notes
25
+ setenv GENESIS_HELP {getenv HOME}/genesis/genesis2.4gamma-master/Doc
26
+
27
+ //===========================================================================
28
+ // set up tables
29
+ //===========================================================================
30
+ schedule// default simulation schedule
31
+
32
+ // See /usr/genesis/startup/escapelist.g for macro definitions. These allow
33
+ // you to use cursor keys for the recall and editing of previous commands
34
+ include escapelist // setup macro keys for DEC and SUN keyboards
35
+ """
36
+
37
+
38
+ def install_genesis(get_latest=False):
39
+ genpath = os.path.join(os.environ["HOME"], "genesis")
40
+ os.mkdir(genpath)
41
+ with working_dir(genpath):
42
+ print(
43
+ co(
44
+ [
45
+ "wget",
46
+ "-nv",
47
+ "https://github.com/borismarin/genesis2.4gamma/archive/master.zip",
48
+ ]
49
+ )
50
+ )
51
+ print(co(["unzip", "master.zip"]))
52
+ print(co(["ls", "-la", "genesis2.4gamma-master"]))
53
+ os.chdir("genesis2.4gamma-master/src")
54
+ print(co(["./configure"]))
55
+ print(co(["make"]))
56
+ open(os.path.join(os.environ["HOME"], ".simrc"), "w").write(simrc)
@@ -0,0 +1,20 @@
1
+ import os
2
+ from subprocess import check_output as co
3
+
4
+ from omv.common.inout import inform
5
+ from omv.engines.utils.wdir import working_dir
6
+
7
+
8
+ def install_jlems():
9
+ install_root = os.environ["HOME"]
10
+
11
+ with working_dir(install_root):
12
+ print(co(["git", "clone", "https://github.com/LEMS/jLEMS.git"]))
13
+ inform("Successfully cloned jLEMS", indent=2, verbosity=1)
14
+
15
+ path = os.path.join(install_root, "jLEMS")
16
+
17
+ with working_dir(path):
18
+ print(co(["git", "checkout", "development"]))
19
+ print(co(["mvn", "install"]))
20
+ inform("Successfully installed jLEMS", indent=2, verbosity=1)
omv/engines/getjnml.py ADDED
@@ -0,0 +1,48 @@
1
+ import os
2
+ import platform
3
+ from subprocess import check_output
4
+ from pathlib import Path
5
+
6
+ from omv.engines.utils.wdir import working_dir
7
+ from omv.common.inout import inform
8
+
9
+
10
+ def install_jnml(version):
11
+
12
+ if not version:
13
+ version = "v0.12.4"
14
+
15
+ try:
16
+ jnmlhome = os.environ["JNML_HOME"]
17
+ jnmlpath = Path(jnmlhome).parent
18
+ except KeyError:
19
+ osname = platform.system()
20
+ if osname == "Linux":
21
+ try:
22
+ jnmlpath = os.path.join(os.environ["XDG_DATA_HOME"], "jnml")
23
+ except KeyError:
24
+ localsharepath = os.path.join(os.environ["HOME"], ".local/share")
25
+ if os.path.isdir(localsharepath):
26
+ jnmlpath = os.path.join(localsharepath, "jnml")
27
+ else:
28
+ jnmlpath = os.path.join(os.environ["HOME"], "jnml")
29
+
30
+ elif osname == "Darwin":
31
+ jnmlpath = os.path.join(os.environ["HOME"], "Library/jnml")
32
+ else:
33
+ jnmlpath = os.path.join(os.environ["HOME"], "jnml")
34
+
35
+ if not os.path.isdir(jnmlpath):
36
+ os.mkdir(jnmlpath)
37
+ with working_dir(jnmlpath):
38
+ check_output(
39
+ [
40
+ "wget",
41
+ "-nv",
42
+ "https://github.com/NeuroML/jNeuroML/releases/download/%s/jNeuroML.zip"
43
+ % (version),
44
+ ]
45
+ )
46
+ check_output(["unzip", "jNeuroML.zip"])
47
+
48
+ inform("Successfully installed jNeuroML "+version, indent=1)
@@ -0,0 +1,13 @@
1
+ from omv.common.inout import pip_install, inform
2
+
3
+
4
+ def install_libsbml(version=None):
5
+ try:
6
+ pip_install("python-libsbml", version)
7
+ import libsbml
8
+
9
+ m = "Successfully installed libsbml v%s..." % libsbml.__version__
10
+ except Exception as e:
11
+ m = "ERROR installing libsbml: " + str(e)
12
+ finally:
13
+ inform(m, indent=2)
@@ -0,0 +1,15 @@
1
+ from omv.common.inout import pip_install
2
+
3
+
4
+ def install_moose(version):
5
+ if not version:
6
+ version = "4.0.0"
7
+ try:
8
+ pip_install("pymoose", version)
9
+ import moose
10
+
11
+ m = "Successfully installed MOOSE..."
12
+ except Exception as e:
13
+ m = "ERROR installing MOOSE: " + str(e)
14
+ finally:
15
+ print(m)
omv/engines/getnest.py ADDED
@@ -0,0 +1,62 @@
1
+ import os
2
+ from omv.common.inout import inform, check_output
3
+
4
+ from omv.engines.utils.wdir import working_dir
5
+ from sysconfig import get_paths
6
+ import sys
7
+
8
+
9
+ def install_nest(version):
10
+ if not version:
11
+ version = "3.3"
12
+
13
+ inform("Installing NEST", indent=2, verbosity=1)
14
+ nestpath = os.path.join(os.environ["HOME"], "nest")
15
+ nestpath2 = os.path.join(os.environ["HOME"], "nest/nest")
16
+ nestinstallpath = os.path.join(os.environ["HOME"], "nest/nest")
17
+ if "NEST_INSTALL_DIR" in os.environ:
18
+ nestinstallpath = os.environ["NEST_INSTALL_DIR"] + "/"
19
+
20
+ inform(
21
+ "Installing NEST (src: %s), (tgt: %s)" % (nestpath, nestinstallpath),
22
+ indent=2,
23
+ verbosity=1,
24
+ )
25
+ pypaths = get_paths()
26
+ inform("Python lib info: %s" % (pypaths), indent=2, verbosity=1)
27
+
28
+ try:
29
+ os.mkdir(nestpath)
30
+ except:
31
+ pass
32
+
33
+ with working_dir(nestpath):
34
+ # version='2.10.0'
35
+ check_output(
36
+ [
37
+ "wget",
38
+ "-nv",
39
+ "https://github.com/nest/nest-simulator/archive/v%s.tar.gz" % (version),
40
+ ]
41
+ )
42
+ check_output(["tar", "xzvf", "v%s.tar.gz" % version])
43
+ check_output(["mv", "nest-simulator-%s" % version, "nest"], cwd=nestpath)
44
+
45
+ with working_dir(nestpath2):
46
+ check_output(
47
+ [
48
+ "cmake",
49
+ "-DCMAKE_INSTALL_PREFIX:PATH=%s" % nestinstallpath,
50
+ "-DPYTHON_EXECUTABLE:FILEPATH=%s" % (sys.executable),
51
+ "-DPYTHON_INCLUDE_DIR=%s" % pypaths["include"],
52
+ ".",
53
+ ]
54
+ )
55
+ # "-DPYTHON_LIBRARY=%s/libpython3.8m.so" % pypaths['stdlib'],
56
+ # -DPYTHON_INCLUDE_DIR2=/usr/include/x86_64-linux-gnu/python3.4m"%(nestinstallpath, pypaths['scripts'], pypaths['stdlib'], pypaths['include'], pypaths[''])])
57
+ check_output(["make", "-j7"])
58
+ check_output(["make", "install"])
59
+
60
+
61
+ if __name__ == "__main__":
62
+ install_nest()
@@ -0,0 +1,52 @@
1
+ from omv.common.inout import check_output
2
+ from omv.engines.utils.wdir import working_dir
3
+ from omv.common.inout import pip_install
4
+ import os
5
+ import sys
6
+
7
+
8
+ def install_netpyne(version=None):
9
+ if version is not None:
10
+ pip_install("netpyne", version)
11
+ import netpyne
12
+
13
+ else:
14
+ install_root = os.environ["HOME"]
15
+ install_dir = "netpyneInstall"
16
+ path = os.path.join(install_root, install_dir)
17
+
18
+ if not os.path.isdir(path):
19
+ with working_dir(install_root):
20
+ print(
21
+ check_output(
22
+ [
23
+ "git",
24
+ "clone",
25
+ "https://github.com/Neurosim-lab/netpyne.git",
26
+ install_dir,
27
+ ]
28
+ )
29
+ )
30
+
31
+ with working_dir(path):
32
+ print(check_output(["git", "checkout", "neuroml_updates"]))
33
+ print(check_output(["pwd"]))
34
+
35
+ with working_dir(path):
36
+ if sys.version_info.major == 2:
37
+ # pip_install([]'setuptools==42.0.1')
38
+ pip_install(
39
+ [
40
+ "kiwisolver==1.0.1",
41
+ "matplotlib==2.2.4",
42
+ "pandas==0.23.4",
43
+ "bokeh==1.4.0",
44
+ "Pillow==5.4.1",
45
+ "matplotlib-scalebar==0.5.1",
46
+ "scipy==1.2.2",
47
+ "python-dateutil==2.8.0",
48
+ ]
49
+ )
50
+ pip_install(".")
51
+
52
+ m = "Successfully installed NetPyNE..."
@@ -0,0 +1,31 @@
1
+ import os
2
+ from omv.common.inout import inform, check_output as co
3
+ from omv.engines.utils.wdir import working_dir
4
+
5
+
6
+ def install_neuroconstruct():
7
+ try:
8
+ install_root = os.environ["HOME"]
9
+
10
+ with working_dir(install_root):
11
+ print(
12
+ co(
13
+ [
14
+ "git",
15
+ "clone",
16
+ "https://github.com/NeuralEnsemble/neuroConstruct.git",
17
+ ]
18
+ )
19
+ )
20
+
21
+ path = os.path.join(install_root, "neuroConstruct")
22
+
23
+ with working_dir(path):
24
+ print(co(["./updatenC.sh"]))
25
+ print(co(["./nC.sh", "-make"]))
26
+ m = "Successfully installed neuroConstruct..."
27
+
28
+ except Exception as e:
29
+ m = "ERROR installing neuroConstruct: " + str(e)
30
+ finally:
31
+ inform(m)
omv/engines/getnml2.py ADDED
@@ -0,0 +1,26 @@
1
+ import os
2
+ from subprocess import check_output as co
3
+
4
+ from omv.common.inout import inform
5
+ from omv.engines.utils.wdir import working_dir
6
+
7
+ install_root = os.environ["HOME"]
8
+
9
+ default_nml2_dir = os.path.join(install_root, "NeuroML2")
10
+
11
+
12
+ def is_nml2_installed():
13
+ history_file = os.path.join(default_nml2_dir, "HISTORY.md")
14
+ if os.path.exists(default_nml2_dir) and os.path.exists(history_file):
15
+ return True
16
+ else:
17
+ return False
18
+
19
+
20
+ def install_nml2():
21
+ with working_dir(install_root):
22
+ print(co(["git", "clone", "https://github.com/NeuroML/NeuroML2.git"]))
23
+ with working_dir(default_nml2_dir):
24
+ print(co(["git", "checkout", "development"]))
25
+
26
+ inform("Successfully cloned NeuroML2", indent=2, verbosity=1)
omv/engines/getnrn.py ADDED
@@ -0,0 +1,60 @@
1
+ import os
2
+ import sys
3
+ from subprocess import check_output as co
4
+ from distutils.core import run_setup
5
+ from omv.common.inout import inform
6
+ from omv.common.inout import pip_install
7
+
8
+ from omv.engines.utils.wdir import working_dir
9
+
10
+
11
+ def install_neuron(version):
12
+ if not version:
13
+ if sys.version_info.major == 3:
14
+ version = "8.1" # 8.1 works with pynn 0.10.1
15
+ else:
16
+ version = "7.6"
17
+
18
+ if sys.version_info.major == 3 and ("7.8" in version or "8." in version):
19
+ pip_install("neuron==%s" % version)
20
+ import neuron
21
+
22
+ inform("Successfully installed NEURON v%s using pip.." % version, indent=2)
23
+ else:
24
+ nrnpath = os.path.join(os.environ["HOME"], "neuron")
25
+
26
+ inform("Installing NEURON %s into %s" % (version, nrnpath), indent=1)
27
+ os.mkdir(nrnpath)
28
+ with working_dir(nrnpath):
29
+ nrn_url = (
30
+ "https://www.neuron.yale.edu/ftp/neuron/versions/v%s/nrn-%s.tar.gz"
31
+ % (version, version)
32
+ )
33
+ dl_file = "nrn-%s.tar.gz" % version
34
+
35
+ # See below re 7.8 on py2...
36
+ if "7.8" in version or "8.0" in version:
37
+ nrn_url = "https://github.com/neuronsimulator/nrn/archive/%s.tar.gz" % (
38
+ version
39
+ )
40
+ dl_file = "%s.tar.gz" % version
41
+ print(co(["wget", "-nv", nrn_url]))
42
+ print(co(["tar", "xzvf", dl_file]))
43
+ print(co(["mv", "nrn-%s" % version, "nrn"]))
44
+ os.chdir("nrn")
45
+
46
+ path = os.getcwd()
47
+ pyexec = sys.executable
48
+ # Needs to be updated if Neuron >=7.8...
49
+ co(
50
+ [
51
+ "./configure --prefix=%s --without-iv --with-nrnpython=%s"
52
+ % (path, pyexec)
53
+ ],
54
+ shell=True,
55
+ )
56
+ print(co(["make", "-j3"]))
57
+ print(co(["make", "install"]))
58
+
59
+ os.chdir("src/nrnpython")
60
+ run_setup("./setup.py", ["install"])
@@ -0,0 +1,11 @@
1
+ from omv.common.inout import inform, check_output
2
+
3
+
4
+ def install_octave():
5
+ inform("Installing Octave", indent=2, verbosity=1)
6
+
7
+ check_output(["apt-get", "install", "octave"])
8
+
9
+
10
+ if __name__ == "__main__":
11
+ install_octave()
@@ -0,0 +1,13 @@
1
+ from omv.common.inout import pip_install
2
+
3
+
4
+ def install_pylems():
5
+ try:
6
+ pip_install("pylems")
7
+ import lems
8
+
9
+ m = "Successfully installed pylems v%s..." % lems.__version__
10
+ except Exception as e:
11
+ m = "ERROR installing pylems: " + str(e)
12
+ finally:
13
+ print(m)
@@ -0,0 +1,14 @@
1
+ from omv.common.inout import pip_install, inform
2
+
3
+
4
+ def install_pynml(version=None):
5
+ try:
6
+ pip_install("pyneuroml", version)
7
+ import neuroml
8
+ import pyneuroml
9
+
10
+ m = "Successfully installed pyNeuroML v%s..." % pyneuroml.__version__
11
+ except Exception as e:
12
+ m = "ERROR installing pyNeuroML: " + str(e)
13
+ finally:
14
+ inform(m, indent=2)
omv/engines/getpynn.py ADDED
@@ -0,0 +1,40 @@
1
+ import os
2
+ from omv.common.inout import inform, check_output
3
+ from omv.common.inout import pip_install
4
+
5
+ from omv.engines.utils.wdir import working_dir
6
+
7
+
8
+ def install_pynn(version=None):
9
+ if not version:
10
+ version = "0.10.1"
11
+
12
+ try:
13
+ # pip_install('lazyarray') # This should ideally be automatically installed with PyNN...
14
+ # pip_install('neo>=0.11.0') # This should ideally be automatically installed with PyNN...
15
+
16
+ install_root = os.environ["HOME"]
17
+
18
+ pyNN_src = "PyNN_src"
19
+ with working_dir(install_root):
20
+ check_output(
21
+ ["git", "clone", "https://github.com/NeuralEnsemble/PyNN.git", pyNN_src]
22
+ )
23
+
24
+ path = os.path.join(install_root, pyNN_src)
25
+
26
+ with working_dir(path):
27
+ print(
28
+ check_output(["git", "checkout", version])
29
+ ) # neuroml branch has the latest NML2 import/export code!
30
+ # check_output(['git','checkout','master'])
31
+ # print(check_output(['python', 'setup.py', 'install']))
32
+ pip_install(".")
33
+ print(check_output(["pwd"]))
34
+ print("Finished attempting to install PyNN")
35
+ # import pyNN
36
+ m = "Successfully installed pyNN..."
37
+ except Exception as e:
38
+ m = "ERROR during install_pynn: %s" % e
39
+ finally:
40
+ inform(m)
omv/engines/jlems.py ADDED
@@ -0,0 +1,48 @@
1
+ import os
2
+ import subprocess as sp
3
+
4
+ from omv.common.inout import inform, trim_path, check_output, is_verbose
5
+ from omv.engines.engine import OMVEngine, EngineExecutionError
6
+
7
+
8
+ class JLemsEngine(OMVEngine):
9
+ name = "jLEMS"
10
+
11
+ @staticmethod
12
+ def is_installed():
13
+ ret = True
14
+ try:
15
+ ret_str = check_output(["lems", "-h"], verbosity=1)
16
+ ret = "v%s" % ret_str.split("-jar")[-1].split()[0].split("-")[1][:-4]
17
+ except OSError as err:
18
+ if is_verbose():
19
+ inform("Couldn't execute lems:", err, indent=1)
20
+ ret = False
21
+ return ret
22
+
23
+ def install(self, version):
24
+ from omv.engines.getjlems import install_jlems
25
+
26
+ home = os.environ["HOME"]
27
+ p = os.path.join(home, "jLEMS")
28
+ self.path = p
29
+ self.environment_vars = {"LEMS_HOME": p}
30
+ inform("Will fetch and install the latest jLEMS", indent=2)
31
+ install_jlems()
32
+ inform("Done...", indent=2)
33
+
34
+ def run(self):
35
+ try:
36
+ inform("Running file %s with jLEMS" % trim_path(self.modelpath), indent=1)
37
+ self.stdout = sp.check_output(
38
+ ["lems", self.modelpath, "-nogui"], cwd=os.path.dirname(self.modelpath)
39
+ )
40
+ self.returncode = 0
41
+ except sp.CalledProcessError as err:
42
+ self.returncode = err.returncode
43
+ self.stdout = err.output
44
+ raise EngineExecutionError
45
+ except Exception as err:
46
+ inform("Another error with running jLEMS:", err, indent=1)
47
+ self.returncode = -1
48
+ self.stdout = "???"