Skip to content

Commit 534e0a6

Browse files
committed
pyflakes (static code analysis) error fixes
1 parent 54a6515 commit 534e0a6

File tree

7 files changed

+26
-37
lines changed

7 files changed

+26
-37
lines changed

Brent_minimization.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1+
# -*- coding: utf-8 -*-
12

2-
#
33
# This program is free software; you can redistribute it and/or
44
# modify it under the terms of the GNU General Public License as
55
# published by the Free Software Foundation; either version 3, or
@@ -40,12 +40,10 @@
4040
'''
4141

4242
from __future__ import print_function
43-
import numpy
4443
from scipy import optimize
4544
import argparse
4645
import os
4746
import sys
48-
import argparse
4947
import findSim
5048
from multiprocessing import Pool
5149

basicParameterSweep.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,9 @@
3939
'''
4040

4141
from __future__ import print_function
42-
import numpy
4342
import argparse
4443
import os
4544
import sys
46-
import argparse
4745
import findSim
4846
from multiprocessing import Pool
4947

findSim.py

Lines changed: 25 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@
4545
import time
4646
import imp # This is apparently deprecated in Python 3.4 and up
4747
import matplotlib.pyplot as pyplot
48-
import mpld3
4948

5049
#mpld3 hack
5150
# suggested: https://github.com/mpld3/mpld3/issues/434
@@ -378,14 +377,14 @@ def doScore( self, scoringFormula ):
378377
assert( len(self.data) == len( self.simData ) )
379378
score = 0.0
380379
numScore = 0.0
381-
dvals = [i[1] for i in self.data]
382-
datarange = max( dvals ) - min( dvals )
380+
# dvals = [i[1] for i in self.data]
381+
# datarange = max( dvals ) - min( dvals )
383382
for i,sim in zip( self.data, self.simData ):
384-
t = i[0]
385-
expt = i[1]
386-
sem = i[2]
387-
#print t, expt, sem, sim, datarange
388-
#print "Formula = ", scoringFormula, eval( scoringFormula )
383+
# t = i[0]
384+
# expt = i[1]
385+
# sem = i[2]
386+
# print t, expt, sem, sim, datarange
387+
# print "Formula = ", scoringFormula, eval( scoringFormula )
389388
score += eval( scoringFormula )
390389
numScore += 1.0
391390

@@ -399,16 +398,16 @@ def directParamScore( readouts, modelLookup, scoringFormula ):
399398
for rd in readouts:
400399
for d in rd.data:
401400
entity = d[0]
402-
expt = d[1]*rd.quantityScale
403-
sem = d[2]*rd.quantityScale
401+
# expt = d[1]*rd.quantityScale
402+
# sem = d[2]*rd.quantityScale
404403
if not entity in modelLookup:
405404
raise SimError( "Readout::directParamScore: Entity {} not found".format( entity ) )
406405
elmList = modelLookup[entity]
407406
if len( elmList ) != 1:
408407
raise SimError( "Readout::directParamScore: Should only have 1 object, found {} ".format( len( elmList ) ) )
409408
# We use a utility function because findSim may permit
410409
# parameters like Kd that need to be evaluated.
411-
sim = getObjParam( elmList[0], rd.field )
410+
# sim = getObjParam( elmList[0], rd.field )
412411
#sim = elmList[0].getField( rd.field )
413412
score += eval( scoringFormula )
414413
numScore += 1.0
@@ -717,15 +716,15 @@ def isNotDescendant( elm, ancestorSet ):
717716
def getObjParam( elm, field ):
718717
if field == 'Kd':
719718
if not elm.isA['ReacBase']:
720-
raise SimError( "getObjParam: can only get Kd on a Reac, was: '{}'".format( obj.className ) )
719+
raise SimError( "getObjParam: can only get Kd on a Reac, was: '{}'".format( elm.className ) )
721720
return elm.Kb/elm.Kf
722721
elif field == 'tau':
723722
# This is a little dubious, because order 1 reac has 1/conc.time
724723
# units. Suppose Kf = x / mM.sec. Then Kf = 0.001x/uM.sec
725724
# This latter is the Kf we want to use, assuming typical concs are
726725
# around 1 uM.
727726
if not elm.isA['ReacBase']:
728-
raise SimError( "getObjParam: can only get tau on a Reac, was: '{}'".format( obj.className ) )
727+
raise SimError( "getObjParam: can only get tau on a Reac, was: '{}'".format( elm.className ) )
729728
scaleKf = 0.001 ** (elm.numSubstrates-1)
730729
scaleKb = 0.001 ** (elm.numProducts-1)
731730
#print( "scaleKf={}; scaleKb={}, numsu ={}, numPrd={},Kb={},Kf={}".format( scaleKf, scaleKb, elm.numSubstrates, elm.numProducts, elm.Kb, elm.Kf ) )
@@ -867,7 +866,7 @@ def pruneDanglingObj( kinpath, erSPlist):
867866
for i in erlist:
868867
isub = i.neighbors["sub"]
869868
iprd = i.neighbors["prd"]
870-
tobedelete = False
869+
# tobedelete = False
871870
if moose.exists(i.path):
872871
if len(isub) == 0 or len(iprd) == 0 :
873872
subprdNotfound = True
@@ -954,8 +953,8 @@ def makeReadoutPlots( readouts, modelLookup ):
954953
moose.connect( plot, 'requestOut', elm, fieldname )
955954

