Skip to content

Commit

Permalink
Merge pull request #96 from openworm/development
Browse files Browse the repository at this point in the history
 To v0.9.0
  • Loading branch information
pgleeson authored Jan 14, 2025
2 parents 8f619b8 + 8aa97bb commit ee1f681
Show file tree
Hide file tree
Showing 174 changed files with 763 additions and 673 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -106,3 +106,6 @@ arm64
/examples/test/images/c302_C1_Social.net.nml
/examples/test/images/c302_C1_Syns.net.nml
*ken.sh
/examples/parametersweep/IClamp_GenericNeuronCellX__lems.xml
/examples/parametersweep/LEMS_SimCanonical_X.png
/examples/parametersweep/Canonical_X__lems.xml
8 changes: 4 additions & 4 deletions c302/ConnectomeReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -507,7 +507,7 @@ def check_neurons(cells):
not_in_preferred = []
missing_preferred = [n for n in PREFERRED_NEURON_NAMES]
for c in cells:
if not c in PREFERRED_NEURON_NAMES:
if c not in PREFERRED_NEURON_NAMES:
not_in_preferred.append(c)
else:
preferred.append(c)
Expand Down Expand Up @@ -539,7 +539,7 @@ def analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_co
nts_tot = {}
for c in neuron_conns:
nt = c.synclass
if not nt in nts:
if nt not in nts:
nts[nt] = 0
nts_tot[nt] = 0
nts[nt] += 1
Expand All @@ -558,7 +558,7 @@ def analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_co
print_("Found %s muscles: %s\n" % (len(muscles), sorted(muscles)))
not_in_preferred = []
for m in muscles:
if not m in PREFERRED_MUSCLE_NAMES:
if m not in PREFERRED_MUSCLE_NAMES:
not_in_preferred.append(m)

