def runTester(pathToModels, testModel):
    global fHandle
    global sbmlStr
    global JarnacStr

    print "Starting Tester on ", testModel

    sys.path.append(pathToModels)
    #print 'Version: ', rrPython.getVersion()
    #print 'Build Date: ', rrPython.getBuildDate()
    #print 'Copyright Message: ', rrPython.getCopyright()

    fHandle = open(pathToModels + testModel, 'r')

    sbmlStr = loadSBMLModelFromTestFile()
    JarnacStr = loadJarnacModelFromTestFile()

    print "\n", "Info:" + "\n"

    rrPython.enableLogging()
    info = rrPython.getInfo()
    for item in info:
        print item
    print

    # Load any initialization actions
    testId = jumpToNextTest()
    if testId == '[INITIALIZATION]':
        testId = jumpToNextTest()
        while testId != '[END_INITIALIZATION]':
            if functions.has_key(testId):
                func = functions[testId]
                func(testId)
            else:
                print 'No initialization function found for ' + testId
            testId = jumpToNextTest()

    # Load the model into RoadRunner
    if rrPython.loadSBML(sbmlStr) == False:
        print 'Failed to load model'
        print rrPython.getLastError()
        sys.exit(-1)

    print rrPython.getuCC('J1', 'k1')
    print rrPython.getuCC('J1', 'k_1')
    print rrPython.getuCC('J1', 'k2')
    print rrPython.getuCC('J1', 'k_2')
    print rrPython.getuCC('J1', 'k3')
    print rrPython.getuCC('J1', 'k_3')
    print rrPython.getuCC('J1', 'k4')
    print rrPython.getuCC('J1', 'k_4')

    # Now start the tests proper
    testId = jumpToNextTest()
    if testId == '[START_TESTS]':
        testId = jumpToNextTest()
        while testId != '[END_TESTS]':
            if functions.has_key(testId):
                func = functions[testId]
                func(testId)
            else:
                print string.ljust(testId, rpadding), 'NO TEST'
            testId = jumpToNextTest()
    else:
        print 'No Tests found'

    scriptTests()
Beispiel #2
0
def runTester (pathToModels, testModel):
    global fHandle
    global sbmlStr
    global JarnacStr

    print "Starting Tester on ", testModel

    sys.path.append (pathToModels)
    #print 'Version: ', rrPython.getVersion()
    #print 'Build Date: ', rrPython.getBuildDate()
    #print 'Copyright Message: ', rrPython.getCopyright()

    fHandle = open (pathToModels + testModel, 'r')

    sbmlStr = loadSBMLModelFromTestFile ()
    JarnacStr = loadJarnacModelFromTestFile ()

    print "\n", "Info:"+ "\n"

    rrPython.enableLogging()
    info = rrPython.getInfo()
    for item in info:
        print item
    print

    # Load any initialization actions
    testId = jumpToNextTest()
    if testId == '[INITIALIZATION]':
        testId = jumpToNextTest ()
        while testId != '[END_INITIALIZATION]':
            if functions.has_key(testId):
               func = functions[testId]
               func(testId)
            else:
               print 'No initialization function found for ' + testId
            testId = jumpToNextTest()

    # Load the model into RoadRunner
    if rrPython.loadSBML(sbmlStr) == False:
        print 'Failed to load model'
        print rrPython.getLastError()
        sys.exit(-1)

    print rrPython.getuCC ('J1', 'k1')
    print rrPython.getuCC ('J1', 'k_1')
    print rrPython.getuCC ('J1', 'k2')
    print rrPython.getuCC ('J1', 'k_2')
    print rrPython.getuCC ('J1', 'k3')
    print rrPython.getuCC ('J1', 'k_3')
    print rrPython.getuCC ('J1', 'k4')
    print rrPython.getuCC ('J1', 'k_4')

    # Now start the tests proper
    testId = jumpToNextTest()
    if testId == '[START_TESTS]':
        testId = jumpToNextTest()
        while testId != '[END_TESTS]':
           if functions.has_key(testId):
              func = functions[testId]
              func(testId)
           else:
              print string.ljust (testId, rpadding), 'NO TEST'
           testId = jumpToNextTest()
    else:
      print 'No Tests found'

    scriptTests()
Beispiel #3
0
import rrPython
import os
import csv

os.chdir('C:\\RoadRunner\\bin')

function = 'getLastError'

try:
    error = rrPython.getLastError()
    if str(error) 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 = 'getLastError'

try:
    error = rrPython.getLastError()
    if str(error) 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 as rr
from rrPlugins import *

#Load the 'noise' plugin in order to add some noise to the data
plugin = loadPlugin("rrp_add_noise")
if not plugin:
    print rr.getLastError()
    exit()

print getPluginInfo(plugin)
print getPluginCapabilities(plugin)
print getPluginCapabilitiesAsXML(plugin)

paraHandle   = getPluginParameter(plugin, "NoiseType")

print 'getting some info about the parameter'
print getParameterInfo(paraHandle)

paraValueString = getParameterValueAsString(paraHandle)
print 'parameter is ' + paraValueString

setParameterByString(paraHandle, "1")
paraValueString = getParameterValueAsString(paraHandle)
print 'Parameter is now: ' + paraValueString

setEnumParameter(paraHandle, 0)
test = getParameterValue(paraHandle)
print test

paraValueString = getParameterValueAsString(paraHandle)
print 'Parameter is now: ' + paraValueString
import rrPython as rr
from rrPlugins import *

# Load the 'noise' plugin in order to add some noise to the data
plugin = loadPlugin("rrp_add_noise")
if not plugin:
    print rr.getLastError()
    exit()

print getPluginInfo(plugin)
print getPluginCapabilities(plugin)
print getPluginCapabilitiesAsXML(plugin)

paraHandle = getPluginParameter(plugin, "NoiseType")

print "getting some info about the parameter"
print getParameterInfo(paraHandle)

paraValueString = getParameterValueAsString(paraHandle)
print "parameter is " + paraValueString

setParameterByString(paraHandle, "1")
paraValueString = getParameterValueAsString(paraHandle)
print "Parameter is now: " + paraValueString

setEnumParameter(paraHandle, 0)
test = getParameterValue(paraHandle)
print test

paraValueString = getParameterValueAsString(paraHandle)
print "Parameter is now: " + paraValueString