pyLM.CME#
Functions
|
|
|
Set the logger to write to the console as the code is working |
|
Set up file handler to print log to file |
|
Set the level of the logger for the application |
|
Visualize the RDME simulation volume inside Jupyter. |
|
Classes
|
A constructor for the CMESimulation |
|
Decorate an iterable object, returning an iterator which acts exactly like the original iterable, but prints a dynamically updating progressbar every time a value is requested. |
- class pyLM.CME.CMESimulation(volume=None, name='unnamed')[source]#
Bases:
object
A constructor for the CMESimulation
- Parameters:
volume – The reaction vessel volume (in Litres). Specifying ‘None’ signifies that the user has already accounted for volume in rate constants.
name – The name of the CME simulation; Default: “unnamed”
- Returns:
CMESimulation
- addConcentration(species='unknown', conc=0.0)[source]#
Add a concentration of particles of the specified type to the simulation
- Parameters:
species – The name of the specie to add
concentration – The concentration of the species (Molar). Particle count is rounded to nearest integer.
- addParticles(species='unknown', count=1)[source]#
Add a specified number of particles of the specified type to the specified region
- Parameters:
species – The name of the specie to add particles to
count – The number of that particle to start with (default 1)
- addReaction(reactant, product, rate)[source]#
Adds a 0th, 1st or 2nd order reaction
Reaction rates are specified as stochastic rates: i.e. in units of \(1/\mathrm{s}\).
- Parameters:
reactant – The list or reactants
product – The list of products
rate – The stochastic rate of reaction
- buildReactionModel()[source]#
Return the Lattice Microbes ReactionModel object for fine-tuning
- Returns:
The reaction model for the simulation
- defineSpecies(species)[source]#
Define a species of particles that exist in the simulation
- Parameters:
species – A list of species to add to the simulation
- run(filename, method, replicates=1, seed=None, cudaDevices=None, checkpointInterval=0)[source]#
Run the simulation using the specified solver the specified amount of time
- Parameters:
filename – The HDF file to write to
method – The class name for the solver to use (e.g., lm::cme::GillespieDSolver”)
replicates – The number of replicates to serially run
seed – A seed for the random number generator to use when running the simulation; None indicates default
- runMPI(filename, method, replicates=1, driver='mpirun', ppe=1, seed=None)[source]#
Run the simulation using a call to mpirun with the given options
- Parameters:
filename – The HDF file to write to
method – The class name for the solver to use (e.g. lm::cme::GillespieDSolver”)
replicates – The number of replicates to serially run
driver – The program to execute the parallel run, e.g. “mpirun”, “aprun”, “ibrun”, etc.
ppe – The number of processing elements to use (e.g. number of nodes)
seed – A seed for the random number generator to use when running the simulation; None indicates default
- runSolver(filename, solver, replicates=1, cudaDevices=None, checkpointInterval=0)[source]#
Run a simulation with a given solver
- Parameters:
filename – The HDF file to write to
solver – An MESolver object
replicates – The number of replicates to serially run
- save(filename)[source]#
Create an HDF5 version of the simulation amenable for later running or stand-alone running
- Parameters:
filename – The filename to save the simulation setup in
- setHookInterval(time)[source]#
Set the simulation hook interval
- Parameters:
time – Time length between hook calls
- setSimulationTime(time)[source]#
Set the total simulation time
- Parameters:
time – Time length of the simulation