diff --git a/examples/Example6.py b/examples/Example6.py index 786f188..0e104e3 100644 --- a/examples/Example6.py +++ b/examples/Example6.py @@ -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 = {} diff --git a/neuromllite/BBPConnectomeReader.py b/neuromllite/BBPConnectomeReader.py index 8e2478c..e2b8ec7 100644 --- a/neuromllite/BBPConnectomeReader.py +++ b/neuromllite/BBPConnectomeReader.py @@ -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 @@ -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 ( diff --git a/neuromllite/ConnectivityHandler.py b/neuromllite/ConnectivityHandler.py index a8752ad..be5456e 100644 --- a/neuromllite/ConnectivityHandler.py +++ b/neuromllite/ConnectivityHandler.py @@ -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: @@ -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: diff --git a/neuromllite/MatrixHandler.py b/neuromllite/MatrixHandler.py index 76c5672..68d2eed 100644 --- a/neuromllite/MatrixHandler.py +++ b/neuromllite/MatrixHandler.py @@ -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 ) @@ -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: diff --git a/neuromllite/NetworkGenerator.py b/neuromllite/NetworkGenerator.py index 90d391e..4c02821 100644 --- a/neuromllite/NetworkGenerator.py +++ b/neuromllite/NetworkGenerator.py @@ -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 @@ -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) @@ -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) @@ -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) @@ -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: @@ -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: @@ -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( @@ -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"] = {} @@ -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) @@ -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) ] = { @@ -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]: ( @@ -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 @@ -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 = [ @@ -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) diff --git a/neuromllite/SonataReader.py b/neuromllite/SonataReader.py index 098f70c..b3797c1 100644 --- a/neuromllite/SonataReader.py +++ b/neuromllite/SonataReader.py @@ -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' diff --git a/neuromllite/gui/NMLliteUI.py b/neuromllite/gui/NMLliteUI.py index fa713fc..a3a007e 100644 --- a/neuromllite/gui/NMLliteUI.py +++ b/neuromllite/gui/NMLliteUI.py @@ -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 ) @@ -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 ) @@ -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") diff --git a/neuromllite/test/layout/Layout.py b/neuromllite/test/layout/Layout.py index a3773fd..a698e2f 100644 --- a/neuromllite/test/layout/Layout.py +++ b/neuromllite/test/layout/Layout.py @@ -2,8 +2,6 @@ RelativeLayout, Cell, Synapse, - InputSource, - Input, RectangularRegion, ) from neuromllite.NetworkGenerator import generate_network diff --git a/neuromllite/test/sonata/test_sonata_reader.py b/neuromllite/test/sonata/test_sonata_reader.py index 97a906e..3faf2d4 100644 --- a/neuromllite/test/sonata/test_sonata_reader.py +++ b/neuromllite/test/sonata/test_sonata_reader.py @@ -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 diff --git a/neuromllite/test/test_base.py b/neuromllite/test/test_base.py index 3aa7d8d..5587e0e 100644 --- a/neuromllite/test/test_base.py +++ b/neuromllite/test/test_base.py @@ -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) diff --git a/neuromllite/utils.py b/neuromllite/utils.py index 7f7f0a7..e4a8dcf 100644 --- a/neuromllite/utils.py +++ b/neuromllite/utils.py @@ -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) @@ -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) diff --git a/setup.cfg b/setup.cfg index bef2ad0..804496b 100644 --- a/setup.cfg +++ b/setup.cfg @@ -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 @@ -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: