vivarium.plots.multibody_physics module¶
-
class
vivarium.plots.multibody_physics.
LineWidthData
(*args, **kwargs)[source]¶ Bases:
matplotlib.lines.Line2D
-
vivarium.plots.multibody_physics.
color_phylogeny
(ancestor_id, phylogeny, baseline_hsv, phylogeny_colors={})[source]¶ get colors for all descendants of the ancestor through recursive calls to each generation
-
vivarium.plots.multibody_physics.
get_agent_type_colors
(agent_ids)[source]¶ get colors for each agent id by agent type Assumes that agents of the same type share the beginning of their name, followed by ‘_x’ with x as a single number TODO – make this more general for more digits and other comparisons
-
vivarium.plots.multibody_physics.
get_phylogeny_colors_from_names
(agent_ids)[source]¶ Get agent colors using phlogeny saved in agent_ids This assumes the names use daughter_phylogeny_id() from meta_division
-
vivarium.plots.multibody_physics.
init_axes
(fig, edge_length_x, edge_length_y, grid, row_idx, col_idx, time, molecule, ylabel_size=20)[source]¶
-
vivarium.plots.multibody_physics.
plot_agent_trajectory
(agent_timeseries, config, out_dir='out', filename='trajectory')[source]¶
-
vivarium.plots.multibody_physics.
plot_agents
(ax, agents, agent_colors={}, agent_shape='segment', dead_color=None)[source]¶ ax: the axis for plot
- agents: a dict with {agent_id: agent_data} and
agent_data a dict with keys location, angle, length, width
agent_colors: dict with {agent_id: hsv color}
dead_color: List of 3 floats that define HSV color to use for dead cells. Dead cells only get treated differently if this is set.
-
vivarium.plots.multibody_physics.
plot_motility
(timeseries, out_dir='out', filename='motility_analysis')[source]¶
-
vivarium.plots.multibody_physics.
plot_snapshots
(data, plot_config)[source]¶ Plot snapshots of the simulation over time
The snapshots depict the agents and environmental molecule concentrations.
- Parameters
data (dict) –
A dictionary with the following keys:
agents (
dict
): A mapping from times to dictionaries of agent data at that timepoint. Agent data dictionaries should have the same form as the hierarchy tree rooted atagents
.fields (
dict
): A mapping from times to dictionaries of environmental field data at that timepoint. Field data dictionaries should have the same form as the hierarchy tree rooted atfields
.config (
dict
): The environmental configuration dictionary with the following keys:bounds (
tuple
): The dimensions of the environment.
plot_config (dict) –
Accepts the following configuration options. Any options with a default is optional.
n_snapshots (
int
): Number of snapshots to show per row (i.e. for each molecule). Defaults to 6.agent_shape (
str
): the shape of the agents. select from rectangle, segmentphylogeny_names (
bool
): This selects agent colors based on phylogenies seved in their names using meta_division.py daughter_phylogeny_id()out_dir (
str
): Output directory, which isout
by default.filename (
str
): Base name of output file.snapshots
by default.skip_fields (
Iterable
): Keys of fields to exclude from the plot. This takes priority overinclude_fields
.include_fields (
Iterable
): Keys of fields to plot.field_label_size (
float
): Font size of the field label.dead_color (
list
of 3 :py:class:`float`s): Color for dead cells in HSV. Defaults to [0, 0, 0], which is black.default_font_size (
float
): Font size for titles and axis labels.
Plot snapshots of the simulation over time
The snapshots depict the agents and the levels of tagged molecules in each agent by agent color intensity.
- Parameters
data (dict) –
A dictionary with the following keys:
agents (
dict
): A mapping from times to dictionaries of agent data at that timepoint. Agent data dictionaries should have the same form as the hierarchy tree rooted atagents
.config (
dict
): The environmental configuration dictionary with the following keys:bounds (
tuple
): The dimensions of the environment.
plot_config (dict) –
Accepts the following configuration options. Any options with a default is optional.
n_snapshots (
int
): Number of snapshots to show per row (i.e. for each molecule). Defaults to 6.out_dir (
str
): Output directory, which isout
by default.filename (
str
): Base name of output file.tags
by default.tagged_molecules (
typing.Iterable
): The tagged molecules whose concentrations will be indicated by agent color. Each molecule should be specified as atuple
of the path in the agent compartment to where the molecule’s count can be found, with the last value being the molecule’s count variable.background_color (
str
): use matplotlib colors,black
by defaulttag_label_size (
float
): The font size for the tag name labeldefault_font_size (
float
): Font size for titles and axis labels.