예제 #1
0
def setGetFloatingSpeciesByIndex(testId):
  print string.ljust ("Check " + testId, rpadding),
  errorFlag = False
  n = rrPython.getNumberOfFloatingSpecies()
  for i in range (n):
      value = random.random()*10
      rrPython.setFloatingSpeciesByIndex (i, value)
      if expectApproximately(rrPython.getFloatingSpeciesByIndex (i), value, 1E-6) == False:
          errorFlag = True
          break;
  print passMsg (errorFlag)
예제 #2
0
def checkFloatingSpeciesInitialConditionIds (testId):
  print string.ljust ("Check " + testId, rpadding),
  errorFlag = False
  line = readLine ()
  words = line.split()
  expected = rrPython.getFloatingSpeciesInitialConditionIds()
  m = rrPython.getNumberOfFloatingSpecies()
  for i in range(0,m):
      if words[i] != expected[i]:
             errorFlag = True
             break
  print passMsg (errorFlag)
예제 #3
0
def checkFloatingSpeciesInitialConditionIds(testId):
    print string.ljust("Check " + testId, rpadding),
    errorFlag = False
    line = readLine()
    words = line.split()
    expected = rrPython.getFloatingSpeciesInitialConditionIds()
    m = rrPython.getNumberOfFloatingSpecies()
    for i in range(0, m):
        if words[i] != expected[i]:
            errorFlag = True
            break
    print passMsg(errorFlag)
예제 #4
0
def checkGetRatesOfChangeIds(testId):
    print string.ljust("Check " + testId, rpadding),
    errorFlag = False
    line = readLine()
    words = line.split()
    expected = rrPython.getRatesOfChangeIds()
    n = rrPython.getNumberOfFloatingSpecies()
    for i in range(0, n):
        if words[i] != expected[i]:
            errorFlag = True
            break
    print passMsg(errorFlag)
예제 #5
0
def checkGetRatesOfChangeIds (testId):
  print string.ljust ("Check " + testId, rpadding),
  errorFlag = False
  line = readLine ()
  words = line.split()
  expected = rrPython.getRatesOfChangeIds()
  n = rrPython.getNumberOfFloatingSpecies()
  for i in range(0,n):
      if words[i] != expected[i]:
             errorFlag = True
             break
  print passMsg (errorFlag)
예제 #6
0
def checkLinkMatrix(testId):
    # Link matrix
    print string.ljust("Check " + testId, rpadding),
    errorFlag = False
    m = rrPython.getNumberOfFloatingSpecies()
    st = rrPython.getLinkMatrix()
    for i in range(0, m):
        words = readLine().split()
        for j in range(0, m):
            if expectApproximately(float(words[j]), st[i, j], 1E-6) == False:
                errorFlag = True
                break
    print passMsg(errorFlag)
예제 #7
0
def checkLinkMatrix(testId):
   # Link matrix
   print string.ljust ("Check " + testId, rpadding),
   errorFlag = False
   m = rrPython.getNumberOfFloatingSpecies()
   st = rrPython.getLinkMatrix()
   for i in range(0,m):
       words = readLine ().split()
       for j in range(0,m):
           if expectApproximately(float (words[j]), st[i,j], 1E-6) == False:
              errorFlag = True
              break
   print passMsg (errorFlag)
예제 #8
0
def setGetReset(testId):
    print string.ljust("Check " + testId, rpadding),
    errorFlag = False
    values = zeros(rrPython.getNumberOfFloatingSpecies())
    for i in range(len(values)):
        values[i] = random.random() * 10
    initial = rrPython.getFloatingSpeciesInitialConcentrations()
    rrPython.setFloatingSpeciesConcentrations(values)
    # Should reset the floats by to the current initial condition
    rrPython.reset()
    values = rrPython.getFloatingSpeciesConcentrations()
    if (values != initial).all():
        errorFlag = True
    print passMsg(errorFlag)
예제 #9
0
def setGetReset(testId):
  print string.ljust ("Check " + testId, rpadding),
  errorFlag = False
  values = zeros (rrPython.getNumberOfFloatingSpecies())
  for i in range (len (values)):
    values[i] = random.random()*10
  initial = rrPython.getFloatingSpeciesInitialConcentrations()
  rrPython.setFloatingSpeciesConcentrations (values)
  # Should reset the floats by to the current initial condition
  rrPython.reset()
  values = rrPython.getFloatingSpeciesConcentrations()
  if(values != initial).all():
    errorFlag = True
  print passMsg (errorFlag)
예제 #10
0
def checkScaledElasticityMatrix(testId):
    # Jacobian
    print string.ljust("Check " + testId, rpadding),
    errorFlag = False
    m = rrPython.getNumberOfFloatingSpecies()
    ee = rrPython.getScaledElasticityMatrix()
    for i in range(0, m):
        line = readLine()
        words = line.split()
        for j in range(0, m):
            expectedValue = float(words[j])
            if expectApproximately(expectedValue, ee[i, j], 1E-6) == False:
                errorFlag = True
                break
    print passMsg(errorFlag)
예제 #11
0
def checkScaledConcentrationControlMatrix(testId):
    # Unscaled Concentration Control matrix
    print string.ljust("Check " + testId, rpadding),
    words = []
    errorFlag = False
    m = rrPython.getNumberOfFloatingSpecies()
    n = rrPython.getNumberOfReactions()
    st = rrPython.getScaledConcentrationControlCoefficientMatrix()
    for i in range(0, m):
        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)
예제 #12
0
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)
예제 #13
0
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)
예제 #14
0
def checkScaledElasticityMatrix(testId):
  # Jacobian
  print string.ljust ("Check " + testId, rpadding),
  errorFlag = False
  m = rrPython.getNumberOfFloatingSpecies()
  ee = rrPython.getScaledElasticityMatrix()
  for i in range(0,m):
      line = readLine ()
      words = line.split()
      for j in range(0,m):
          expectedValue = float(words[j])
          if expectApproximately (expectedValue, ee[i,j], 1E-6) == False:
             errorFlag = True
             break
  print passMsg (errorFlag)
예제 #15
0
def checkScaledConcentrationControlMatrix(testId):
   # Unscaled Concentration Control matrix
   print string.ljust ("Check " + testId, rpadding),
   words = []
   errorFlag = False
   m = rrPython.getNumberOfFloatingSpecies()
   n = rrPython.getNumberOfReactions();
   st = rrPython.getScaledConcentrationControlCoefficientMatrix();
   for i in range(0,m):
        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)
예제 #16
0
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]
예제 #17
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)
예제 #18
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)
예제 #19
0
def checkEigenvalueMatrix(testId):
   # Eigenvalues
   print string.ljust ("Check " + testId, rpadding),
   errorFlag = False
   m = rrPython.getNumberOfFloatingSpecies()
   eigenvalues = rrPython.getEigenvalues()
   for i in range(0,m):
      line = readLine ()
      words = line.split()
      realPart = float (words[0])
      # Check if there is an imaginary part
      if len (words) == 1:
         imagPart = 0
      else:
         imagPart= float (words[1])
      if (expectApproximately (realPart, eigenvalues[i,0], 1E-6) == False) or (expectApproximately (imagPart, eigenvalues[i,1], 1E-6)) == False:
          errorFlag = True
          break
   print passMsg (errorFlag)
예제 #20
0
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)
예제 #21
0
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 = 'getNumberOfFloatingSpecies'

try:
    num = rrPython.getNumberOfFloatingSpecies()
    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 = 'getNumberOfFloatingSpecies'

try:
    num = rrPython.getNumberOfFloatingSpecies()
    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()