Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions examples/Example6.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,6 @@ def generate(ref="Example6_PyNN", add_inputs=True):
"L6": {"E": 14395, "I": 2948},
}

scale = 0.1

pops = []
input_pops = []
pop_dict = {}
Expand Down
6 changes: 3 additions & 3 deletions neuromllite/BBPConnectomeReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,10 @@ def parse_group(self, g):
self.pre_pop = node._v_name.replace("-", "_")
self.post_pop = None
# print("Conn %s -> ?"%(self.pre_pop))
elif self.pre_pop != None and self.post_pop == None:
elif self.pre_pop is not None and self.post_pop is None:
self.post_pop = node._v_name.replace("-", "_")
# print("Conn2 %s -> %s"%(self.pre_pop,self.post_pop))
elif self.pre_pop != None and self.post_pop != None:
elif self.pre_pop is not None and self.post_pop is not None:
# print("Conn3 %s -> %s"%(self.pre_pop,self.post_pop))
pass

Expand Down Expand Up @@ -192,7 +192,7 @@ def parse_dataset(self, d):
)

# Projection
elif self.pre_pop != None and self.post_pop != None:
elif self.pre_pop is not None and self.post_pop is not None:
proj_id = "Proj__%s__%s" % (self.pre_pop, self.post_pop)
synapse = "gaba"
if (
Expand Down
4 changes: 2 additions & 2 deletions neuromllite/ConnectivityHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def _scale_individual_weight(self, weight, projName):

if self.scale_by_post_pop_cond:
gbase_nS = self._get_gbase_nS(projName)
if gbase_nS != None:
if gbase_nS is not None:
weight *= gbase_nS

if not orig_weight == weight:
Expand All @@ -138,7 +138,7 @@ def _scale_population_weight(self, weight, projName):

if self.scale_by_post_pop_cond:
gbase_nS = self._get_gbase_nS(projName)
if gbase_nS != None:
if gbase_nS is not None:
weight *= gbase_nS

if not orig_weight == weight:
Expand Down
4 changes: 2 additions & 2 deletions neuromllite/MatrixHandler.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def finalise_document(self):
self._get_conn_label(matrix_number_conns, pclass)
][pre_pop_i][post_pop_i] += abs(self.proj_conns[projName])

