goo.molecule¶
- class goo.molecule.DiffusionSystem(molecules: list[Molecule], grid_size: tuple[int, int, int] = (50, 50, 50), grid_center: tuple[int, int, int] = (0, 0, 0), time_step: float = 0.1, total_time: int = 1, element_size=(0.5, 0.5, 0.5))[source]¶
Bases:
object
A diffusion system that simulates the diffusion of molecules in a 3D grid. It also handles the secretion and sensing of molecular signals by cells.
- Parameters:
molecules (list[Molecule]) – The list of molecules in the system.
grid_size (Tuple[int, int, int], optional) – The size of the 3D grid. Defaults to (25, 25, 25).
grid_center (Tuple[int, int, int], optional) – The center of the 3D grid. Defaults to (0, 0, 0).
time_step (float, optional) – The time step of the simulation. Defaults to 0.1.
total_time (int, optional) – The total time of the simulation. Defaults to 10.
element_size (Tuple[float, float, float], optional) – The size of each element in the grid. Defaults to (1.0, 1.0, 1.0).
- diffuse(mol: Molecule)[source]¶
Simulate the diffusion of molecules in the grid using the Laplace operator.
- Parameters:
mol (Molecule)
- get_ball_concentrations(mol, center, radius)[source]¶
Returns the coordinates and concentrations of a molecule of all the voxels within a sphere.
- Parameters:
mol – Molecule to get concentrations for
center – Coordinates of sphere center
radius – Radius of sphere
- Returns:
(coordinates array, concentrations array) for points within sphere
- Return type:
tuple
- get_molecule_concentration(mol, point)[source]¶
Get the concentration of a molecule at a certain point.
- get_total_ball_concentrations(mol, center, radius)[source]¶
Returns total concentration of a molecule within a sphere.
- Parameters:
mol – Molecule to get concentration for
center – Coordinates of sphere center
radius – Radius of sphere
- Returns:
Total concentration of the molecule within the sphere
- Return type:
float
- simulate_diffusion(mol: Molecule)[source]¶
Simulate the diffusion of molecules in the grid.
- Parameters:
mol (Molecule)
- class goo.molecule.Molecule(name: str, conc: float, D: float, gradient: str | None = None)[source]¶
Bases:
object
A molecule involved in the diffusion system.
- Parameters:
name (str) – The name of the molecule.
conc (float) – The initial concentration of the molecule.
D (float) – The diffusion rate of the molecule.
gradient (str, optional) – The gradient of the molecule. Defaults to None.
- property D¶
- property conc¶
- property gradient¶
- property name¶