Reaction-diffusion simulation script¶
- class strengths.RDScript(system, t_sample, time_step=0.001, t_max='default', sampling_policy='on_t_sample', sampling_interval=1, rng_seed=None, init_state_processing='auto', units_system=<strengths.units.UnitsSystem object>)¶
Class that gather simulation parameters. Each argument sets the property with the same name. Default values are :
time_step : 1e-3,
t_max : “default”,
sampling_policy : “on_t_sample”,
sampling_interval : 1,
rng_seed : None,
init_state_processing : “auto”,
units_system : UnitsSystem()
- copy()¶
Returns a deep copy of the object.
- property init_state_processing¶
Define how the system state is resampled when the simulation is initialized. The resampling state is especially important for stochastic method requiring integer values. The propetry can be set with a string with one of the following values:
“none” : No resampling is done.
“floor” : State values are floored.
“Poisson” : Reamspled state values are drawn from a Poisson distribution with the initial state value as mean: resampled_state[i] = Poisson(state[i]).
- “redist”For each species, the floored total quaitity of species in the whole system is determined
from the initial state. The resampled state is generated by redistribution this floored total number of species across the different cells of the system. The probability for a molecule of a given species to be placed inside a certain cell is defined as the corresponding initial state value for this species in this cell, normaized by the floored total quantity of this species.
- “auto”(default) The resampling method is chosen automatically based on the simulation.
Typically, for stochastic methods, “redist” is used, while for deterministic ones, “none” is used.
- property rng_seed¶
Seed to be used for the engine’s pseudo random number generator, if any.
- property sampling_interval¶
In-simulation time interval at which the system state should be sampled, if the sampling policy is “on_interval”.
- property sampling_policy¶
String specifying how sampling should be handled by the simulation engine. accepted sampling policies are :
“on_t_sample” : (default) sampling is done accorging to t_sample (as close as possible).
“on_iteration” : sampling is done at t=0, then at every iteration.
“on_interval” : sampling is done at t=0, then at the given time interval.
“no_sampling” : no sampling is managed by the engine. the sample() method should be used for manual sampling.
- property system¶
reaction diffusion system of which the time trajectory should be simulated.
- property t_max¶
Time at which the simulation should stop. if set to “default”, t_max will be the last element of t_sample.
- property t_sample¶
Expected sampling times (used if sampling_policy==”on_t_sample”).
- property time_step¶
Time step to be used, if necessary.
- property units_system¶
Default units system to be used for numerical inputs. This is also the units system in which the system trajectory (sampled states and times) will be expressed.
- strengths.rdscript_from_dict(d, base_path=None)¶
Creates a RDScript object from a dictionary.
- strengths.rdscript_to_dict(script)¶
Creates a dictionary from a RDScript object.
- strengths.load_rdscript(path)¶
Loads a RDScript object from a JSON file.
- strengths.save_rdscript(script)¶
Saves a RDScript object as a JSON file.