diff --git a/Brent_minimization.py b/Brent_minimization.py index 606a2f9..0ea520e 100644 --- a/Brent_minimization.py +++ b/Brent_minimization.py @@ -1,5 +1,5 @@ +# -*- coding: utf-8 -*- -# # This program is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License as # published by the Free Software Foundation; either version 3, or @@ -40,12 +40,10 @@ ''' from __future__ import print_function -import numpy from scipy import optimize import argparse import os import sys -import argparse import findSim from multiprocessing import Pool diff --git a/basicParameterSweep.py b/basicParameterSweep.py index ed790a2..6069c31 100644 --- a/basicParameterSweep.py +++ b/basicParameterSweep.py @@ -39,11 +39,9 @@ ''' from __future__ import print_function -import numpy import argparse import os import sys -import argparse import findSim from multiprocessing import Pool diff --git a/findSim.py b/findSim.py index 3631847..534d79d 100644 --- a/findSim.py +++ b/findSim.py @@ -45,7 +45,6 @@ import time import imp # This is apparently deprecated in Python 3.4 and up import matplotlib.pyplot as pyplot -import mpld3 #mpld3 hack # suggested: https://github.com/mpld3/mpld3/issues/434 @@ -378,14 +377,14 @@ def doScore( self, scoringFormula ): assert( len(self.data) == len( self.simData ) ) score = 0.0 numScore = 0.0 - dvals = [i[1] for i in self.data] - datarange = max( dvals ) - min( dvals ) + # dvals = [i[1] for i in self.data] + # datarange = max( dvals ) - min( dvals ) for i,sim in zip( self.data, self.simData ): - t = i[0] - expt = i[1] - sem = i[2] - #print t, expt, sem, sim, datarange - #print "Formula = ", scoringFormula, eval( scoringFormula ) + # t = i[0] + # expt = i[1] + # sem = i[2] + # print t, expt, sem, sim, datarange + # print "Formula = ", scoringFormula, eval( scoringFormula ) score += eval( scoringFormula ) numScore += 1.0 @@ -399,8 +398,8 @@ def directParamScore( readouts, modelLookup, scoringFormula ): for rd in readouts: for d in rd.data: entity = d[0] - expt = d[1]*rd.quantityScale - sem = d[2]*rd.quantityScale + # expt = d[1]*rd.quantityScale + # sem = d[2]*rd.quantityScale if not entity in modelLookup: raise SimError( "Readout::directParamScore: Entity {} not found".format( entity ) ) elmList = modelLookup[entity] @@ -408,7 +407,7 @@ def directParamScore( readouts, modelLookup, scoringFormula ): raise SimError( "Readout::directParamScore: Should only have 1 object, found {} ".format( len( elmList ) ) ) # We use a utility function because findSim may permit # parameters like Kd that need to be evaluated. - sim = getObjParam( elmList[0], rd.field ) + # sim = getObjParam( elmList[0], rd.field ) #sim = elmList[0].getField( rd.field ) score += eval( scoringFormula ) numScore += 1.0 @@ -717,7 +716,7 @@ def isNotDescendant( elm, ancestorSet ): def getObjParam( elm, field ): if field == 'Kd': if not elm.isA['ReacBase']: - raise SimError( "getObjParam: can only get Kd on a Reac, was: '{}'".format( obj.className ) ) + raise SimError( "getObjParam: can only get Kd on a Reac, was: '{}'".format( elm.className ) ) return elm.Kb/elm.Kf elif field == 'tau': # This is a little dubious, because order 1 reac has 1/conc.time @@ -725,7 +724,7 @@ def getObjParam( elm, field ): # This latter is the Kf we want to use, assuming typical concs are # around 1 uM. if not elm.isA['ReacBase']: - raise SimError( "getObjParam: can only get tau on a Reac, was: '{}'".format( obj.className ) ) + raise SimError( "getObjParam: can only get tau on a Reac, was: '{}'".format( elm.className ) ) scaleKf = 0.001 ** (elm.numSubstrates-1) scaleKb = 0.001 ** (elm.numProducts-1) #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): for i in erlist: isub = i.neighbors["sub"] iprd = i.neighbors["prd"] - tobedelete = False + # tobedelete = False if moose.exists(i.path): if len(isub) == 0 or len(iprd) == 0 : subprdNotfound = True @@ -954,8 +953,8 @@ def makeReadoutPlots( readouts, modelLookup ): moose.connect( plot, 'requestOut', elm, fieldname ) def putReadoutsInQ( q, readouts, pauseHsolve ): - stdError = [] - plotLookup = {} + # stdError = [] + # plotLookup = {} for i in readouts: if i.field in (epspFields + epscFields): for j in range( len( i.data ) ): @@ -1016,7 +1015,7 @@ def doReadout( qe, model ): ''' readout = qe.entry val = int(round( ( qe.val ) ) ) - ratioReference = 0.0 + # ratioReference = 0.0 if readout.field in (epspFields + epscFields): doEpspReadout( readout, model.modelLookup ) elif val == -1: # This is a special event to get RatioReferenceValue @@ -1109,7 +1108,7 @@ def parseAndRunDoser( model, stims, readouts, modelId ): exactly one stimulus block, {} defined".format( len(stims)) ) if len( readouts ) != 1: raise SimError( "parseAndRunDoser: Dose response run needs \ - exactly one readout block, {} defined".format( len(readout) ) ) + exactly one readout block, {} defined".format( len(readouts) ) ) numLevels = len( readouts[0].data ) if numLevels == 0: @@ -1131,10 +1130,10 @@ def parseAndRunDoser( model, stims, readouts, modelId ): ########################################################################## def runDoser( model, stim, readout, doseMol ): - responseScale = readout.quantityScale + # responseScale = readout.quantityScale doseScale = stim.quantityScale referenceDose = readout.ratioReferenceDose * stim.quantityScale - sim = 0.0 + # sim = 0.0 for dose, response, sem in readout.data: doseMol.concInit = dose * doseScale moose.reinit() @@ -1164,7 +1163,7 @@ def doBarChartStim( multiStimLine, doseMol, dose, field ): def doBarChartReference( readout, stim, modelLookup ): if readout.useRatio and readout.ratioReferenceTime >= 0.0: - responseScale = readout.quantityScale + # responseScale = readout.quantityScale referenceDose = readout.ratioReferenceDose * stim.quantityScale referenceMol = modelLookup[readout.ratioReferenceEntities[0] ] @@ -1206,7 +1205,7 @@ def parseAndRunBarChart( model, stims, readouts, modelId ): one stimulus block, {} defined".format( len( stims ) ) ) if len( readouts ) != 1: raise SimError( "parseAndRunBarChart: BarChart run needs exactly \ - one readout block, {} defined".format( len( readout ) ) ) + one readout block, {} defined".format( len( readouts ) ) ) numLevels = len( readouts[0].data ) if numLevels == 0: @@ -1268,9 +1267,9 @@ def convertBarChartLabels( self, readout, stim ): def plotbar( self, readout, stim, scriptName ): barpos = np.arange( len( self.sim ) ) - width = 0.35 # A reasonable looking bar width - exptBar = pyplot.bar(barpos - width/2, self.expt, width, yerr=self.yerror, color='SkyBlue', label='Experiment') - simBar = pyplot.bar(barpos + width/2, self.sim, width, color='IndianRed', label='Simulation') + # width = 0.35 # A reasonable looking bar width + # exptBar = pyplot.bar(barpos - width/2, self.expt, width, yerr=self.yerror, color='SkyBlue', label='Experiment') + # simBar = pyplot.bar(barpos + width/2, self.sim, width, color='IndianRed', label='Simulation') pyplot.xlabel( "Stimulus combinations" ) pyplot.ylabel( self.ylabel ) pyplot.title(scriptName) @@ -1480,7 +1479,7 @@ def innerMain( script, modelFile = "model/synSynth7.g", dumpFname = "", paramFna ''' global pause - solver = "gsl" # Pick any of gsl, gssa, ee.. + # solver = "gsl" # Pick any of gsl, gssa, ee.. modelWarning = "" modelId = "" expt, stims, readouts, model = loadTsv( script ) diff --git a/models/loadhh.py b/models/loadhh.py index 6eb80fa..8cc9d0e 100644 --- a/models/loadhh.py +++ b/models/loadhh.py @@ -1,4 +1,3 @@ -import moose import rdesigneur as rd def load(): rdes = rd.rdesigneur( diff --git a/multi_param_minimization.py b/multi_param_minimization.py index b9c8653..8254262 100644 --- a/multi_param_minimization.py +++ b/multi_param_minimization.py @@ -42,7 +42,6 @@ from __future__ import print_function import numpy as np from scipy import optimize -import argparse import os import sys import argparse diff --git a/runAllParallel.py b/runAllParallel.py index 73daa8e..2cc7666 100644 --- a/runAllParallel.py +++ b/runAllParallel.py @@ -37,11 +37,9 @@ ''' from __future__ import print_function, division -import numpy import argparse import os import sys -import argparse import time from multiprocessing import Pool diff --git a/setup.py b/setup.py index db8224e..d40367d 100644 --- a/setup.py +++ b/setup.py @@ -7,8 +7,6 @@ __maintainer__ = "Dilawar Singh" __email__ = "dilawars@ncbs.res.in" -import os -import sys import setuptools with open("README.md") as f: