ecoli.plots.blame

class ecoli.plots.blame.DivergingNormalize(transform_log=True, within=None)[source]

Bases: Normalize

class ecoli.plots.blame.SignNormalize(vmin=None, vmax=None, clip=False)[source]

Bases: Normalize

Parameters:
  • vmin (float or None) – If vmin and/or vmax is not given, they are initialized from the minimum and maximum value, respectively, of the first input processed; i.e., __call__(A) calls autoscale_None(A).

  • vmax (float or None) – If vmin and/or vmax is not given, they are initialized from the minimum and maximum value, respectively, of the first input processed; i.e., __call__(A) calls autoscale_None(A).

  • clip (bool, default: False) –

    Determines the behavior for mapping values outside the range [vmin, vmax].

    If clipping is off, values outside the range [vmin, vmax] are also transformed linearly, resulting in values outside [0, 1]. For a standard use with colormaps, this behavior is desired because colormaps mark these outside values with specific colors for over or under.

    If True values falling outside the range [vmin, vmax], are mapped to 0 or 1, whichever is closer. This makes these values indistinguishable from regular boundary values and can lead to misinterpretation of the data.

Notes

Returns 0 if vmin == vmax.

ecoli.plots.blame.blame_plot(data, topology, bulk_ids, filename='out/ecoli_sim/blame.png', selected_molecules=None, selected_processes=None, highlight_molecules=None, label_values=True, color_normalize='n')[source]

Given data from a simulation with logged updates (e.g. by running from CLI with –log_updates flag set), generates a heatmap where the columns are processes, rows are molecules, and cell colors reflect the average rate of change in a molecule over the whole simulation due to a particular process.

Parameters:
  • data – Data from a logged ecoli simulation.

  • topology – Topology of logged ecoli simulation (e.g. sim.ecoli_experiment.topology).

  • bulk_ids – Array of bulk IDs in correct order (can get from initial_state).

  • filename – The file to save the plot to. To skip writing to file, set this to None.

  • selected_molecules – if not None, restricts to the specified molecules.

  • selected_processes – if not None, restricts to the specified processes.

  • highlight_molecules – A collection of molecules to highlight in red (or None).

  • label_values – Whether to numerically label the heatmap cells with their values.

  • color_normalize – whether to normalize values within (p)rocesses, (m)olecules, or (n)either.

Returns:

matplotlib axes and figure.

ecoli.plots.blame.extract_bulk(data, bulk_processes, bulk_ids)[source]

Returns bulk updates in form of the array collected_data with dimensions (n_bulk_mols x n_processes), where n_processes is given by the keys that are shared by bulk_processes and data[‘log_update’]. Shared processes are also returned in order.

ecoli.plots.blame.idx_array_from(dictionary)[source]
ecoli.plots.blame.reposition_ticks(ax, x='bottom', y='left')[source]
ecoli.plots.blame.sign_str(val)[source]