From 0f008ab93382d74103badd888ef35d51a271ce0c Mon Sep 17 00:00:00 2001
From: pgleeson
Date: Tue, 3 Sep 2024 10:44:12 +0100
Subject: [PATCH] More formatting
---
c302/__init__.py | 1 +
c302/backers.py | 4 +---
c302/c302_info.py | 12 +++++------
c302/c302_utils.py | 54 +++++++++++++++++++++++++---------------------
test.sh | 2 ++
5 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/c302/__init__.py b/c302/__init__.py
index 1c4171c6..7fd9add6 100755
--- a/c302/__init__.py
+++ b/c302/__init__.py
@@ -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):
diff --git a/c302/backers.py b/c302/backers.py
index 7635a0a9..5556fa9a 100644
--- a/c302/backers.py
+++ b/c302/backers.py
@@ -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:
diff --git a/c302/c302_info.py b/c302/c302_info.py
index e6ad0cbe..550a78d7 100644
--- a/c302/c302_info.py
+++ b/c302/c302_info.py
@@ -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:
diff --git a/c302/c302_utils.py b/c302/c302_utils.py
index d50b1927..bc2a0d4f 100644
--- a/c302/c302_utils.py
+++ b/c302/c302_utils.py
@@ -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:
@@ -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...")
@@ -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...")
@@ -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
@@ -736,7 +736,7 @@ 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"]
@@ -744,6 +744,10 @@ def generate_conn_matrix(
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)
diff --git a/test.sh b/test.sh
index f6919554..367452f6 100755
--- a/test.sh
+++ b/test.sh
@@ -1,5 +1,7 @@
set -ex
+pip install .
+
## Test readers
python -m c302.SpreadsheetDataReader