atomica.utils.evaluate_plot_string

atomica.utils.evaluate_plot_string(plot_string)[source]

Evaluate a plotting output specification

The plots in the framework are specified as strings - for example,

>>> plot_string = "{'New active DS-TB':['pd_div:flow','nd_div:flow']}"

This needs to be (safely) evaluated so that the actual dict can be used. This function evaluates a string like this and returns a variable accordingly. For example

>>> x = evaluate_plot_string("{'New active DS-TB':['pd_div:flow','nd_div:flow']}")

is the same as

>>> x = {'New active DS-TB':['pd_div:flow','nd_div:flow']}

This will only happen if tokens associated with dicts and lists are present - otherwise the original string will just be returned directly

Parameters:

plot_string (str) – A string representation of Python structures (e.g., lists, dicts)

Returns:

Evaluated expression, the same as if it has originally been entered in a .py file