vivarium.processes.derive_colony_shape module¶
Colony Shape Deriver¶
-
class
vivarium.processes.derive_colony_shape.
ColonyShapeDeriver
(parameters=None)[source]¶ Bases:
vivarium.core.process.Deriver
Derives colony shape metrics from cell locations
-
defaults
= {'alpha': 1.0, 'bounds': [1, 1]}¶
-
name
= 'colony_shape_deriver'¶
-
-
class
vivarium.processes.derive_colony_shape.
Variables
[source]¶ Bases:
object
-
AREA
= 'surface_area'¶
-
CIRCUMFERENCE
= 'circumference'¶
-
MAJOR_AXIS
= 'major_axis'¶
-
MASS
= 'mass'¶
-
MINOR_AXIS
= 'minor_axis'¶
-
-
vivarium.processes.derive_colony_shape.
gen_agent_colony_map
(agents, colony_shapes)[source]¶ Create a map from agent to the colony to which the agent belongs
An agent is considered within a colony if its
location
variable intersects with the colony’s interior or border. If an agent intersects with multiple colonies, we choose arbitrarily which colony the agent belongs to.Points containing any nan coordinate are considered to be outside of all shapes.
Note
An agent may be part of no colony at all, in which case it will not be included in the returned map.
-
vivarium.processes.derive_colony_shape.
major_minor_axes
(shape)[source]¶ Calculate the lengths of the major and minor axes of a shape
We assume that the major and minor axes are the dimensions of the minimum bounding rectangle of the shape. Note that this is different from using PCA to find the axes, especially for highly asymmetrical and concave shapes.
- Parameters
shape (shapely.polygon.Polygon) – The shape to compute axes for.
- Returns
A tuple with the major axis first and the minor axis second.
- Return type