Skip to content

Commit

Permalink
More formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Sep 3, 2024
1 parent 6f73a75 commit 0f008ab
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 34 deletions.
1 change: 1 addition & 0 deletions c302/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ def load_data_reader(data_reader="SpreadsheetDataReader"):
reader (obj): The data reader object
"""
return importlib.import_module("c302.%s" % data_reader)
# return importlib.import_module("cect.%s" % data_reader)


def get_str_from_expnotation(num):
Expand Down
4 changes: 1 addition & 3 deletions c302/backers.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ def get_adopted_cell_names(root=os.path.dirname(os.path.abspath(__file__)) + "/d
info += "----------\n\n"
info += "Adopted name: **" + name + "**\n\n\n"
i = 0
search_file = open(
"../examples/c302_A_Full.nml", "r"
)
search_file = open("../examples/c302_A_Full.nml", "r")
for line in search_file:
i += 1
if 'tag="OpenWormBackerAssignedName" value="%s"' % name in line:
Expand Down
12 changes: 6 additions & 6 deletions c302/c302_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,13 @@ def generate_c302_info(nml_doc, verbose=False):

for c in cp.continuous_connection_instance_ws:
if "inh" in c.post_component:
cc_inh_conns[cp.presynaptic_population][
cp.postsynaptic_population
] = float(c.weight)
cc_inh_conns[cp.presynaptic_population][cp.postsynaptic_population] = (
float(c.weight)
)
else:
cc_exc_conns[cp.presynaptic_population][
cp.postsynaptic_population
] = float(c.weight)
cc_exc_conns[cp.presynaptic_population][cp.postsynaptic_population] = (
float(c.weight)
)

gj_conns = {}
for ep in net.electrical_projections:
Expand Down
54 changes: 29 additions & 25 deletions c302/c302_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,13 +483,13 @@ def generate_conn_matrix(

for c in cp.continuous_connection_instance_ws:
if "inh" in c.post_component:
cc_inh_conns[cp.presynaptic_population][
cp.postsynaptic_population
] = float(c.weight)
cc_inh_conns[cp.presynaptic_population][cp.postsynaptic_population] = (
float(c.weight)
)
else:
cc_exc_conns[cp.presynaptic_population][
cp.postsynaptic_population
] = float(c.weight)
cc_exc_conns[cp.presynaptic_population][cp.postsynaptic_population] = (
float(c.weight)
)

gj_conns = {}
for ep in net.electrical_projections:
Expand Down Expand Up @@ -546,13 +546,13 @@ def generate_conn_matrix(
"Exc Conn %s -> %s: %s" % (pre, post, cc_exc_conns[pre][post]), verbose
)
if post in all_neurons:
data_exc_n[
all_neurons.index(pre), all_neurons.index(post)
] = cc_exc_conns[pre][post]
data_exc_n[all_neurons.index(pre), all_neurons.index(post)] = (
cc_exc_conns[pre][post]
)
else:
data_exc_m[
all_neurons.index(pre), all_muscles.index(post)
] = cc_exc_conns[pre][post]
data_exc_m[all_neurons.index(pre), all_muscles.index(post)] = (
cc_exc_conns[pre][post]
)
if pre in all_muscles:
raise Exception("Unexpected...")

Expand All @@ -562,13 +562,13 @@ def generate_conn_matrix(
"Inh Conn %s -> %s: %s" % (pre, post, cc_inh_conns[pre][post]), verbose
)
if post in all_neurons:
data_inh_n[
all_neurons.index(pre), all_neurons.index(post)
] = cc_inh_conns[pre][post]
data_inh_n[all_neurons.index(pre), all_neurons.index(post)] = (
cc_inh_conns[pre][post]
)
else:
data_inh_m[
all_neurons.index(pre), all_muscles.index(post)
] = cc_inh_conns[pre][post]
data_inh_m[all_neurons.index(pre), all_muscles.index(post)] = (
cc_inh_conns[pre][post]
)
if pre in all_muscles:
raise Exception("Unexpected...")

Expand Down Expand Up @@ -652,13 +652,13 @@ def generate_conn_matrix(
and post in all_neurons
):
if pre in all_neurons:
data_n_m[
all_neurons.index(pre), all_muscles.index(post)
] = gj_conns[pre][post]
data_n_m[all_neurons.index(pre), all_muscles.index(post)] = (
gj_conns[pre][post]
)
else:
data_n_m[
all_muscles.index(pre), all_neurons.index(post)
] = gj_conns[pre][post]
data_n_m[all_muscles.index(pre), all_neurons.index(post)] = (
gj_conns[pre][post]
)
neuron_muscle = True
elif pre in all_muscles and post in all_muscles:
muscle_muscle = True
Expand Down Expand Up @@ -736,14 +736,18 @@ def generate_conn_matrix(
colormap = None

if "-phar" in sys.argv:
configs = ["c302_C0_Pharyngeal.net.nml"]
configs = ["c302_C1_Pharyngeal.net.nml"]

elif "-osc" in sys.argv:
configs = ["c302_C1_Oscillator.net.nml"]

elif "-soc" in sys.argv:
configs = ["c302_C1_Social.net.nml"]

elif "-syns" in sys.argv:
configs = ["c302_C1_Syns.net.nml"]
figsize = (10, 10)

elif "-musc" in sys.argv:
configs = ["c302_C1_Muscles.net.nml"]
figsize = (10, 10)
Expand Down
2 changes: 2 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
set -ex

pip install .

## Test readers

python -m c302.SpreadsheetDataReader
Expand Down

0 comments on commit 0f008ab

Please sign in to comment.