Skip to content

Commit

Permalink
Added readmes for matrices
Browse files Browse the repository at this point in the history
  • Loading branch information
pgleeson committed Feb 27, 2024
1 parent 459cf41 commit fee6bf9
Show file tree
Hide file tree
Showing 76 changed files with 665 additions and 87 deletions.
10 changes: 10 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,13 @@ arm64
/examples/test/images/c302_C1_Oscillator.net.nml
/examples/test/images/LEMS_c302_C1_Oscillator.xml
/c302/VarshneyDataReader2.py
/
/examples/test/images/LEMS_c302_C1_Full.xml
/examples/test/images/LEMS_c302_C1_Muscles.xml
/examples/test/images/LEMS_c302_C1_Social.xml
/examples/test/images/LEMS_c302_C1_Syns.xml
/examples/test/images/c302_C1_Full.net.nml
/examples/test/images/c302_C1_Muscles.net.nml
/examples/test/images/c302_C1_Pharyngeal.net.nml
/examples/test/images/c302_C1_Social.net.nml
/examples/test/images/c302_C1_Syns.net.nml
15 changes: 8 additions & 7 deletions c302/Cook2019DataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ def get_synclass(cell, syntype):
return "GABA"
return "Acetylcholine"

class Cook2019DataReaderReader():
class Cook2019DataReader():

verbose = False

def __init__(self):

Expand All @@ -69,12 +71,12 @@ def __init__(self):
for i in pre_range[conn_type]:
self.pre_cells[conn_type].append(sheet['C%i'%i].value)

print(' - Pre cells for %s (%i):\n%s'%(conn_type, len(self.pre_cells[conn_type]), self.pre_cells[conn_type]))
if self.verbose: print(' - Pre cells for %s (%i):\n%s'%(conn_type, len(self.pre_cells[conn_type]), self.pre_cells[conn_type]))

for i in post_range[conn_type]:
self.post_cells[conn_type].append(sheet.cell(row=3, column=i).value)

print(' - Post cells for %s (%i):\n%s'%(conn_type, len(self.post_cells[conn_type]), self.post_cells[conn_type]))
if self.verbose: print(' - Post cells for %s (%i):\n%s'%(conn_type, len(self.post_cells[conn_type]), self.post_cells[conn_type]))

self.conn_nums[conn_type] = np.zeros([len(self.pre_cells[conn_type]),len(self.post_cells[conn_type])], dtype=int)

Expand All @@ -87,8 +89,7 @@ def __init__(self):
if val is not None:
self.conn_nums[conn_type][i,j] = int(val)

print()
print(' - Conns for %s (%s):\n%s'%(conn_type, self.conn_nums[conn_type].shape, self.conn_nums[conn_type]))
if self.verbose: print(' - Conns for %s (%s):\n%s'%(conn_type, self.conn_nums[conn_type].shape, self.conn_nums[conn_type]))



Expand Down Expand Up @@ -167,14 +168,14 @@ def read_muscle_data(self):
elif is_body_wall_muscle(pre) and pre not in muscles:
muscles.append(pre)
if post not in muscles:
muscles.append(post)'''
muscles.append(post)'''

return neurons, muscles, conns


def main():

cdr = Cook2019DataReaderReader()
cdr = Cook2019DataReader()
read_data = cdr.read_data
read_muscle_data = cdr.read_muscle_data

Expand Down
19 changes: 19 additions & 0 deletions c302/Cook2019HermReader.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Temporary class to allow this to be used in comparison notebook.
# Should be tidied up.

from c302.Cook2019DataReader import Cook2019DataReader

from c302.ConnectomeReader import analyse_connections

cdr = Cook2019DataReader()
read_data = cdr.read_data
read_muscle_data = cdr.read_muscle_data

def main1():
cells, neuron_conns = read_data(include_nonconnected_cells=True)
neurons2muscles, muscles, muscle_conns = read_muscle_data()
analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_conns)


if __name__ == '__main__':
main1()
2 changes: 1 addition & 1 deletion c302/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -465,7 +465,7 @@ def _get_cell_info(bnd, cells):
for name in fixed_up_names:
cell = next(ctx(Cell).query(name=name).load(), None)
if cell is None:
print_("No matching cell for %s" % name)
#print_("No matching cell for %s" % name)
continue

normalized_name = cell.name()
Expand Down
14 changes: 13 additions & 1 deletion c302/c302_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ def generate_conn_matrix(nml_doc, save_fig_dir=None, verbose=False, figsize=defa
configs = ['c302_C0_Muscles.net.nml']
configs = ['c302_C0_Syns.net.nml', 'c302_C0_Social.net.nml','c302_C0_Muscles.net.nml','c302_C0_Pharyngeal.net.nml','c302_C0_Oscillator.net.nml','c302_C0_Full.net.nml']

figsize=(6.4,4.8)

if '-phar' in sys.argv:

configs = ['c302_C0_Pharyngeal.net.nml']
Expand All @@ -585,11 +587,21 @@ def generate_conn_matrix(nml_doc, save_fig_dir=None, verbose=False, figsize=defa

configs = ['c302_C1_Oscillator.net.nml']

elif '-musc' in sys.argv:

configs = ['c302_C1_Muscles.net.nml']
figsize=(10,10)

elif '-full' in sys.argv:

configs = ['c302_C1_Full.net.nml']
figsize=(10,10)

for c in configs:

nml_doc = read_neuroml2_file('examples/%s'%c)

generate_conn_matrix(nml_doc, save_fig_dir='./examples/summary/images', figsize=(6.4,4.8))
generate_conn_matrix(nml_doc, save_fig_dir='./examples/summary/images', figsize=figsize)

if not '-nogui' in sys.argv:
plt.show()
Loading

0 comments on commit fee6bf9

Please sign in to comment.