Reaction-diffusion system trajectory¶
- class strengths.RDTrajectory(data, t_sample, system, script=None, engine_description=None, engine_option=None, cgmap=None)¶
Trajectory of a reaction-diffusion system.
- Parameters:
data (UnitArray with quantity units dimensions) – trajectory data [sample index, species index, cell index]
t_sample (UnitArray with time units dimensions) – system time associated with each sample of the trajectory
system (RDSystem) – reaction diffusion system associated with the trajectory
script (RDScript ot None) – simulation script associated with the trajectory.
engine_description (str or None) – description of the engine used for the simulation.
engine_option (str or None) – option used with the engine used for the simulation.
cg_map (array of int or None) – coarse graining index map or None. if not None, it means that the data results from an uncoarsegraining operation, with cgmap.
- property cgmap¶
Coarse graining index map which has been used to uncoarsegrain the trajectory.
- property data¶
array of the system states sucessively sampled at the time points in self.t.
- property engine_description¶
Description of the engine used for the simulation.
- property engine_option¶
Option used for the engine used for the simulation.
- get_sample_index(t, policy='closest')¶
return the sample index i which self.t[i] is the closest from t. t must be a UnitValue (or its string representation) in time units (ie. “s”, “min”, etc.) and policy must be a string with one of the following values :
if policy = “closest”, the closest index is returned, or None if there is no sample.
if policy = “supeq”, the closest index for which t[i]>=t is returned. None is returned if there is not such value.
if policy = “infeq”, the closest index for which t[i]<=t is returned. None is returned if there is not such value.
- get_state(species, sample)¶
Returns the state of a given species at a given sample index. if species is None, the whole state for the given sample index is returned.
- Parameters:
species (Species, int or str or None) – species, species label or species index
sample (int) – sample index
- Returns:
sampled species state at the given sample index.
- get_trajectory(species, position=0, merge=False)¶
Returns the trajectory of a given species. if merge=False, it is the trajectory at the given position, otherwise, it is the global trajectory in the whole system.
- Parameters:
species (Species, number or str) – species for which trajectory should be returned.
position (number, tuple or Coord like.) – position of the cell in which the trajectory should be taken. it is ignored if merge=True.
merge (bool) – if True, position is ignored, and the global trajectory of the species is trturned.
- Returns:
local ot global trajectory of the species.
- Return type:
UnitArray of quantity units dimensions
- get_trajectory_point(species, sample, position)¶
Returns the value of a given species trajectory, at a given sample, at a given position.
- Parameters:
species (Species, int or str) – species, species label or index
sample (int) – sample index
position – position in the cell space. can be a linear index (int) or a class with x,y,z properties/members representing spatial cooridnates in a MeghGrid.
- Returns:
sample value at the given position for the given species (number).
- ncells()¶
Returns the number of species.
- nsamples()¶
Returns the number of samples.
- nspecies()¶
Returns the number of species.
- property script¶
reaction diffusion simulation script.
- property system¶
reaction diffusion system.
- property t¶
sampling time points.
- strengths.save_rdtrajectory(so, path, separate_data=True)¶
Saves a simulation output as a file.
- Parameters:
so (RDOutput) – simulation output to be saved.
path (str) – path of the output file to be created or replaced. the .json extension suffix is added if absent.
separate_data (bool) – specifies if the data should be saved in a separate file. if true, the trajectory data are saved in a different file using the numpy.save function [1]. This makes the saving and loading faster, especially for large simulation outputs. if filename.json is the name of the json file, the data are saved as filename_data.npy (NPY format [2]).
- strengths.load_rdtrajectory(path)¶
Load a simulation output from a file.
- Parameters:
path (str) – path of the output file to be created or replaced.
- Returns:
loaded simulation output.
- Return type:
RDOutput