def setGetValues(IdList, testId): print string.ljust ("Check " + testId, rpadding), errorFlag = False for i in range (len(IdList)): value = random.random()*10 rrPython.setValue (IdList[i], value) if expectApproximately (rrPython.getValue (IdList[i]), value, 1E-6) == False: errorFlag = True break print passMsg (errorFlag)
def checkIndividualEigenvalues(testId): # Eigenvalues print string.ljust ("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() try: for i in range(0,m): line = readLine () words = line.split() eigenvalueName = words[0] realPart = rrPython.getValue ('eigen(' + eigenvalueName + ')') realPart = float (realPart) if expectApproximately (realPart, float(words[1]), 1E-6) == False: errorFlag = True break print passMsg (errorFlag) except: print 'Unexpected error in checkIndividualEigenvalues:', sys.exc_info()[0]
def checkSpeciesConcentrations(testId): words = [] species = [] m = rrPython.getNumberOfFloatingSpecies() for i in range(0, m): line = readLine() words = line.split() words.append(rrPython.getValue(words[0])) species.append(words) # Steady State Concentrations print string.ljust("Check " + testId, rpadding), errorFlag = False for i in range(0, m): expectedValue = float(species[i][1]) if expectApproximately(expectedValue, species[i][2], 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkSpeciesConcentrations(testId): words = [] species = [] m = rrPython.getNumberOfFloatingSpecies() for i in range (0,m): line = readLine () words = line.split() words.append (rrPython.getValue(words[0])) species.append (words) # Steady State Concentrations print string.ljust ("Check " + testId, rpadding), errorFlag = False for i in range (0,m): expectedValue = float (species[i][1]) if expectApproximately (expectedValue, species[i][2], 1E-6) == False: errorFlag = True break print passMsg (errorFlag)
def checkFluxes(testId): words = [] fluxes = [] # Steady State Fluxes print string.ljust("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions() for i in range(0, n): line = readLine() words = line.split() words.append(rrPython.getValue(words[0])) fluxes.append(words) for i in range(0, n): expectedValue = float(fluxes[i][1]) if expectApproximately(expectedValue, fluxes[i][2], 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkFluxes(testId): words = [] fluxes = [] # Steady State Fluxes print string.ljust ("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions(); for i in range (0,n): line = readLine () words = line.split() words.append (rrPython.getValue(words[0])) fluxes.append (words) for i in range (0,n): expectedValue = float (fluxes[i][1]) if expectApproximately (expectedValue, fluxes[i][2], 1E-6) == False: errorFlag = True break print passMsg (errorFlag)
import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'getValue' rrPython.loadSBMLFromFile('C:\\RoadRunner\\Models\\feedback.xml') species = 'S1' try: concentration = rrPython.getValue(species) if str(concentration) is not False: result = 'True' else: result = 'False' except: result = 'False' PythonTestResults = open('C:\\RoadRunner\\PythonTestResults.csv','a') writer = csv.writer(PythonTestResults) writevar = function + '=' + result writer.writerow([writevar]) PythonTestResults.close()
import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'getValue' rrPython.loadSBMLFromFile('C:\\RoadRunner\\Models\\feedback.xml') species = 'S1' try: concentration = rrPython.getValue(species) if str(concentration) is not False: result = 'True' else: result = 'False' except: result = 'False' PythonTestResults = open('C:\\RoadRunner\\PythonTestResults.csv', 'a') writer = csv.writer(PythonTestResults) writevar = function + '=' + result writer.writerow([writevar]) PythonTestResults.close()