def checkGetReactionRatesByIndex(testId): print string.ljust("Check " + testId, rpadding), errorFlag = False words = readLine().split() n = rrPython.getNumberOfReactions() for i in range(n): value = rrPython.getReactionRate(i) if expectApproximately(float(words[i]), value, 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkGetReactionRatesByIndex(testId): print string.ljust ("Check " + testId, rpadding), errorFlag = False words = readLine().split() n = rrPython.getNumberOfReactions() for i in range (n): value = rrPython.getReactionRate (i) if expectApproximately(float (words[i]), value, 1E-6) == False: errorFlag = True break; print passMsg (errorFlag)
def checkReactionIds(testId): print string.ljust("Check " + testId, rpadding), errorFlag = False line = readLine() words = line.split() expected = rrPython.getReactionIds() m = rrPython.getNumberOfReactions() for i in range(0, m): if words[i] != expected[i]: errorFlag = True break print passMsg(errorFlag)
def checkReactionIds (testId): print string.ljust ("Check " + testId, rpadding), errorFlag = False line = readLine () words = line.split() expected = rrPython.getReactionIds() m = rrPython.getNumberOfReactions(); for i in range(0,m): if words[i] != expected[i]: errorFlag = True break print passMsg (errorFlag)
def checkScaledFluxControlCoefficientMatrix(testId): # Unscaled Flux Control matrix print string.ljust("Check " + testId, rpadding), words = [] errorFlag = False n = rrPython.getNumberOfReactions() st = rrPython.getScaledFluxControlCoefficientMatrix() for i in range(0, n): words = readLine().split() for j in range(0, n): if expectApproximately(float(words[j]), st[i, j], 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkScaledFluxControlCoefficientMatrix(testId): # Unscaled Flux Control matrix print string.ljust ("Check " + testId, rpadding), words = [] errorFlag = False n = rrPython.getNumberOfReactions(); st = rrPython.getScaledFluxControlCoefficientMatrix() for i in range(0,n): words = readLine ().split() for j in range(0,n): if expectApproximately(float (words[j]), st[i,j], 1E-6) == False: errorFlag = True break print passMsg (errorFlag)
def checkStoichiometryMatrix(testId): # Stoichiometry matrix print string.ljust("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions() st = rrPython.getStoichiometryMatrix() for i in range(0, m): line = readLine() words = line.split() for j in range(0, n): if expectApproximately(float(words[j]), st[i, j], 1E-6) == False: errorFlag = True break print passMsg(errorFlag)
def checkStoichiometryMatrix(testId): # Stoichiometry matrix print string.ljust ("Check " + testId, rpadding), errorFlag = False m = rrPython.getNumberOfFloatingSpecies() n = rrPython.getNumberOfReactions(); st = rrPython.getStoichiometryMatrix() for i in range(0,m): line = readLine () words = line.split() for j in range(0,n): if expectApproximately(float (words[j]), st[i,j], 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 = 'getNumberOfReactions' try: num = rrPython.getNumberOfReactions() if str(num) 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 = 'getNumberOfReactions' try: num = rrPython.getNumberOfReactions() if str(num) 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()