print_(
Expand Down Expand Up @@ -586,7 +586,7 @@ def analyse_connections(cells, neuron_conns, neurons2muscles, muscles, muscle_co
nts_tot = {}
for c in muscle_conns:
nt = c.synclass
if not nt in nts:
if nt not in nts:
nts[nt] = 0
nts_tot[nt] = 0
nts[nt] += 1
Expand Down
3 changes: 0 additions & 3 deletions c302/Cook2019DataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,9 @@

############################################################

import csv

from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
from c302.ConnectomeReader import convert_to_preferred_muscle_name
from c302.ConnectomeReader import is_neuron
from c302.ConnectomeReader import is_body_wall_muscle
from c302.ConnectomeReader import remove_leading_index_zero

Expand Down
1 change: 0 additions & 1 deletion c302/NeuroML2/printNML2Info.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import neuroml

import neuroml.loaders as loaders

Expand Down
5 changes: 0 additions & 5 deletions c302/NeuroMLUtilities.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,7 @@

############################################################

from c302 import print_

from c302.ConnectomeReader import PREFERRED_NEURON_NAMES
from c302.ConnectomeReader import PREFERRED_MUSCLE_NAMES

from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections


Expand Down
4 changes: 2 additions & 2 deletions c302/OpenWormReader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import logging
import re

from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
from c302 import print_, MUSCLE_RE

try:
Expand Down
4 changes: 2 additions & 2 deletions c302/SpreadsheetDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@
############################################################


from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections

from xlrd import open_workbook
import os
Expand Down
4 changes: 2 additions & 2 deletions c302/UpdatedSpreadsheetDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@

import csv

from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
import os

from c302 import print_
Expand Down
4 changes: 2 additions & 2 deletions c302/UpdatedSpreadsheetDataReader2.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@
import csv


from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
import os

from c302 import print_
Expand Down
6 changes: 3 additions & 3 deletions c302/VarshneyDataReader.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
from openpyxl import load_workbook

import os
Expand Down Expand Up @@ -70,7 +70,7 @@ def read_muscle_data():
conns.append(ConnectionInfo(pre, post, num, syntype, synclass))
if pre not in neurons:
neurons.append(pre)
if not post in muscles:
if post not in muscles:
muscles.append(post)

return neurons, muscles, conns
Expand Down
1 change: 0 additions & 1 deletion c302/W_SpreadsheetDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from c302.ConnectomeReader import analyse_connections
from c302.ConnectomeReader import convert_to_preferred_muscle_name
from c302.ConnectomeReader import is_neuron
from c302.ConnectomeReader import is_body_wall_muscle

from openpyxl import load_workbook
import os
Expand Down
1 change: 0 additions & 1 deletion c302/WhiteDataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@

############################################################

import csv

from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
Expand Down
2 changes: 1 addition & 1 deletion c302/White_A.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from c302.WhiteDataReader import White_A

from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import analyse_connections

read_data = White_A.read_data
read_muscle_data = White_A.read_muscle_data
Expand Down
2 changes: 1 addition & 1 deletion c302/White_L4.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from c302.WhiteDataReader import White_L4

from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import analyse_connections

read_data = White_L4.read_data
read_muscle_data = White_L4.read_muscle_data
Expand Down
2 changes: 1 addition & 1 deletion c302/White_whole.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

from c302.WhiteDataReader import White_whole

from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import analyse_connections

read_data = White_whole.read_data
read_muscle_data = White_whole.read_muscle_data
Expand Down
2 changes: 1 addition & 1 deletion c302/WitvlietDataReader1.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Should be tidied up.

from c302.W_SpreadsheetDataReader import WitvlietDataReader
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import analyse_connections

wdr = WitvlietDataReader("witvliet_2020_7.xlsx")

Expand Down
2 changes: 1 addition & 1 deletion c302/WitvlietDataReader2.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# Should be tidied up.

from c302.W_SpreadsheetDataReader import WitvlietDataReader
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import analyse_connections

wdr = WitvlietDataReader("witvliet_2020_8.xlsx")

Expand Down
9 changes: 4 additions & 5 deletions c302/WormNeuroAtlasReader.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import logging
import re

from c302.NeuroMLUtilities import ConnectionInfo
from c302.NeuroMLUtilities import analyse_connections
from c302.ConnectomeReader import ConnectionInfo
from c302.ConnectomeReader import analyse_connections
from c302 import print_

import wormneuroatlas as wa
Expand Down Expand Up @@ -93,9 +92,9 @@ def read_data(self, include_nonconnected_cells=False):
connection = True

if connection:
if not pre in connected_cells:
if pre not in connected_cells:
connected_cells.append(pre)
if not post in connected_cells:
if post not in connected_cells:
connected_cells.append(post)

if include_nonconnected_cells:
Expand Down
2 changes: 1 addition & 1 deletion c302/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = "0.8.1"
__version__ = "0.9.0"
1 change: 0 additions & 1 deletion c302/analyse.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
import sys
import matplotlib.pyplot as plt
from pylab import *
from matplotlib.backends.backend_agg import FigureCanvasAgg as FigureCanvas


fig = plt.figure(facecolor="#FFFFFF", edgecolor="#FFFFFF")
Expand Down
4 changes: 2 additions & 2 deletions c302/backers.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
This method reads a generated list of cells vs. names as assigned by OpenWorm backers
This method reads a generated list of cells vs. names as assigned by OpenWorm backers
This information will eventually be moved to owmeta/elsewhere...
This information will eventually be moved to owmeta/elsewhere...
"""

import os
Expand Down
1 change: 0 additions & 1 deletion c302/c302_IClampMuscle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import c302
import sys
import neuroml.writers as writers


def setup(
Expand Down
4 changes: 2 additions & 2 deletions c302/c302_TapWithdrawal.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""
Tap-Withdrawal circuit still under development - it does not produce the correct behavior!
Tap-Withdrawal circuit still under development - it does not produce the correct behavior!
"""

import c302
Expand Down
1 change: 0 additions & 1 deletion c302/c302_TargetMuscle.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import c302
import sys
import neuroml.writers as writers


def setup(
Expand Down
33 changes: 13 additions & 20 deletions c302/c302_info.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
import sys
import os
from pyneuroml import pynml
import matplotlib.pyplot as plt
import numpy as np

import c302


Expand All @@ -15,34 +9,34 @@ def generate_c302_info(nml_doc, verbose=False):
all_cells = []

for cp in net.continuous_projections:
if not cp.presynaptic_population in cc_exc_conns.keys():
if cp.presynaptic_population not in cc_exc_conns.keys():
cc_exc_conns[cp.presynaptic_population] = {}
if not cp.presynaptic_population in cc_inh_conns.keys():
if cp.presynaptic_population not in cc_inh_conns.keys():
cc_inh_conns[cp.presynaptic_population] = {}

if not cp.presynaptic_population in all_cells:
if cp.presynaptic_population not in all_cells:
all_cells.append(cp.presynaptic_population)
if not cp.postsynaptic_population in all_cells:
if cp.postsynaptic_population not in all_cells:
all_cells.append(cp.postsynaptic_population)

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:
if not ep.presynaptic_population in gj_conns.keys():
if ep.presynaptic_population not in gj_conns.keys():
gj_conns[ep.presynaptic_population] = {}

if not ep.presynaptic_population in all_cells:
if ep.presynaptic_population not in all_cells:
all_cells.append(ep.presynaptic_population)
if not ep.postsynaptic_population in all_cells:
if ep.postsynaptic_population not in all_cells:
all_cells.append(ep.postsynaptic_population)

for e in ep.electrical_connection_instance_ws:
Expand All @@ -56,7 +50,6 @@ def generate_c302_info(nml_doc, verbose=False):
from PyOpenWorm import (
connect as pyow_connect,
__version__ as pyow_version,
ConnectionFailError,
)

pow_conn = pyow_connect("./pyopenworm.conf")
Expand Down
Loading

0 comments on commit ee1f681

Please sign in to comment.