vivarium.plots.multibody_physics module

class vivarium.plots.multibody_physics.LineWidthData(*args, **kwargs)[source]

Bases: matplotlib.lines.Line2D

vivarium.plots.multibody_physics.check_plt_backend()[source]
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_trajectories(agents, times)[source]
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_fluorescent_color(baseline_hsv, tag_color, intensity)[source]
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.initialize_spatial_figure(bounds, fontsize=18)[source]
vivarium.plots.multibody_physics.mutate_color(baseline_hsv)[source]
vivarium.plots.multibody_physics.plot_agent(ax, data, color, agent_shape)[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 at agents.

    • 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 at fields.

    • 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, segment

    • phylogeny_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 is out 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 over include_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.

vivarium.plots.multibody_physics.plot_tags(data, plot_config)[source]

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 at agents.

    • 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 is out 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 a tuple 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 default

    • tag_label_size (float): The font size for the tag name label

    • default_font_size (float): Font size for titles and axis labels.

vivarium.plots.multibody_physics.plot_temporal_trajectory(agent_timeseries, config, out_dir='out', filename='temporal')[source]
vivarium.plots.multibody_physics.rotate_agent_series_90(series, bounds)[source]
vivarium.plots.multibody_physics.rotate_bounds_90(bounds)[source]
vivarium.plots.multibody_physics.rotate_field_90(field)[source]