def test_load_save_models(self): """ Tests that loading and saving SMBL doesn't fail """ covers(["loadSBMLFromFile", "getSBML", "loadSBML"]) rrPython.loadSBMLFromFile(resource_filename("roadrunnerlib", "data/feedback.xml")) model = rrPython.getSBML() self.assertIsNotNone(model) rrPython.loadSBML(model)
from roadrunnerlib import rrPython from pkg_resources import resource_string import numpy import matplotlib.pyplot as plot model = resource_string('roadrunnerlib','data/feedback.xml') rrPython.loadSBML(model) timeStart = 0.0 timeEnd = 10.0 numPoints = 50 results = rrPython.simulateEx(timeStart, timeEnd, numPoints) print results S1 = results[:,2] S2 = results[:,3] S3 = results[:,4] x = numpy.arange(timeStart, timeEnd, (timeEnd - timeStart)/numPoints) plot.plot(x, S1, label="S1") plot.plot(x, S2, label="S2") plot.plot(x, S3, label="S3") plot.legend(bbox_to_anchor=(1.05, 1), loc=5, borderaxespad=0.) plot.ylabel('Concentration (moles/L)') plot.xlabel('time (s)') plot.show()