ecoli.plots.blame_timeseries

ecoli.plots.blame_timeseries.blame_timeseries(data, topology, bulk_ids, molecules, filename=None, yscale='linear')[source]

Generates timeseries blame plots for the selected bulk molecules assuming that bulk data is an array of counts ordered by bulk_ids and saves to the specified output file. Timeseries blame plots show the change in molecule counts due to each process at each timestep. For convenience, exact count plots are included to the side.

Example usage:

sim = EcoliSim.from_file()
sim.build_ecoli()
sim.run()
data = sim.query()
data = {key: val['agents']['0'] for key, val in data.items()}
store_configs = sim.ecoli_experiment.get_config()
bulk_ids = store_configs['agents']['0']['bulk']['_properties']['metadata']
blame_timeseries(data, sim.topology, bulk_ids
                ['WATER[c]', 'APORNAP-CPLX[c]', 'TRP[c]'],
                'out/ecoli_master/test_blame_timeseries.png',
                yscale="linear")
Parameters:
  • data (dict) – Data from an experiment (for experiments with cell division, ensure that bulk is a top-level field in the sub-dictionaries for each time point)

  • topology (dict) – Experiment topology (used to determine which processes are connected to bulk and how)

  • bulk_ids (list[str]) – List (or array) of bulk molecule names in the order they appear in the structured bulk Numpy array (see Bulk Molecules). Typically retrieved from simulation config metadata.

  • molecules (list[str]) – List of bulk molecule names to plot data for

  • filename (str) – Path to save plot to (optional)

  • yscale (str) – See matplotlib.pyplot.yscale()

Returns:

Axes and figure

Return type:

tuple[Axes, Figure]

ecoli.plots.blame_timeseries.preprocess_data(data, bulk_ids, bulk_processes, molecules)[source]

Prepares raw data for blame-timeseries plot. Returns data in the form time, process, values_array where time is a numpy array of times, process is a list of process names, and values_array is a numpy array of the form (molecule x time x process).

ecoli.plots.blame_timeseries.signed_stacked_bar(ax, x, y, bar_labels)[source]

ax: Axes object x: x values (1d array) y: y-values (len(x) columns by # stacked bars rows)

Creates a stacked bar chart in the specified Axes, where y’s with negative values represent bars below y=0, and y’s with positive values represent bars above y=0.

ecoli.plots.blame_timeseries.validate_data(data)[source]