Skip to content

Commit 774ba06

Browse files
author
rodriguez-facundo
committed
use self to reference netparams
1 parent 91ec3dd commit 774ba06

1 file changed

Lines changed: 27 additions & 27 deletions

File tree

netpyne_ui/netpyne_geppetto.py

Lines changed: 27 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -429,13 +429,13 @@ def getAvailablePlots(self):
429429
def deleteParam(self, model, label):
430430
if isinstance(model, list): # just for cellParams
431431
if len(model)==1:
432-
netParams.cellParams[model[0]]["secs"].pop(label)
432+
self.netParams.cellParams[model[0]]["secs"].pop(label)
433433
elif len(model)==2:
434-
netParams.cellParams[model[0]]["secs"][model[1]]["mechs"].pop(label)
434+
self.netParams.cellParams[model[0]]["secs"][model[1]]["mechs"].pop(label)
435435
else:
436436
pass
437437
else:
438-
getattr(netParams, model).pop(label)
438+
getattr(self.netParams, model).pop(label)
439439

440440
def validateFunction(self, functionString):
441441
return validateFunction(functionString, self.netParams.__dict__)
@@ -515,9 +515,9 @@ def propagate(self, obj, label, cond, new, old):
515515
def propagate_field_rename(self, label, new, old):
516516
def unique(label=label, old=old):
517517
classes = []
518-
for p in netParams.popParams:
519-
if label in netParams.popParams[p]:
520-
classes.append(netParams.popParams[p][label])
518+
for p in self.netParams.popParams:
519+
if label in self.netParams.popParams[p]:
520+
classes.append(self.netParams.popParams[p][label])
521521
if classes.count(old)>1:
522522
return False
523523
else:
@@ -532,42 +532,42 @@ def unique(label=label, old=old):
532532
else:
533533
if unique():
534534
for (model, cond) in [['cellParams','conds'], ['connParams', 'preConds'], ['connParams', 'postConds'], ['stimTargetParams', 'conds']]:
535-
self.propagate(getattr(netParams, model), label, cond, new, old)
535+
self.propagate(getattr(self.netParams, model), label, cond, new, old)
536536
return True
537537
else:
538538
return False
539539

540540
def propagate_section_rename(self, new, old):
541-
for label in netParams.cellParams:
542-
if 'secs' in netParams.cellParams[label]:
543-
for sec in netParams.cellParams[label]['secs']:
544-
if 'topol' in netParams.cellParams[label]['secs'][sec]:
545-
if 'parentSec' in netParams.cellParams[label]['secs'][sec]['topol']:
546-
if netParams.cellParams[label]['secs'][sec]['topol']['parentSec'] == old:
541+
for label in self.netParams.cellParams:
542+
if 'secs' in self.netParams.cellParams[label]:
543+
for sec in self.netParams.cellParams[label]['secs']:
544+
if 'topol' in self.netParams.cellParams[label]['secs'][sec]:
545+
if 'parentSec' in self.netParams.cellParams[label]['secs'][sec]['topol']:
546+
if self.netParams.cellParams[label]['secs'][sec]['topol']['parentSec'] == old:
547547
if new == None:
548-
netParams.cellParams[label]['secs'][sec]['topol'].pop('parentSec')
548+
self.netParams.cellParams[label]['secs'][sec]['topol'].pop('parentSec')
549549
else:
550-
netParams.cellParams[label]['secs'][sec]['topol']['parentSec'] = new
550+
self.netParams.cellParams[label]['secs'][sec]['topol']['parentSec'] = new
551551

552552
def propagate_stim_source_rename(self, new, old):
553-
for label in netParams.stimTargetParams:
554-
if old==netParams.stimTargetParams[label]['source']:
553+
for label in self.netParams.stimTargetParams:
554+
if old==self.netParams.stimTargetParams[label]['source']:
555555
if new==None:
556-
netParams.stimTargetParams[label].pop('source')
556+
self.netParams.stimTargetParams[label].pop('source')
557557
else:
558-
netParams.stimTargetParams[label]['source'] = new
558+
self.netParams.stimTargetParams[label]['source'] = new
559559

560560
def propagate_syn_mech_rename(self, new, old):
561-
for label in netParams.stimTargetParams:
562-
if 'source' in netParams.stimTargetParams[label]:
563-
if netParams.stimTargetParams[label]['source'] in netParams.stimSourceParams:
564-
if 'type' in netParams.stimSourceParams[netParams.stimTargetParams[label]['source']]:
565-
if netParams.stimSourceParams[netParams.stimTargetParams[label]['source']]['type']=='NetStim':
566-
if old==netParams.stimTargetParams[label]['synMech']:
561+
for label in self.netParams.stimTargetParams:
562+
if 'source' in self.netParams.stimTargetParams[label]:
563+
if self.netParams.stimTargetParams[label]['source'] in self.netParams.stimSourceParams:
564+
if 'type' in self.netParams.stimSourceParams[self.netParams.stimTargetParams[label]['source']]:
565+
if self.netParams.stimSourceParams[self.netParams.stimTargetParams[label]['source']]['type']=='NetStim':
566+
if old==self.netParams.stimTargetParams[label]['synMech']:
567567
if new==None:
568-
netParams.stimTargetParams[label].pop('synMech')
568+
self.netParams.stimTargetParams[label].pop('synMech')
569569
else:
570-
netParams.stimTargetParams[label]['synMech'] = new
570+
self.netParams.stimTargetParams[label]['synMech'] = new
571571

572572

573573
logging.info("Initialising NetPyNE UI")

0 commit comments

Comments
 (0)