Skip to content

Commit b27aa23

Browse files
authored
Merge pull request #99 from openworm/development
To v0.9.1
2 parents ee1f681 + 25ab227 commit b27aa23

686 files changed

Lines changed: 528 additions & 341 deletions

File tree

Some content is hidden

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

.github/workflows/non_omv.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -65,6 +65,7 @@ jobs:
6565
6666
- name: Run test script
6767
run: |
68+
pip install ruff
6869
./test.sh
6970
7071
- name: Final version info

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,3 +109,4 @@ arm64
109109
/examples/parametersweep/IClamp_GenericNeuronCellX__lems.xml
110110
/examples/parametersweep/LEMS_SimCanonical_X.png
111111
/examples/parametersweep/Canonical_X__lems.xml
112+
/examples/parametersweep/average_last_1percent_GenericNeuronCellX.png

c302/CompareMain.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,13 +118,13 @@ def getColumnsXls(fileIn):
118118
# print(indexName[c])
119119
while curr_row < num_rows:
120120
curr_row += 1
121-
row = worksheet.row(curr_row)
121+
# row = worksheet.row(curr_row)
122122
# print('Row:', curr_row)
123123
curr_cell = -1
124124
while curr_cell < num_cells:
125125
curr_cell += 1
126126
# Cell Types: 0=Empty, 1=Text, 2=Number, 3=Date, 4=Boolean, 5=Error, 6=Blank
127-
cell_type = worksheet.cell_type(curr_row, curr_cell)
127+
# cell_type = worksheet.cell_type(curr_row, curr_cell)
128128
cell_value = str(worksheet.cell_value(curr_row, curr_cell))
129129
# print(' ', cell_type, ':', cell_value)
130130
cols[indexName[curr_cell]] += [cell_value]
@@ -256,10 +256,11 @@ def matchLists(cols1, cols2, indexName1, indexName2):
256256
# 'R', 'Rp', 'S', 'Sp' map to 'Send'.
257257
# 'NMJ' does not map.
258258
def typeMapping(cols1, cols2, indexName1, indexName2):
259-
list1 = ["GapJunction", "Send"]
260-
list2 = ["EJ", "NMJ", "R", "Rp", "S", "Sp"]
261-
type1 = cols1[indexName1[2]]
262-
type2 = cols2[indexName2[2]]
259+
# list1 = ["GapJunction", "Send"]
260+
# list2 = ["EJ", "NMJ", "R", "Rp", "S", "Sp"]
261+
# type1 = cols1[indexName1[2]]
262+
# type2 = cols2[indexName2[2]]
263+
pass
263264

264265

265266
if __name__ == "__main__":

c302/NeuroMLUtilities.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ def fract(a, b, f):
4343

4444

4545
if __name__ == "__main__":
46-
from SpreadsheetDataReader import read_data, read_muscle_data
46+
# from SpreadsheetDataReader import read_data, read_muscle_data
4747
from WormNeuroAtlasReader import read_data, read_muscle_data
4848

4949
cells, neuron_conns = read_data(include_nonconnected_cells=True)

c302/OpenWormReader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
from owmeta.neuron import Neuron
1212
from owmeta.muscle import BodyWallMuscle
1313
from owmeta.worm import Worm
14-
except:
14+
except Exception:
1515
print("owmeta not installed! Cannot run OpenWormReader")
1616
exit()
1717

@@ -41,7 +41,7 @@ def read_data(self, include_nonconnected_cells=False):
4141

4242
try:
4343
cell_names, pre, post, conns = self._read_connections("neuron")
44-
except:
44+
except Exception:
4545
print(
4646
"\nProblem loading connections via owmeta! The package is installed however. You may need to try running:"
4747
+ "\n\n owm bundle remote --user add ow 'https://raw.githubusercontent.com/openworm/owmeta-bundles/master/index.json'\n"
@@ -158,7 +158,7 @@ def format_muscle_name(muscle_name):
158158
exit()
159159

160160
conn_map_OWR = {}
161-
for c in conns:
161+
for c in neuron_conns:
162162
conn_map_OWR[c.short().lower()] = c
163163

164164
from c302.UpdatedSpreadsheetDataReader import read_data as read_data_usr

c302/SpreadsheetDataReader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@
1212

1313
from c302.ConnectomeReader import ConnectionInfo
1414
from c302.ConnectomeReader import analyse_connections
15+
from c302 import print_
1516

1617
from xlrd import open_workbook
1718
import os
1819

1920
spreadsheet_location = os.path.dirname(os.path.abspath(__file__)) + "/data/"
2021

21-
from c302 import print_
2222

2323
READER_DESCRIPTION = (
2424
"""Data extracted from CElegansNeuronTables.xls for neuronal connectivity"""

c302/__init__.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
import neuroml.writers as writers
2424
import neuroml.loaders as loaders
2525

26-
import c302.bioparameters
26+
# import c302.bioparameters
2727

2828
import airspeed
2929

@@ -39,6 +39,7 @@
3939

4040
import json
4141

42+
4243
import collections
4344

4445
try:
@@ -51,13 +52,14 @@
5152
from owmeta.muscle import Muscle
5253

5354
owmeta_installed = True
54-
except:
55+
56+
except Exception:
5557
print("owmeta not installed! Proceeding anyway...")
5658
owmeta_installed = False
5759

5860
try:
5961
from urllib2 import URLError # Python 2
60-
except:
62+
except Exception:
6163
from urllib.error import URLError # Python 3
6264

6365
logging.basicConfig()
@@ -519,7 +521,7 @@ def _get_cell_info(bnd, cells):
519521
all_muscle_info = collections.OrderedDict()
520522

521523
if bnd is None:
522-
if cached_owmeta_data == None:
524+
if cached_owmeta_data is None:
523525
print_("Loading owmeta cached data from: %s" % OWMETA_CACHED_DATA_FILE)
524526
with open(OWMETA_CACHED_DATA_FILE) as f:
525527
cached_owmeta_data = json.load(f)
@@ -1730,10 +1732,15 @@ def parse_dict_arg(dict_arg):
17301732

17311733

17321734
def main():
1735+
import importlib
1736+
17331737
print("Starting c302 v%s..." % __version__)
17341738
args = process_args()
17351739

1736-
exec("from c302.%s import ParameterisedModel" % args.parameters, globals())
1740+
ParameterisedModel = getattr(
1741+
importlib.import_module("c302.%s" % args.parameters),
1742+
"ParameterisedModel",
1743+
)
17371744
params = ParameterisedModel()
17381745
generate(
17391746
args.reference,

c302/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = "0.9.0"
1+
__version__ = "0.9.1"

c302/analyse.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
import sys
22
import matplotlib.pyplot as plt
3-
from pylab import *
43

54

65
fig = plt.figure(facecolor="#FFFFFF", edgecolor="#FFFFFF")

c302/c302_FW.py

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import sys
22
import os
3+
import importlib
34

45
sys.path.insert(0, os.path.abspath("."))
56

@@ -21,7 +22,10 @@ def setup(
2122
verbose=True,
2223
config_param_overrides={},
2324
):
24-
exec("from c302.parameters_%s import ParameterisedModel" % parameter_set, globals())
25+
ParameterisedModel = getattr(
26+
importlib.import_module("c302.parameters_%s" % parameter_set),
27+
"ParameterisedModel",
28+
)
2529
params = ParameterisedModel()
2630

2731
params.set_bioparameter(
@@ -34,13 +38,14 @@ def setup(
3438
"unphysiological_offset_current_dur", "2000 ms", "Testing TapWithdrawal", "0"
3539
)
3640

41+
"""
3742
VA_motors = ["VA%s" % c for c in range_incl(1, 12)]
38-
VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
3943
DA_motors = ["DA%s" % c for c in range_incl(1, 9)]
44+
AS_motors = ["AS%s" % c for c in range_incl(1, 11)]"""
45+
VB_motors = ["VB%s" % c for c in range_incl(1, 11)]
4046
DB_motors = ["DB%s" % c for c in range_incl(1, 7)]
4147
DD_motors = ["DD%s" % c for c in range_incl(1, 6)]
4248
VD_motors = ["VD%s" % c for c in range_incl(1, 13)]
43-
AS_motors = ["AS%s" % c for c in range_incl(1, 11)]
4449

4550
cells = list(["AVBL", "AVBR"] + DB_motors + VD_motors + VB_motors + DD_motors)
4651

0 commit comments

Comments
 (0)