cbmos.cbmodel package¶
Module contents¶
- class cbmos.cbmodel.CBModel(force, solver, dimension=3, separation=0.3, hpc_backend=<module 'numpy' from '/opt/hostedtoolcache/Python/3.8.16/x64/lib/python3.8/site-packages/numpy/__init__.py'>)¶
Bases:
object
- Parameters:
force (f(ndarray(dtype=float), **kwargs) -> float) – forces to be applied between cells
solver (f(fun, t_span, y0) -> scipy.intergrade._ivp.ivp.OdeResult) – ODE solver, e.g. solve_ivp from scipy.integrate
dimension (int) – dimension of the system, usually 2D or 3D
separation (float) – distance between parent cell and child cell after separation
hpc_backend (module) – module implementing Numpy’s API (e.g. Cupy, Dask). Default is Numpy itself.
- jacobian(y, force_args)¶
Compute the jacobian of the given ode system.
- Parameters:
y (np.ndarray(size=(n_cell*dim,))) – cell vector
force_args ({str: float}) – extra arguments for the force function
- Return type:
np.ndarray(size=(n_cell*dim, n_cell*dim))
- queue_event(event)¶
Add an event to the queue after the simulation has started.
- Parameters:
event (Event) –
- simulate(cell_list, t_data, force_args, solver_args, seed=None, raw_t=True, max_execution_time=None, min_event_resolution=0.0, event_list=[], n_target_cells=[], throw_away_history=False)¶
Run the simulation with the given arguments and return the position of the cells at each time steps in t_data
- Parameters:
cell_list ([Cell]) – Initial cell layout
event_list ([Event]) – Scheduled events
t_data ([float]) – times at which the history should be recorded, if raw_t is set to True, only the start and end time are taken into account and the rest is ignored. The history is then recorded following the solver’s output.
force_args (dict) – arguments to pass to the force function
solver_args (dict) – arguments to pass to the solver
seed (int) – seed for the random number generator
raw_t (bool) – whether or not to use the solver’s raw output. In that case, t_data is ignored and the raw times are returned along the history
max_execution_time (float) – Maximum execution time in seconds that the simulation should use. Since the elapsed time is only checked in between cell events, this only represents an approximate target. The exact duration is saved in self.last_exec_time
min_event_resolution (float) – Minimum event resolution interval: events occurring within min_event_resolution of the current time will be resolved immediately.
- Return type:
(t_data, history)
Note
Cell ordering in the output can vary between timepoints.
Cell indices need to be unique for the whole duration of the simulation.
If raw_t is false, t_data is returned as is, with the history. If raw_t is true, aggregated t_data from the solver is returned.