def setGetNumberOfPoints(testId): print string.ljust("Check " + testId, rpadding), errorFlag = False value = random.randint(1, 100) rrPython.setNumPoints(value) if rrPython.getNumPoints() != value: errorFlag = True print passMsg(errorFlag)
def setGetNumberOfPoints(testId): print string.ljust ("Check " + testId, rpadding), errorFlag = False value = random.randint (1, 100) rrPython.setNumPoints (value) if rrPython.getNumPoints () != value: errorFlag = True print passMsg (errorFlag)
import rrPython import os modelPath = ('C:\\roadRunner\\models\\feedback.xml') sbml = rrPython.loadSBMLFromFile(modelPath) rrPython.setTimeStart(0.0) rrPython.setTimeEnd(3.0) rrPython.setNumPoints(20) rrPython.setSteadyStateSelectionList("time S1 S2 S3 S4") results = rrPython.simulate() print results
import rrPython import timeit import cmd modelPath = raw_input('Model location: (C:\\RoadRunner\\Models\\feedback.xml, etc.)') rrPython.loadSBMLFromFile(modelPath) simulations = raw_input('Number of simulations:') start_Time = raw_input('Start time:') start_Time = float(start_Time) end_Time = raw_input('End time:') end_Time = float(end_Time) number_of_points = raw_input('Number of points:') number_of_points = int(number_of_points) simulations = int(simulations) rrPython.setTimeStart(start_Time) rrPython.setTimeEnd(end_Time) rrPython.setNumPoints(number_of_points) t = timeit.Timer('rrPython.simulate()','import rrPython') totalTime = t.timeit(number = simulations) meanTime = totalTime/simulations print 'Average simulation time: ' + str(meanTime) + ' seconds'
import rrPython import os import csv os.chdir('C:\\RoadRunner\\bin') function = 'setNumPoints' rrPython.loadSBMLFromFile('C:\\RoadRunner\\Models\\feedback.xml') try: points = rrPython.setNumPoints(10) if str(points) 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 os import rrPython print 'RoadRunner Build Date: ' + rrPython.getCopyright() startTime = 0 endTime = 5 numPoints = 50 selList="time,S1,S2" result = rrPython.loadSBMLFromFile("..\\Models\\test_1.xml") rrPython.setTimeStart(startTime) rrPython.setTimeEnd(endTime) rrPython.setNumPoints(numPoints) rrPython.setTimeCourseSelectionList(selList) k = rrPython.simulate() print k print "done"
import rrPython import timeit import cmd modelPath = raw_input( 'Model location: (C:\\RoadRunner\\Models\\feedback.xml, etc.)') rrPython.loadSBMLFromFile(modelPath) simulations = raw_input('Number of simulations:') start_Time = raw_input('Start time:') start_Time = float(start_Time) end_Time = raw_input('End time:') end_Time = float(end_Time) number_of_points = raw_input('Number of points:') number_of_points = int(number_of_points) simulations = int(simulations) rrPython.setTimeStart(start_Time) rrPython.setTimeEnd(end_Time) rrPython.setNumPoints(number_of_points) t = timeit.Timer('rrPython.simulate()', 'import rrPython') totalTime = t.timeit(number=simulations) meanTime = totalTime / simulations print 'Average simulation time: ' + str(meanTime) + ' seconds'
startTime = float(text[1]) if text[0] == 'duration:': endTime = startTime + float(text[1]) if text[0] == 'steps:': numberOfPoints = int(text[1])+1#add one to match online sbml validation if text[0] == 'variables:': varlist = text[1:] if text[0] == 'amount:': if len(text) >1: concheck = 1 if text[0] == 'concentration:': if len(text) >1: amountcheck = 1 rrPython.setTimeStart(startTime) rrPython.setTimeEnd(endTime) rrPython.setNumPoints(numberOfPoints) #if concheck == 1: # compvalues = rrPython.getCompartmentByIndex() curtime = ['time'] species = curtime + varlist #i=0 #pattern = re.compile('[\W_]+') #for species[i] in species: # species[i] = pattern.sub('',species[i])#removes non-alphanumeric characters from all variables names. Probably no longer needed. # i+=1 species = str(species).strip("[]") species = species.replace("'", "") species = species.replace(" ", "") rrPython.setSelectionList(species)
if text[0] == 'duration:': endTime = startTime + float(text[1]) if text[0] == 'steps:': numberOfPoints = int( text[1]) + 1 #add one to match online sbml validation if text[0] == 'variables:': varlist = text[1:] if text[0] == 'amount:': if len(text) > 1: concheck = 1 if text[0] == 'concentration:': if len(text) > 1: amountcheck = 1 rrPython.setTimeStart(startTime) rrPython.setTimeEnd(endTime) rrPython.setNumPoints(numberOfPoints) #if concheck == 1: # compvalues = rrPython.getCompartmentByIndex() curtime = ['time'] species = curtime + varlist #i=0 #pattern = re.compile('[\W_]+') #for species[i] in species: # species[i] = pattern.sub('',species[i])#removes non-alphanumeric characters from all variables names. Probably no longer needed. # i+=1 species = str(species).strip("[]") species = species.replace("'", "") species = species.replace(" ", "") rrPython.setSelectionList(species)