cond_scale = gbase_nS if gbase_nS != None else 1.0
cond_scale = gbase_nS if gbase_nS is not None else 1.0
tot_scaled = (
abs(self.proj_tot_weight[projName]) * cond_scale / num_post
)
Expand Down Expand Up @@ -489,7 +489,7 @@ def handle_projection(
if synapse_obj:
self.proj_syn_objs[projName] = synapse_obj
erev = self.get_reversal_potential_mV(synapse_obj)
if erev != None and erev < self.CUTOFF_INH_SYN_MV:
if erev is not None and erev < self.CUTOFF_INH_SYN_MV:
proj_type = "inhibitory"

if self.nl_network:
Expand Down
32 changes: 15 additions & 17 deletions neuromllite/NetworkGenerator.py
Original file line number Diff line number Diff line change
Expand Up @@ -594,7 +594,7 @@ def _extract_pynn_components_to_neuroml(nl_model, nml_doc=None):
cell.id = c.id

for s in nl_model.synapses:
if nml_doc.get_by_id(s.id) == None:
if nml_doc.get_by_id(s.id) is None:
if s.pynn_synapse_type and s.pynn_receptor_type:
import neuroml

Expand Down Expand Up @@ -720,7 +720,7 @@ def generate_neuroml2_from_network(
if incl not in nml_doc.includes:
nml_doc.includes.append(incl)

if nml_doc.get_by_id(i.id) == None:
if nml_doc.get_by_id(i.id) is None:
if i.neuroml2_source_file:
incl = neuroml.IncludeType(
locate_file(i.neuroml2_source_file, base_dir)
Expand Down Expand Up @@ -768,7 +768,7 @@ def generate_neuroml2_from_network(
if p.component == c.id:
pass

if nml_doc.get_by_id(c.id) == None: # cell (of any type) is not in nml_doc
if nml_doc.get_by_id(c.id) is None: # cell (of any type) is not in nml_doc
if incl not in nml_doc.includes:
nml_doc.includes.append(incl)

Expand Down Expand Up @@ -842,7 +842,7 @@ def generate_neuroml2_from_network(
)

for s in nl_model.synapses:
if nml_doc.get_by_id(s.id) == None:
if nml_doc.get_by_id(s.id) is None:
if s.neuroml2_source_file:
incl = neuroml.IncludeType(
locate_file(s.neuroml2_source_file, base_dir)
Expand Down Expand Up @@ -894,7 +894,7 @@ def generate_neuroml2_from_network(
print_v(nml_doc.summary())

# Save to file
if target_dir == None:
if target_dir is None:
target_dir = base_dir
if format == "xml":
if not nml_file_name:
Expand Down Expand Up @@ -949,7 +949,7 @@ def _generate_neuron_files_from_neuroml(network, verbose=False, dir_for_mod_file
temp_nml_doc = NeuroMLDocument(id="temp")

dirs_for_mod_files = []
if dir_for_mod_files != None:
if dir_for_mod_files is not None:
dirs_for_mod_files.append(os.path.abspath(dir_for_mod_files))

for c in network.cells:
Expand Down Expand Up @@ -1036,7 +1036,7 @@ def generate_and_run(
Generates the network in the specified simulator and runs, if appropriate
"""

if network == None:
if network is None:
network = load_network(simulation.network)

print_v(
Expand Down Expand Up @@ -1247,7 +1247,7 @@ def generate_value_array(node, index, context='{0}', param='value'):

temp_nml_doc = _extract_pynn_components_to_neuroml(network)

summary = temp_nml_doc.summary()
temp_nml_doc.summary()
from pyneuroml.pynml import convert_to_units

sim_file_info["inputs"] = {}
Expand Down Expand Up @@ -1762,7 +1762,7 @@ def get_source_id(spiketrain):
return traces, events

elif simulator == "NetPyNE":
if target_dir == None:
if target_dir is None:
target_dir = "./"

_generate_neuron_files_from_neuroml(network, dir_for_mod_files=target_dir)
Expand Down Expand Up @@ -1804,7 +1804,7 @@ def get_source_id(spiketrain):
for pop_id in trace_pop_indices_seg_ids:
for index in trace_pop_indices_seg_ids[pop_id]:
seg_ids = trace_pop_indices_seg_ids[pop_id][index]
if seg_ids == None:
if seg_ids is None:
simConfig.recordTraces[
"%s.%s.%s.v" % (simulation.id, pop_id, index)
] = {
Expand Down Expand Up @@ -1853,7 +1853,7 @@ def get_source_id(spiketrain):
% (projName, ptype, prePop, postPop, synapse)
)

preComp = netpyne_handler.pop_ids_vs_components[prePop]
netpyne_handler.pop_ids_vs_components[prePop]

for conn in netpyne_handler.connections[projName]:
(
Expand Down Expand Up @@ -1905,10 +1905,8 @@ def get_source_id(spiketrain):
): # check if postsyn is in this node's list of gids
sim.net._addCellConn(connParam, pre_id, post_id)

stims = (
sim.net.addStims()
) # add external stimulation to cells (IClamps etc)
simData = (
(sim.net.addStims()) # add external stimulation to cells (IClamps etc)
(
sim.setupRecording()
) # setup variables to record for each cell (spikes, V traces, etc)
sim.runSim() # run parallel Neuron simulation
Expand All @@ -1932,7 +1930,7 @@ def get_source_id(spiketrain):
all_v = []
for index in indices_segids:
seg_ids = indices_segids[index]
if seg_ids == None:
if seg_ids is None:
ref = "%s.%s.%s.v" % (simulation.id, pop_id, index)
# print('Ref: %s, existing: %s'%(ref, sim.allSimData.keys()))
v = [
Expand Down Expand Up @@ -2062,7 +2060,7 @@ def get_source_id(spiketrain):
"Recording in pop %s, cell index %i, seg ids: %s"
% (p.id, cell_index, seg_ids)
)
if seg_ids == None:
if seg_ids is None:
quantity = "%s/%i/%s/v" % (p.id, cell_index, p.component)
if not p.has_positions():
quantity = "%s[%i]/v" % (p.id, cell_index)
Expand Down
2 changes: 1 addition & 1 deletion neuromllite/SonataReader.py
Original file line number Diff line number Diff line change
Expand Up @@ -1332,7 +1332,7 @@ def main(args=None):
# id = '300_pointneurons'
# filename = '/home/padraig/git/sonatapg/examples/%s/config.json'%id

nml_doc = get_neuroml_from_sonata(filename, id, generate_lems=True)
get_neuroml_from_sonata(filename, id, generate_lems=True)
"""
nml_file_name = '%s.net.nml'%id
nml_file_name += '.h5'
Expand Down
10 changes: 5 additions & 5 deletions neuromllite/gui/NMLliteUI.py
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ def __init__(self, nml_sim_file, parent=None):
self.plot2DTab.setLayout(self.plot2DTabLayout)

for plot2D in self.simulation.plots2D:
info = self.simulation.plots2D[plot2D]
pLayout = self.add_tab(
self.simulation.plots2D[plot2D]
self.add_tab(
plot2D, self.plot2DTab, figure=True, toolbar=True, options=True
)

Expand All @@ -354,8 +354,8 @@ def __init__(self, nml_sim_file, parent=None):
self.plot3DTab.setLayout(self.plot3DTabLayout)

for plot3D in self.simulation.plots3D:
info = self.simulation.plots3D[plot3D]
pLayout = self.add_tab(
self.simulation.plots3D[plot3D]
self.add_tab(
plot3D, self.plot3DTab, figure=True, toolbar=False, options=True
)

Expand Down Expand Up @@ -1049,7 +1049,7 @@ def replotSimResults(self):
hm = ax_heatmap.pcolormesh(heat_array, cmap=cm)
# cbar = ax_heatmap.colorbar(im)

if self.heatmapColorbar == None:
if self.heatmapColorbar is None:
self.heatmapColorbar = self.heatmapFigure.colorbar(hm)
self.heatmapColorbar.set_label("Firing rate")

Expand Down
2 changes: 0 additions & 2 deletions neuromllite/test/layout/Layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
RelativeLayout,
Cell,
Synapse,
InputSource,
Input,
RectangularRegion,
)
from neuromllite.NetworkGenerator import generate_network
Expand Down
2 changes: 1 addition & 1 deletion neuromllite/test/sonata/test_sonata_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def main():

print("**** Testing %s (%s) \n" % (id, filename))

nml_doc = get_neuroml_from_sonata(filename, id, generate_lems=True)
get_neuroml_from_sonata(filename, id, generate_lems=True)

nml_file = "%s.net.nml" % id

Expand Down
1 change: 0 additions & 1 deletion neuromllite/test/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -213,7 +213,6 @@ class NewNetwork(Base):
nety = NewNetwork.from_dict(datay)
str_nety = str(nety)

verbose = False
print("----- Before -----")
print(str_orig)
print("----- After via %s -----" % filenamej)
Expand Down
4 changes: 2 additions & 2 deletions neuromllite/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ def create_new_model(
net.id = reference

print(net.to_json())
if network_filename == None:
if network_filename is None:
network_filename = "%s.json" % net.id
new_file = net.to_json_file(network_filename)

Expand All @@ -296,7 +296,7 @@ def create_new_model(
record_traces={"all": "*"},
)

if simulation_filename == None:
if simulation_filename is None:
simulation_filename = "%s.json" % sim.id
sim.to_json_file(simulation_filename)

Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = neuromllite
version = 0.6.1
version = 0.6.2
author = Padraig Gleeson
author_email = p.gleeson@gmail.com
url = https://github.com/NeuroML/NeuroMLlit
Expand All @@ -21,12 +21,12 @@ classifiers =

[options]
install_requires =
libNeuroML>=0.5.1
libNeuroML>=0.6.7
pyyaml
numpy
tables
h5py
modelspec>=0.2.6
modelspec>=0.3.9
ppft[dill]

packages = find:
Expand Down