bencher.results.video_summary

Classes

VideoSummaryResult

Module Contents

class bencher.results.video_summary.VideoSummaryResult(bench_cfg: bencher.bench_cfg.BenchCfg)

Bases: bencher.results.bench_result_base.BenchResultBase

to_video_summary(result_var: param.Parameter | None = None, reverse: bool = True, result_types=(ResultImage,), **kwargs) panel.panel | None
to_video_grid(result_var: param.Parameter | None = None, result_types=(ResultImage,), pane_collection: panel.pane = None, time_sequence_dimension=0, target_duration: float | None = None, compose_method_list: list | None = None, **kwargs) panel.panel | None

Returns the results compiled into a video

Parameters:
  • result_var (Parameter, optional) – The result var to plot. Defaults to None.

  • result_types (tuple, optional) – The types of result var to convert to video. Defaults to (ResultImage,).

  • collection (pn.pane, optional) – If there are multiple results, use this collection to stack them. Defaults to pn.Row().

  • (list (compose_method_list) – optional): Defines how each of the dimensions is composed in the video. ie, concatenate the videos horizontally, vertically, sequentially or alpha overlay. Seee bn.ComposeType for the options.

Returns:

a panel pane with a video of all results concatenated together

Return type:

pn.panel | None

to_video_grid_ds(dataset: xarray.Dataset, result_var: param.Parameter, reverse=True, time_sequence_dimension=0, video_controls: bencher.results.video_controls.VideoControls | None = None, target_duration: float | None = None, compose_method_list: list | None = None, target_dimension: int = 0, **kwargs)

Creates a video grid from the provided dataset.

This method generates a video by composing multiple plot panes into a grid layout and renders them as a video file.

Parameters:
  • dataset (xr.Dataset) – The dataset containing benchmark results.

  • result_var (Parameter) – The result variable to plot.

  • reverse (bool, optional) – Whether to reverse the sequence. Defaults to True.

  • time_sequence_dimension (int, optional) – The dimension to use for time sequencing. Defaults to 0.

  • video_controls (VideoControls, optional) – Controls for video playback. If None, creates default controls.

  • target_duration (float, optional) – Target duration for the video in seconds.

  • compose_method_list (list, optional) – List of composition methods for combining panes.

  • target_dimension (int, optional) – The target dimensionality for data filtering. Defaults to 0.

  • **kwargs – Additional keyword arguments passed to video rendering.

Returns:

A video container with playback controls if successful, None otherwise.

Return type:

pn.pane.HTML | None

plot_cb(dataset, result_var, **kwargs)
dataset_to_compose_list(dataset: xarray.Dataset, first_compose_method: bencher.results.composable_container.composable_container_video.ComposeType = ComposeType.down, time_sequence_dimension: int = 0) list[bencher.results.composable_container.composable_container_video.ComposeType]

“Given a dataset, chose an order for composing the results. By default will flip between right and down and the last dimension will be a time sequence.

Parameters:
  • dataset (xr.Dataset) – the dataset to render

  • first_compose_method (ComposeType, optional) – the direction of the first composition method. Defaults to ComposeType.right.

  • time_sequence_dimension (int, optional) – The dimension to start time sequencing instead of composing in space. Defaults to 0.

Returns:

A list of composition methods for composing the dataset result

Return type:

list[ComposeType]

_to_video_panes_ds(dataset: xarray.Dataset, plot_callback: Callable | None = None, target_dimension=0, compose_method=ComposeType.right, compose_method_list=None, result_var=None, time_sequence_dimension=0, root_dimensions=None, reverse=False, target_duration: float | None = None, **kwargs) panel.panel