Skip to content

Commit a508aba

Browse files
committed
Merge branch 'master' into test_nest
2 parents 2ae6fd7 + af860ca commit a508aba

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+374
-251
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,17 @@ jobs:
2626
- jNeuroML_PyNN_NEURON
2727

2828
steps:
29-
- uses: actions/checkout@v2
29+
- uses: actions/checkout@v3
3030
- name: Set up Python ${{ matrix.python-version }}
31-
uses: actions/setup-python@v2
31+
uses: actions/setup-python@v3
3232
with:
3333
python-version: ${{ matrix.python-version }}
3434

3535
- name: Install OMV
3636
run: |
3737
pip install .
3838
pip install scipy sympy matplotlib cython pandas tables
39+
pip install 'numpy<=1.23.0' # temp fix for https://levelup.gitconnected.com/fix-attributeerror-module-numpy-has-no-attribute-float-d7d68c5a4971
3940
#sudo apt install octave
4041
4142
- name: Run OMV tests on engine ${{ matrix.engine }}

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,3 +121,4 @@ report*.txt
121121
*_moose.py
122122
/utilities/tests/*.gen.c
123123
/utilities/tests/*_eden.py
124+
arm64

README.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@
33

44
# OSB Model Validation
55

6-
Tools for automated model validation in [Open Source Brain](http://www.opensourcebrain.org) projects, which can also be used for testing model behaviour on many [simulation engines](https://github.com/OpenSourceBrain/osb-model-validation/tree/master/omv/engines) on your local machine and on [GitHub Actions](https://github.com/features/actions).
6+
Tools for automated model validation in [Open Source Brain](http://www.opensourcebrain.org) projects, which can also be used for testing model behaviour on many [simulation engines](https://github.com/OpenSourceBrain/osb-model-validation/tree/master/omv/engines) both:
7+
8+
- on your local machine when developing models
9+
- on [GitHub Actions](https://github.com/features/actions), to ensure tests pass on every commit.
710

811
To see this framework in action, click on some of the green buttons below:
912

omv/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '0.1.15'
1+
__version__ = '0.2.6'

omv/analyzers/utils/timeseries.py

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
21
from omv.common.inout import inform
32

3+
44
def detect_spikes(v, method='threshold', threshold=0.):
55
from numpy import flatnonzero, bitwise_and, roll, diff, array
66

@@ -27,10 +27,11 @@ def load_data_file(fname, columns=(0, 1), header_lines=0, scaling=1):
2727

2828
def load_spike_file(fname, format='ID_TIME', ids=0, scaling=1.0):
2929
from numpy import loadtxt
30-
ts = loadtxt(fname)
30+
ts = loadtxt(fname, skiprows=3) if format=='ID_TIME_NEST_DAT' else loadtxt(fname)
3131
spike_map = {}
3232
for l in ts:
33-
if format=='ID_TIME':
33+
#print('Interpreting: %s'%l)
34+
if format=='ID_TIME' or format=='ID_TIME_NEST_DAT':
3435
t = l[1]*scaling
3536
id = l[0]
3637
elif format=='TIME_ID':
@@ -45,8 +46,13 @@ def load_spike_file(fname, format='ID_TIME', ids=0, scaling=1.0):
4546

4647
def compare_arrays(arrays, tolerance):
4748
from numpy import allclose, array, max, abs, atleast_1d
48-
49-
a1, a2 = array(arrays)
49+
50+
# if array conversion fails, also fail test
51+
try:
52+
a1, a2 = array(arrays)
53+
except ValueError as e:
54+
print(e)
55+
return (False, 0)
5056

5157
if (hasattr(a1, '__len__') or hasattr(a2, '__len__')) and len(a1)!=len(a2): # Different lengths!!
5258
return (False, 0)

omv/common/inout.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ def inform(msg, pars=None, indent=0, underline=False,
6565
block = map(centralize, block)
6666
if indent:
6767
block = map(lambda l: __INDENT__ * indent + l, block)
68-
68+
6969
print('\n'.join(map(omvify, block)))
7070

7171

@@ -81,7 +81,7 @@ def trim_path(fname):
8181
return "."+fname[len(cwd):]
8282
else:
8383
return fname
84-
84+
8585
def check_output(cmds, cwd='.', shell=False, verbosity=0, env=None):
8686
inform("Running the commands: [%s] in (%s; cwd=%s; shell=%s; env=%s)"%(' '.join(cmds), cwd, os.getcwd(),shell,env), indent=2, verbosity=verbosity)
8787
joint_env = {}
@@ -90,14 +90,14 @@ def check_output(cmds, cwd='.', shell=False, verbosity=0, env=None):
9090
for k in os.environ:
9191
if not k in joint_env:
9292
joint_env[k] = os.environ[k]
93-
93+
9494
try:
95-
ret_string = sp.check_output(cmds, cwd=cwd, shell=shell, env=joint_env)
95+
ret_string = sp.check_output(cmds, cwd=cwd, shell=shell, env=joint_env, stderr=sp.STDOUT)
9696
inform("Commands: %s completed successfully"%(cmds), indent=2, verbosity=verbosity)
9797
if isinstance(ret_string, bytes):
9898
ret_string = ret_string.decode('utf-8') # For Python 3...
9999
return ret_string
100-
100+
101101
except sp.CalledProcessError as err:
102102
inform("Error running commands: %s in %s (return code: %s)"%(cmds, cwd,err.returncode), indent=2, verbosity=verbosity)
103103
inform("Error: %s"%(err), indent=2, verbosity=verbosity)
@@ -106,14 +106,19 @@ def check_output(cmds, cwd='.', shell=False, verbosity=0, env=None):
106106
inform("Error running commands: %s in (%s)!"%(cmds, cwd), indent=2, verbosity=verbosity)
107107
inform("Error: %s"%(err), indent=2, verbosity=verbosity)
108108
raise err
109-
110-
def pip_install(packages):
111-
112-
pip = 'pip3' if sys.version_info.major == 3 else 'pip'
109+
110+
def pip_install(packages, version=None):
111+
112+
pip = 'pip3' if sys.version_info.major == 3 else 'pip'
113113
cmds = [pip, 'install']
114114
if type(packages)==str:
115-
cmds.append(packages)
115+
if version ==None:
116+
cmds.append(packages)
117+
else:
118+
cmds.append('%s==%s'%(packages,version))
116119
else:
120+
raise Exception('pip_install will only install single packages...')
121+
'''
117122
for p in packages:
118-
cmds.append(p)
119-
print(check_output(cmds))
123+
cmds.append(p)'''
124+
print(check_output(cmds))

omv/engines/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
from omv.engines.pynnneuron import PyNNNRNEngine
3030
from omv.engines.pyneuron import PyNRNEngine
3131
#from omv.engines.pynnbrian1 import PyNNBrian1Engine
32+
from omv.engines.pynnbrian2 import PyNNBrian2Engine
3233
from omv.engines.pynnnest import PyNNNestEngine
3334
from omv.engines.pynnneuroml import PyNNNeuroMLEngine
3435
from omv.engines.octave import OctaveEngine

omv/engines/arbor_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class ArborEngine(OMVEngine):
1010
name = "Arbor"
1111

1212
@staticmethod
13-
def is_installed(version):
13+
def is_installed():
1414
ret = True
1515
try:
1616
import arbor

omv/engines/brian1.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class Brian1Engine(OMVEngine):
1212
python3_compatible = False
1313

1414
@staticmethod
15-
def is_installed(version):
15+
def is_installed():
1616
ret = False
1717
try:
1818
import brian

omv/engines/brian2_.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ class Brian2Engine(OMVEngine):
1010
name = "Brian2"
1111

1212
@staticmethod
13-
def is_installed(version):
13+
def is_installed():
1414
ret = True
1515
try:
1616
import brian2

0 commit comments

Comments
 (0)