ecoli.analysis.antibiotics_colony.timeseries
- ecoli.analysis.antibiotics_colony.timeseries.make_tag_video(data, metadata, tag_colors, out_prefix, conc=False, min_color=(0, 0, 0), show_membrane=False, highlight_agent=None)[source]
Make a video of snapshot images that span a replicate for a condition. In each of these videos, cells will be will be colored with highlight_color and intensity corresponding to their value of highlight_column.
- Parameters:
data (pandas.DataFrame) – DataFrame where each row is an agent and each column is a variable of interest. Must have these columns: ‘Time’, ‘Death’, ‘Agent ID’, ‘Boundary’, ‘Condition’, and ‘Seed’. 1 condition/seed at a time.
metadata (dict[str, dict[str, dict[str, Any]]]) – Nested dictionary where each condition is an outer key and each initial seed is an inner key. Each seed point to a dictionary with the following keys: ‘bounds’ is of the form [x, y] and gives the dimensions of the spatial environment and ‘fields’ is a dictionary timeseries of the ‘fields’ Store for that condition and initial seed
tag_colors (dict[str, Any]) – Mapping column names in
data
to either RGB tuples or dictionaries containing thecmp
andnorm
keys for thematplotlib.colors.Colormap
andmatplotlib.colors.Normalize
instances to use for that tag If dictionaries are used, themin_color
key is overrridenconc (bool) – Whether to normalize by volume before plotting
min_color (Any) – Color for cells with lowest highlight_column value (default black)
out_prefix (str) – Prefix for output filename
show_membrane (bool) – Whether to draw outline for agents
figsize – Desired size of entire figure
highlight_agent – Mapping of agent IDs to membrane_color and membrane_width. Useful for highlighting specific agents, with rest using defaults
- Return type:
None
- ecoli.analysis.antibiotics_colony.timeseries.plot_field_snapshots(data, metadata, highlight_lineage=None, highlight_color=(1, 0, 0), min_pct=1, max_pct=1, colorbar_decimals=1, return_fig=False, n_snapshots=5, figsize=(9, 1.75))[source]
Plot a row of snapshot images that span a replicate for each condition. In each of these images, the cell corresponding to a highlighted lineage is colored while the others are white.
- Parameters:
data (pandas.DataFrame) – DataFrame where each row is an agent and each column is a variable of interest. Must have these columns: ‘Time’, ‘Death’, ‘Agent ID’, ‘Boundary’, ‘Condition’, and ‘Seed’. 1 condition/seed at a time.
metadata (dict[str, dict[str, dict[str, Any]]]) – Nested dictionary where each condition is an outer key and each initial seed is an inner key. Each seed point to a dictionary with the following keys: ‘bounds’ is of the form [x, y] and gives the dimensions of the spatial environment and ‘fields’ is a dictionary timeseries of the ‘fields’ Store for that condition and initial seed
highlight_lineage (str | None) – Agent ID to plot lineage trace for
highlight_color (tuple) – Color to plot highlight lineage with (default red)
min_pct – Percent of minimum field concentration to use as minimum value in colorbar (1 = 100%)
max_pct – Percent of maximum field concentration to use as maximum value in colorbar (1 = 100%)
colorbar_decimals – Number of decimals to include in colorbar labels.
return_fig – Whether to return the Figure
n_snapshots – Number of equally-spaced (temporally) snapshots
figsize – Desired size of entire figure
- Return type:
None
- ecoli.analysis.antibiotics_colony.timeseries.plot_tag_snapshots(data, metadata, tag_colors, snapshot_times, conc=False, min_color=(1, 1, 1), out_prefix=None, show_membrane=False, return_fig=False, figsize=(9, 1.75), highlight_agent=None)[source]
Plot a row of snapshot images that span a replicate for each condition. In each of these images, cells will be will be colored with highlight_color and intensity corresponding to their value of highlight_column.
- Parameters:
data (pandas.DataFrame) – DataFrame where each row is an agent and each column is a variable of interest. Must have these columns: ‘Time’, ‘Death’, ‘Agent ID’, ‘Boundary’, ‘Condition’, and ‘Seed’. 1 condition/seed at a time.
metadata (dict[str, dict[int, dict[str, Any]]]) – Nested dictionary where each condition is an outer key and each initial seed is an inner key. Each seed point to a dictionary with the following keys: ‘bounds’ is of the form [x, y] and gives the dimensions of the spatial environment and ‘fields’ is a dictionary timeseries of the ‘fields’ Store for that condition and initial seed
tag_colors (dict[str, Any]) – Mapping column names in
data
to either RGB tuples or dictionaries containing thecmp
andnorm
keys for thematplotlib.colors.Colormap
andmatplotlib.colors.Normalize
instances to use for that tag If dictionaries are used, themin_color
key is overrridenconc (bool) – Whether to normalize by volume before plotting
snapshot_times (ndarray[Any, dtype[float64]]) – Times (in seconds) to make snapshots for
min_color (Any) – Color for cells with lowest highlight_column value (default white)
out_prefix (str | None) – Prefix for output filename
show_membrane (bool) – Whether to draw outline for agents
return_fig (bool) – Whether to return figure. Only use with one tag.
figsize – Desired size of entire figure
highlight_agent – Mapping of agent IDs to membrane_color and membrane_width. Useful for highlighting specific agents, with rest using defaults
- Return type:
None
- ecoli.analysis.antibiotics_colony.timeseries.plot_timeseries(data, axes, columns_to_plot, highlight_lineage, conc=False, mark_death=False, background_lineages=True, filter_time=True, background_color=(0.5, 0.5, 0.5), background_alpha=0.5, background_linewidth=0.1)[source]
Plot selected traces with specific lineage highlighted and others in gray.
- Parameters:
data (pandas.DataFrame) – DataFrame where each row is an agent and each column is a variable of interest. Must have these columns: ‘Time’, ‘Death’, ‘Agent ID’, ‘Boundary’, ‘Condition’, and ‘Seed’. The first experimental condition in the ‘Condition’ column is treated as a control and plotted in gray. Include at most 2 conditions and 1 seed per condition. If more than 1 condition is supplied, either ensure that they do not share any time points or run with the
restrict_data
option set to true.axes (list[Axes]) – Columns are plotted sequentially on these Axes.
columns_to_plot (dict[str, tuple]) – Dictionary of columns in data to plot sequentially on axes. Each column name corresponds to a RGB tuple to color the trace of the highlighted lineage on that plot.
highlight_lineage (str) – Agent ID to plot lineage trace for. Alternatively, one of ‘mean’ or ‘median’.
conc (bool) – Whether to normalize data by volume and convert to nM
mark_death (bool) – Mark cells that die with red X on time step of death
background_lineages (bool) – Whether to plot traces for other lineages (gray).
filter_time (bool) – Apply default time filter for
data
(take first 11550 seconds from assumed control condition and 11550-26000 seconds from all other conditions)background_color (tuple) – Color used to plot traces for non-highlighted agents
background_alpha (float) – Alpha used to plot traces for non-highlighted agents
background_linewidth (float) – Linewidth for non-highlighted agent traces
- Return type:
None