agentlib_mpc.utils.plotting package

Submodules

agentlib_mpc.utils.plotting.admm_animation module

Modules that defines functions to be used for automatically creating animations of ADMM convergence

agentlib_mpc.utils.plotting.admm_animation.animate_full(i: int, lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, data: dict[str, pandas.core.frame.DataFrame], time_step: float)[source]
agentlib_mpc.utils.plotting.admm_animation.init_full(lines: dict[str, matplotlib.lines.Line2D], annotation: Annotation, ax: Axes)[source]
agentlib_mpc.utils.plotting.admm_animation.make_animation(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1, interval: int = 300)[source]
agentlib_mpc.utils.plotting.admm_animation.make_image(data: dict[str, pandas.core.frame.DataFrame], time_step: float = 0, file_name: str = '', customize: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, iteration=-1)[source]
agentlib_mpc.utils.plotting.admm_animation.make_lines(labels: list[str], ax: Axes, fig: Figure) dict[str, matplotlib.lines.Line2D][source]

agentlib_mpc.utils.plotting.admm_residuals module

agentlib_mpc.utils.plotting.admm_residuals.load_residuals(file: str | Path) DataFrame[source]

Loads a residuals csv file in the correct format.

agentlib_mpc.utils.plotting.admm_residuals.plot_over_time(residuals: ~pandas.core.frame.DataFrame, primal_tol: float = None, dual_tol: float = None, max_iters: int = None) -> (<class 'matplotlib.figure.Figure'>, (<class 'matplotlib.axes._axes.Axes'>, <class 'matplotlib.axes._axes.Axes'>))[source]

Plots the final residuals over time.

agentlib_mpc.utils.plotting.admm_residuals.plot_single_time_step(residuals: ~pandas.core.frame.DataFrame, time_step: float = None, primal_tol: float = None, dual_tol: float = None) -> (<class 'matplotlib.figure.Figure'>, <class 'matplotlib.axes._axes.Axes'>)[source]

Plots the decrease of the residuals over iterations for a time step

agentlib_mpc.utils.plotting.admm_residuals.residuals_over_time(residuals: DataFrame) DataFrame[source]

Evaluates the residuals over time. Takes a raw residuals DataFrame and returns a Dataframe, which has for each time step the number of iterations and the final primal and dual residuals.

Returns:

DataFrame with float index (time in seconds) and the columns (“primal_residual”, “dual_residual”, “iters”)

agentlib_mpc.utils.plotting.basic module

Some basic plotting utilities

class agentlib_mpc.utils.plotting.basic.EBCColors[source]

Bases: object

blue: tuple[float, float, float] = (0.0, 0.32941176470588235, 0.6235294117647059)
dark_grey: tuple[float, float, float] = (0.3058823529411765, 0.30980392156862746, 0.3137254901960784)
dark_red: tuple[float, float, float] = (0.6745098039215687, 0.16862745098039217, 0.10980392156862745)
ebc_palette_sort_1: list[tuple[float, float, float]] = [(0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)]
ebc_palette_sort_2: list[tuple[float, float, float]] = [(0.8666666666666667, 0.25098039215686274, 0.17647058823529413), (0.0, 0.32941176470588235, 0.6235294117647059), (0.615686274509804, 0.6196078431372549, 0.6274509803921569), (0.4392156862745098, 0.6784313725490196, 0.2784313725490196), (0.6745098039215687, 0.16862745098039217, 0.10980392156862745), (0.3058823529411765, 0.30980392156862746, 0.3137254901960784), (0.9215686274509803, 0.5490196078431373, 0.5058823529411764), (0.615686274509804, 0.7647058823529411, 0.9019607843137255), (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)]
green: tuple[float, float, float] = (0.4392156862745098, 0.6784313725490196, 0.2784313725490196)
grey: tuple[float, float, float] = (0.615686274509804, 0.6196078431372549, 0.6274509803921569)
light_blue: tuple[float, float, float] = (0.615686274509804, 0.7647058823529411, 0.9019607843137255)
light_grey: tuple[float, float, float] = (0.8509803921568627, 0.8509803921568627, 0.8509803921568627)
light_red: tuple[float, float, float] = (0.9215686274509803, 0.5490196078431373, 0.5058823529411764)
red: tuple[float, float, float] = (0.8666666666666667, 0.25098039215686274, 0.17647058823529413)
class agentlib_mpc.utils.plotting.basic.FontDict[source]

Bases: TypedDict

fontsize: float
class agentlib_mpc.utils.plotting.basic.Style(use_tex: bool = False)[source]

Bases: object

class agentlib_mpc.utils.plotting.basic.ValueRange(min: float, max: float)[source]

Bases: object

max: float
min: float
agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, Axes, Style], Tuple[Figure, Axes]] = None, rows: int = 1) tuple[matplotlib.figure.Figure, tuple[matplotlib.axes._axes.Axes, ...]][source]
agentlib_mpc.utils.plotting.basic.make_fig(style: Style, customizer: Callable[[Figure, tuple[matplotlib.axes._axes.Axes], Style], Tuple[Figure, tuple[matplotlib.axes._axes.Axes]]] = None) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]
agentlib_mpc.utils.plotting.basic.make_fig(style: Style) tuple[matplotlib.figure.Figure, matplotlib.axes._axes.Axes]

Creates a figure and axes with an amount of rows. If rows is specified, return a tuple of axes, else only an ax

agentlib_mpc.utils.plotting.basic.make_grid(ax: Axes)[source]
agentlib_mpc.utils.plotting.basic.make_side_legend(ax: Axes, fig: Figure = None, right_position: float = 1)[source]

Module contents