Skip to content

Commit 8b2c91c

Browse files
authored
Merge pull request #28 from openworm/test_neuroml_pg
Reformatting python & restructured tests
2 parents 98eb27c + dfafd7a commit 8b2c91c

14 files changed

+188
-236
lines changed

.github/workflows/ci-make.yml

+6-14
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@ jobs:
2828
run: g++ -v
2929

3030
- name: Install dependencies (Ubuntu)
31-
run: sudo apt-get install -y nlohmann-json3-dev
31+
run: sudo apt-get install -y nlohmann-json3-dev tree
3232
if: ${{ contains(matrix.runs-on, 'ubuntu') }}
3333

3434
- name: Install dependencies (macOS)
35-
run: brew install nlohmann-json
35+
run: brew install nlohmann-json tree
3636
if: ${{ contains(matrix.runs-on, 'macos') }}
3737

3838
- name: Run C++ tests
@@ -52,18 +52,9 @@ jobs:
5252
run: |
5353
pip install OSBModelValidation
5454
pip install pyNeuroML
55-
pip install ruff
5655
pip install numpy matplotlib
57-
pip install ruff
58-
59-
60-
61-
- name: Test NeuroML
62-
run: |
63-
cd neuromlLocal
64-
./regenerate.sh
65-
66-
# make clean all # not yet...
56+
pip install ruff
57+
pip install neuron
6758
6859
- name: Test directly running main program
6960
run: |
@@ -80,11 +71,12 @@ jobs:
8071
export NEURON_HOME=$pythonLocation
8172
env
8273
83-
./test_all.sh
74+
./test_all.sh # also generated neuroml
8475
8576
git diff exampleRun/phenotype.dat
8677
8778
8879
- name: list generated files
8980
run: |
9081
ls -alth
82+
tree

.gitignore

+11
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,14 @@
2727
/neuromlLocal/Worm2DNet.gv.png
2828
/neuromlLocal/x86_64
2929
/neuromlLocal/testc302NervousSystem
30+
/arm64
31+
/x86_64
32+
/report.txt
33+
/exampleRun_nml
34+
/*.dat
35+
/exampleRun2
36+
/neuromlLocal/testc302SigSim/*.dat
37+
/neuromlLocal/testc302SigSim/arm64
38+
/neuromlLocal/testc302SigSim/x86_64
39+
/neuromlLocal/testc302SigSim/report.txt
40+
/neuromlLocal/testc302SigSim/testc302NervousSystem

Makefile

+1-1
Original file line numberDiff line numberDiff line change
@@ -61,4 +61,4 @@ tests2: tests2.o NervousSystem.o random.o jsonUtils.o utils.o
6161
g++ $(CXXFLAGS) $(LDFLAGS) -pthread -o tests2 tests2.o NervousSystem.o random.o utils.o jsonUtils.o $(LIBS)
6262

6363
clean:
64-
rm -f *.o main tests tests2
64+
rm -f *.o neuromlLocal/*.o main tests tests2

load_data.py

+9-8
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,12 @@
55

66
import numpy as np
77
from matplotlib import pyplot as plt
8-
#import random
8+
9+
# import random
910
import helper_funcs as hf
1011

1112

12-
def reload_single_run(show_plot=True):
13+
def reload_single_run(show_plot=True, verbose=False):
1314
N_muscles = 24 # Number of muscles alongside the body
1415
N_units = 10 # Number of neural units in VNC
1516
N_neuronsperunit = 6 # Number of neurons in a VNC neural unit (6 neurons)
@@ -36,7 +37,7 @@ def reload_single_run(show_plot=True):
3637
act_data[0], act_data[i], label="SR %i" % (i - offset), linewidth=0.5
3738
)
3839
axs[0, 0].xaxis.set_ticklabels([])
39-
plt.legend()
40+
# plt.legend()
4041

4142
axs[0, 1].imshow(sr, aspect="auto", interpolation="nearest")
4243
axs[0, 1].xaxis.set_ticklabels([])
@@ -49,7 +50,7 @@ def reload_single_run(show_plot=True):
4950
act_data[0], act_data[i], label="Neu %i" % (i - offset), linewidth=0.5
5051
)
5152
axs[1, 0].xaxis.set_ticklabels([])
52-
plt.legend()
53+
# plt.legend()
5354

5455
neu = act_data[offset : N_neurons + offset]
5556
axs[1, 1].imshow(neu, aspect="auto", interpolation="nearest")
@@ -63,7 +64,7 @@ def reload_single_run(show_plot=True):
6364
act_data[0], act_data[i], label="Mu %i" % (i - offset), linewidth=0.5
6465
)
6566
axs[2, 0].xaxis.set_ticklabels([])
66-
plt.legend()
67+
# plt.legend()
6768

6869
mus = act_data[offset : N_muscles + offset]
6970
axs[2, 1].imshow(mus, aspect="auto", interpolation="nearest")
@@ -92,14 +93,14 @@ def reload_single_run(show_plot=True):
9293
f = float(t) / tmax
9394

9495
color = "#%02x%02x00" % (int(0xFF * (f)), int(0xFF * (1 - f) * 0.8))
95-
#color2 = "#%06x" % random.randint(0, 0xFFFFFF)
96+
# color2 = "#%06x" % random.randint(0, 0xFFFFFF)
9697

9798
point_start = 1
9899
for i in range(point_start, 50):
99100
x = body_data[i * 3 + 1][t]
100101
y = body_data[i * 3 + 2][t]
101-
#y1 = body_data[i * 3 + 2][t]
102-
if i == 1:
102+
# y1 = body_data[i * 3 + 2][t]
103+
if i == 1 and verbose:
103104
print(
104105
"%s + Plotting %i at t=%s (%s,%s), %s"
105106
% ("\n" if i == point_start else "", i, t, x, y, color)

neuromlLocal/Worm2D_neuroml.py

-71
This file was deleted.

neuromlLocal/build_network.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77

88
import neuroml.writers as writers
99
from neuroml import (
10-
ExplicitInput,
1110
Network,
1211
NeuroMLDocument,
1312
Population,
@@ -16,13 +15,13 @@
1615
ContinuousProjection,
1716
ContinuousConnectionInstanceW,
1817
ElectricalConnectionInstanceW,
19-
IncludeType,
2018
Property,
2119
Instance,
2220
Location,
2321
InputW,
2422
InputList,
2523
)
24+
# from neuroml import IncludeType
2625

2726
import utils
2827

neuromlLocal/clean.sh

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/bin/bash
2+
set -e
3+
4+
rm -rf arm64 x86_64 __pycache__
5+
6+
mv *.dat *.mod *_nrn.py *gv* report.txt /tmp || true

neuromlLocal/main_sim.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ def run(self, skip_to_time=-1):
196196

197197
self.ns.advance()
198198

199-
# print_("< Current NEURON time: %s ms" % self.h.t)
199+
print_("< Current NEURON time: %s ms" % self.h.t)
200200

201201
# values = []
202202
pop_list = [

neuromlLocal/regenerate.sh

+7
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,16 @@
11
#!/bin/bash
22
set -ex
33

4+
./clean.sh
5+
46
ruff format *py
57

68
python regenerate.py
79

810
omv all -V
911

12+
cd testc302SigSim
13+
make clean all
14+
./testc302NervousSystem
15+
cd ..
16+

0 commit comments

Comments
 (0)