This example plots a simulation on a linear-time scale (0 - 10000) to the file ozzy.pdf .
Tips and Tricks:
You can pass the command line options for ozzy.py directly to crnsimulator.
This will automatically simulate your ODE system. Use –force to overwrite an
existing ozzy.py script.
If you can set which species appear in the legend using –pyplot-lables. If you
are writing a new executable (you may need –force), then you can also control the order:
~$ echo "A @i 0.1; B @i 1e-2; A+B->2B [k=0.2]; B+C->2C [k=0.4]; C+A->2A" | crnsimulator --p0 C=1e-3 --t8 10000 -o ozzy --pyplot ozzy.pdf --force --pyplot-labels C B
Using the crnsimulator library:
The easiest way to get started is by looking at the crnsimulator script itself.
However, here is a small example using the above oscillating CRN.
>>> from crnsimulator import ReactionGraph
>>> crn = [[['A', 'B'],['B','B'],0.2],
[['B', 'C'],['C','C'],0.8],
[['C', 'A'],['A','A'],0.9]]
>>> RG = ReactionGraph(crn)
>>> svars = ['B', 'C', 'A'] # let's enforce the order of species, because we can!
>>> filename, odename = RG.write_ODE_lib(filename='ozzy.py', sorted_vars = svars)
>>> print('Wrote ODE system file:', filename)
Wrote ODE system file: ozzy.py
crnsimulator
Simulate Chemical Recation Networks (CRNs) using Ordinary Differential Equations (ODEs).
Examples
Using the
crnsimulatorexecutable:Create a test file with your CRN:
File: oscillator.crn
And pipe it into the crnsimulator:
This writes the ODE system to an executable python script:
ozzy.pyCheck the command line parameters of ozzy.py. You have to set initial species concentrations, and choose an output-format, e.g.:
This example plots a simulation on a linear-time scale (0 - 10000) to the file
ozzy.pdf.Tips and Tricks:
You can pass the command line options for ozzy.py directly to
crnsimulator. This will automatically simulate your ODE system. Use –force to overwrite an existingozzy.pyscript.You can specify the CRN in a single line:
You can specify default initial concentrations of species:
If you can set which species appear in the legend using –pyplot-lables. If you are writing a new executable (you may need –force), then you can also control the order:
Using the
crnsimulatorlibrary:The easiest way to get started is by looking at the crnsimulator script itself. However, here is a small example using the above oscillating CRN.
Then go ahead and execute
ozzy.py:… or load its functions by treating it as a python library:
… or include the prebuilt integrator in you own script (like the crnsimulator exectuable):
Installation
Version
v0.9 – code cleanup
v0.8 – beta status