mythos.ui.loggers.jupyter ========================= .. py:module:: mythos.ui.loggers.jupyter .. autoapi-nested-parse:: Implements a plotly logger for use in Jupyter notebooks. Attributes ---------- .. autoapisummary:: mythos.ui.loggers.jupyter.LBL_TOP_HEADER mythos.ui.loggers.jupyter.LBL_PROG_BAR mythos.ui.loggers.jupyter.LBL_SIM_HEADER mythos.ui.loggers.jupyter.LBL_OBS_HEADER mythos.ui.loggers.jupyter.LBL_OBJ_HEADER mythos.ui.loggers.jupyter.WARN_INVALID_NCOLS_NROWS mythos.ui.loggers.jupyter.figure_widget_f mythos.ui.loggers.jupyter.scatter_f mythos.ui.loggers.jupyter.make_subplots_f Classes ------- .. autoapisummary:: mythos.ui.loggers.jupyter.PlotlyLogger mythos.ui.loggers.jupyter.JupyterLogger Functions --------- .. autoapisummary:: mythos.ui.loggers.jupyter.calc_rows_and_columns mythos.ui.loggers.jupyter.setup_figure_layout Module Contents --------------- .. py:data:: LBL_TOP_HEADER :value: 'Optimization Status' .. py:data:: LBL_PROG_BAR :value: 'Optimizing' .. py:data:: LBL_SIM_HEADER :value: 'Simulators' .. py:data:: LBL_OBS_HEADER :value: 'Observables' .. py:data:: LBL_OBJ_HEADER :value: 'Objectives' .. py:data:: WARN_INVALID_NCOLS_NROWS :value: 'The number of rows and columns is less than the number of plots. Adjusting the number of rows... .. py:data:: figure_widget_f .. py:data:: scatter_f .. py:data:: make_subplots_f .. py:function:: calc_rows_and_columns(n_plots: int, nrows: int | None, ncols: int | None) -> tuple[int, int] Calculate the number of rows and columns for the plot. :param n_plots: the number of plots :param nrows: the number of rows in the plot :param ncols: the number of columns in the plot :returns: the number of rows and columns :rtype: tuple[int, int] .. py:function:: setup_figure_layout(fig: plotly.graph_objects.FigureWidget, nrows: int, ncols: int, trace_names: list[str | list[str]]) -> None Setup the layout of the plotly figure. :param fig: the plotly figure :param nrows: the number of rows in the plot :param ncols: the number of columns in the plot :param trace_names: the names of the traces .. py:class:: PlotlyLogger(observable_plots: list[str | list[str]], nrows: int | None, ncols: int | None, width_px: int | None = None, height_px: int | None = None) Bases: :py:obj:`mythos.ui.loggers.logger.Logger` A logger for use in Jupyter notebooks that uses plotly. .. py:attribute:: fig .. py:attribute:: observable_plots .. py:method:: log_metric(name: str, value: float, step: int) -> None Log a metric to the plotly figure. .. py:method:: update_status(name: str, status: mythos.ui.loggers.logger.Status) -> None Null operation. .. py:method:: change_size(width_px: int | None = None, height_px: int | None = None) -> None Change the size of the plotly figure. :param width_px: the width of the figure in pixels :type width_px: int | None :param height_px: the height of the figure in pixels :type height_px: int | None .. py:method:: show() -> plotly.graph_objects.FigureWidget Show the plotly figure in a Jupyter notebook. .. py:class:: JupyterLogger(simulators: list[str], observables: list[str], objectives: list[str], metrics_to_log: list[list[str] | str], max_opt_steps: int, plots_size_px: tuple[int, int] | None = None, plots_nrows_ncols: tuple[int, int] | None = None) Bases: :py:obj:`mythos.ui.loggers.logger.Logger` A logger for use in Jupyter notebooks. .. py:attribute:: STATUS_STYLE :type: ClassVar[dict[mythos.ui.loggers.logger.Status, dict[str, str]]] .. py:attribute:: prog_bar .. py:attribute:: sim_btns .. py:attribute:: obs_btns .. py:attribute:: obj_btns .. py:attribute:: btn_map .. py:attribute:: plots .. py:attribute:: percent_complete .. py:attribute:: dashboard .. py:method:: show() -> ipywidgets.DOMWidget Show the Jupyter dashboard. .. py:method:: increment_prog_bar(value: int = 1) -> None Increment the progress bar by `value`. .. py:method:: log_metric(name: str, value: float, step: int) -> None Log the `value` for `name` at `step`. :param name: the name of the metric :type name: str :param value: the value of the metric :type value: float :param step: the step at which the metric was recorded :type step: int .. py:method:: update_status(name: str, kind: mythos.ui.loggers.logger.StatusKind, status: mythos.ui.loggers.logger.Status) -> None Updates the status of a simulator, objective, or observable.