bencher.results.rerun_result ============================ .. py:module:: bencher.results.rerun_result Classes ------- .. autoapisummary:: bencher.results.rerun_result.RerunResult Functions --------- .. autoapisummary:: bencher.results.rerun_result._rv_name_and_path bencher.results.rerun_result._extract_scalar bencher.results.rerun_result._log_to_rerun bencher.results.rerun_result._log_line_graph bencher.results.rerun_result._log_bar_chart bencher.results.rerun_result._log_tensor bencher.results.rerun_result._log_result_var bencher.results.rerun_result._build_blueprint bencher.results.rerun_result._peel_dim_as_grid bencher.results.rerun_result._build_blueprint_contents bencher.results.rerun_result._make_leaf_view Module Contents --------------- .. py:class:: RerunResult(bench_cfg: bencher.bench_cfg.BenchCfg) Bases: :py:obj:`bencher.results.bench_result_base.BenchResultBase` Result class that renders N-dimensional benchmark data into a rerun viewer. Mapping strategy (three phases): **Phase 0 - over_time** (the only rerun timeline): - If ``over_time`` is present it is iterated as the ``log_tick`` timeline. - All other data is logged statically (no timeline scrubber unless ``over_time`` is used). **Phase A - Peel categorical dims** as entity-tree branches: - If cats AND floats exist: peel ALL cats as entity branches. - If cats ONLY (no floats): peel cats until exactly 1 remains (the last cat becomes the BarChart axis). **Phase B - Handle remaining float dims**: - 0 dims -> ``rr.Scalars`` (scalar value) - 1 dim, cat -> ``rr.BarChart`` - 1 dim, float (no over_time) -> line graph via ``_log_line_graph`` - 1 dim, float (inside over_time) -> ``rr.Tensor`` (1-D) - 2 dims -> ``rr.Tensor`` (2-D array displayed as heatmap) - 3 dims -> ``rr.Tensor`` (3-D array displayed as volume slices) - >3 dims -> peel outermost float dim as entity branch, recurse A rerun blueprint is built to control the viewer layout, with typed views (TimeSeriesView, TensorView, BarChartView) arranged in Grid/Vertical containers. The ``log_time`` timeline is disabled so only ``log_tick`` is shown. .. py:method:: to_rerun(result_var: param.Parameter | None = None, width: int = 950, height: int = 712) -> panel.panel Convert N-dimensional benchmark results to a rerun viewer. Saves the recording to an .rrd file and returns a Panel pane with the rerun web viewer embedded as an iframe. Requires the Flask file server to be running (call ``bch.run_flask_in_thread()`` first). :param result_var: Optional specific result variable to display. If None, all are shown. :param width: Width of the rerun viewer widget. :param height: Height of the rerun viewer widget. :returns: A panel pane containing the rerun viewer. .. py:method:: to_rerun_plots(**kwargs) -> panel.panel Plot callback for the rerun backend — drop-in replacement for ``to_auto_plots``. Renders the sweep summary, the rerun viewer, and the post-description, mirroring the structure of ``BenchResult.to_auto_plots`` so that switching ``backend="rerun"`` on ``BenchRunCfg`` produces a familiar report layout. .. py:function:: _rv_name_and_path(entity_path: str, rv) -> tuple[str, str] Return (rv_name, entity_path/rv_name) for a result variable. .. py:function:: _extract_scalar(dataset: xarray.Dataset, rv_name: str, sel: dict | None = None) Extract a scalar value from *dataset[rv_name]*, optionally slicing first. .. py:function:: _log_to_rerun(rr, recording, dataset: xarray.Dataset, entity_path: str, result_vars: list, float_dims: list[str], cat_dims: list[str], time_dim: str | None, inside_time_iteration: bool = False) Recursively map N-dimensional data to rerun entity paths and timelines. Phase 0: iterate over_time as the sole rerun timeline (``log_tick``). Phase A: peel categorical dims as entity-tree branches. Phase B: map remaining float dims to native rerun archetypes (Scalars, BarChart, line graph, or Tensor). .. py:function:: _log_line_graph(rr, recording, dataset: xarray.Dataset, entity_path: str, rv, float_dim: str) Log a 1D float sweep as a line graph by iterating the float dim as log_tick. .. py:function:: _log_bar_chart(rr, recording, dataset: xarray.Dataset, entity_path: str, rv, cat_dim: str) Log a result variable as a BarChart over a categorical dimension. .. py:function:: _log_tensor(rr, recording, dataset: xarray.Dataset, entity_path: str, rv, dims: list[str]) Log a result variable as an N-D Tensor (heatmap for 2D, volume for 3D). .. py:function:: _log_result_var(rr, recording, dataset: xarray.Dataset, entity_path: str, rv) Log a single result variable to rerun at the current entity path. .. py:function:: _build_blueprint(rrb, result_vars, float_dims, cat_dims, time_dim, dim_values) Build a rerun Blueprint with typed views matching the data layout. .. py:function:: _peel_dim_as_grid(rrb, entity_path, dim, dim_values, build_child) Build a Grid by peeling *dim* and calling *build_child* for each value. .. py:function:: _build_blueprint_contents(rrb, entity_path: str, result_vars: list, float_dims: list[str], cat_dims: list[str], time_dim: str | None, dim_values: dict[str, list[str]], inside_time_iteration: bool = False) Recursively build blueprint containers/views mirroring _log_to_rerun structure. .. py:function:: _make_leaf_view(rrb, entity_path, rv, all_dims, cat_dims, inside_time_iteration) Build a single typed rerun view for a result variable.