956955
def putReadoutsInQ( q, readouts, pauseHsolve ):
957-
stdError = []
958-
plotLookup = {}
956+
# stdError = []
957+
# plotLookup = {}
959958
for i in readouts:
960959
if i.field in (epspFields + epscFields):
961960
for j in range( len( i.data ) ):
@@ -1016,7 +1015,7 @@ def doReadout( qe, model ):
10161015
'''
10171016
readout = qe.entry
10181017
val = int(round( ( qe.val ) ) )
1019-
ratioReference = 0.0
1018+
# ratioReference = 0.0
10201019
if readout.field in (epspFields + epscFields):
10211020
doEpspReadout( readout, model.modelLookup )
10221021
elif val == -1: # This is a special event to get RatioReferenceValue
@@ -1109,7 +1108,7 @@ def parseAndRunDoser( model, stims, readouts, modelId ):
11091108
exactly one stimulus block, {} defined".format( len(stims)) )
11101109
if len( readouts ) != 1:
11111110
raise SimError( "parseAndRunDoser: Dose response run needs \
1112-
exactly one readout block, {} defined".format( len(readout) ) )
1111+
exactly one readout block, {} defined".format( len(readouts) ) )
11131112
numLevels = len( readouts[0].data )
11141113

11151114
if numLevels == 0:
@@ -1131,10 +1130,10 @@ def parseAndRunDoser( model, stims, readouts, modelId ):
11311130

11321131
##########################################################################
11331132
def runDoser( model, stim, readout, doseMol ):
1134-
responseScale = readout.quantityScale
1133+
# responseScale = readout.quantityScale
11351134
doseScale = stim.quantityScale
11361135
referenceDose = readout.ratioReferenceDose * stim.quantityScale
1137-
sim = 0.0
1136+
# sim = 0.0
11381137
for dose, response, sem in readout.data:
11391138
doseMol.concInit = dose * doseScale
11401139
moose.reinit()
@@ -1164,7 +1163,7 @@ def doBarChartStim( multiStimLine, doseMol, dose, field ):
11641163

11651164
def doBarChartReference( readout, stim, modelLookup ):
11661165
if readout.useRatio and readout.ratioReferenceTime >= 0.0:
1167-
responseScale = readout.quantityScale
1166+
# responseScale = readout.quantityScale
11681167
referenceDose = readout.ratioReferenceDose * stim.quantityScale
11691168
referenceMol = modelLookup[readout.ratioReferenceEntities[0] ]
11701169

@@ -1206,7 +1205,7 @@ def parseAndRunBarChart( model, stims, readouts, modelId ):
12061205
one stimulus block, {} defined".format( len( stims ) ) )
12071206
if len( readouts ) != 1:
12081207
raise SimError( "parseAndRunBarChart: BarChart run needs exactly \
1209-
one readout block, {} defined".format( len( readout ) ) )
1208+
one readout block, {} defined".format( len( readouts ) ) )
12101209
numLevels = len( readouts[0].data )
12111210

12121211
if numLevels == 0:
@@ -1268,9 +1267,9 @@ def convertBarChartLabels( self, readout, stim ):
12681267

12691268
def plotbar( self, readout, stim, scriptName ):
12701269
barpos = np.arange( len( self.sim ) )
1271-
width = 0.35 # A reasonable looking bar width
1272-
exptBar = pyplot.bar(barpos - width/2, self.expt, width, yerr=self.yerror, color='SkyBlue', label='Experiment')
1273-
simBar = pyplot.bar(barpos + width/2, self.sim, width, color='IndianRed', label='Simulation')
1270+
# width = 0.35 # A reasonable looking bar width
1271+
# exptBar = pyplot.bar(barpos - width/2, self.expt, width, yerr=self.yerror, color='SkyBlue', label='Experiment')
1272+
# simBar = pyplot.bar(barpos + width/2, self.sim, width, color='IndianRed', label='Simulation')
12741273
pyplot.xlabel( "Stimulus combinations" )
12751274
pyplot.ylabel( self.ylabel )
12761275
pyplot.title(scriptName)
@@ -1480,7 +1479,7 @@ def innerMain( script, modelFile = "model/synSynth7.g", dumpFname = "", paramFna
14801479
'''
14811480

14821481
global pause
1483-
solver = "gsl" # Pick any of gsl, gssa, ee..
1482+
# solver = "gsl" # Pick any of gsl, gssa, ee..
14841483
modelWarning = ""
14851484
modelId = ""
14861485
expt, stims, readouts, model = loadTsv( script )

models/loadhh.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import moose
21
import rdesigneur as rd
32
def load():
43
rdes = rd.rdesigneur(

multi_param_minimization.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,6 @@
4242
from __future__ import print_function
4343
import numpy as np
4444
from scipy import optimize
45-
import argparse
4645
import os
4746
import sys
4847
import argparse

runAllParallel.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,9 @@
3737
'''
3838
from __future__ import print_function, division
3939

40-
import numpy
4140
import argparse
4241
import os
4342
import sys
44-
import argparse
4543
import time
4644
from multiprocessing import Pool
4745

setup.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,6 @@
77
__maintainer__ = "Dilawar Singh"
88
__email__ = "[email protected]"
99

10-
import os
11-
import sys
1210
import setuptools
1311

1412
with open("README.md") as f:

0 commit comments

Comments
 (0)