bencher.results.composable_container ==================================== .. py:module:: bencher.results.composable_container Submodules ---------- .. toctree:: :maxdepth: 1 /autoapi/bencher/results/composable_container/composable_container_base/index /autoapi/bencher/results/composable_container/composable_container_dataframe/index /autoapi/bencher/results/composable_container/composable_container_panel/index /autoapi/bencher/results/composable_container/composable_container_rerun/index /autoapi/bencher/results/composable_container/composable_container_video/index Classes ------- .. autoapisummary:: bencher.results.composable_container.ComposeType bencher.results.composable_container.ComposableContainerBase bencher.results.composable_container.PaneLayout bencher.results.composable_container.ComposableContainerVideo bencher.results.composable_container.RenderCfg bencher.results.composable_container.ComposableContainerPanel bencher.results.composable_container.ComposableContainerDataset Package Contents ---------------- .. py:class:: ComposeType Bases: :py:obj:`strenum.StrEnum` StrEnum is a Python ``enum.Enum`` that inherits from ``str``. The default ``auto()`` behavior uses the member name as its value. Example usage:: class Example(StrEnum): UPPER_CASE = auto() lower_case = auto() MixedCase = auto() assert Example.UPPER_CASE == "UPPER_CASE" assert Example.lower_case == "lower_case" assert Example.MixedCase == "MixedCase" .. py:attribute:: right .. py:attribute:: down .. py:attribute:: sequence .. py:attribute:: overlay .. py:method:: flip() .. py:method:: from_horizontal(horizontal: bool) :staticmethod: .. py:class:: ComposableContainerBase A base class for renderer backends. A composable renderer .. py:attribute:: compose_method :type: ComposeType .. py:attribute:: container :type: list[Any] :value: [] .. py:attribute:: label_len :type: int :value: 0 .. py:method:: label_formatter(var_name: str, var_value: int | float | str) -> str :staticmethod: Take a variable name and values and return a pretty version with approximate fixed width :param var_name: The name of the variable, usually a dimension :type var_name: str :param var_value: The value of the dimension :type var_value: int | float | str :returns: Pretty string representation with fixed width :rtype: str .. py:method:: append(obj: Any) -> None Add an object to the container. The relationship between the objects is defined by the ComposeType :param obj: Object to add to the container :type obj: Any .. py:method:: render() Return a representation of the container that can be composed with other render() results. This function can also be used to defer layout and rending options until all the information about the container content is known. You may need to override this method depending on the container. See composable_container_video as an example. :returns: Visual representation of the container that can be combined with other containers :rtype: Any .. py:class:: PaneLayout Bases: :py:obj:`strenum.StrEnum` Controls how multi-dimensional data is laid out in panel displays. grid: Use rows/columns for all dimensions (default, existing behavior) tabs: Use tabs for all outer dimensions, only the innermost uses grid tabs_and_grid: Use tabs for the outermost dimension, grid for inner dimensions .. py:attribute:: grid .. py:attribute:: tabs .. py:attribute:: tabs_and_grid .. py:method:: all() -> list[PaneLayout] :classmethod: Return all layout values. Use this instead of hard-coded name lists. .. py:class:: ComposableContainerVideo Bases: :py:obj:`bencher.results.composable_container.composable_container_base.ComposableContainerBase` A base class for renderer backends. A composable renderer .. py:method:: append(obj: moviepy.VideoClip | moviepy.ImageClip | str | numpy.ndarray) -> None Appends an image or video to the container :param obj: Any representation of an image or video :type obj: VideoClip | ImageClip | str | np.ndarray :raises RuntimeWarning: if file format is not recognised .. py:method:: calculate_duration(frames, render_cfg: RenderCfg) .. py:method:: render(render_cfg: RenderCfg | None = None, **kwargs) -> moviepy.CompositeVideoClip Composes the images/videos into a single image/video based on the type of compose method :param compose_method: optionally override the default compose type. Defaults to None. :type compose_method: ComposeType, optional :returns: A composite video clip containing the images/videos added via append() :rtype: CompositeVideoClip .. py:method:: to_video(render_args: RenderCfg | None = None) -> str Returns the composite video clip as a webm file path :returns: webm filepath :rtype: str .. py:method:: deep() .. py:method:: extend_clip(clip: moviepy.VideoClip, desired_duration: float) .. py:class:: RenderCfg Configuration class for video rendering options. This class controls how videos and images are composed and rendered together. It provides options for timing, layout, appearance, and labeling of the output. .. attribute:: compose_method Method to compose multiple clips (sequence, right, down, overlay). Defaults to ComposeType.sequence. :type: ComposeType .. attribute:: var_name Variable name for labeling. Defaults to None. :type: str, optional .. attribute:: var_value Variable value for labeling. Defaults to None. :type: str, optional .. attribute:: background_col RGB color for background. Defaults to white (255, 255, 255). :type: tuple[int, int, int] .. attribute:: duration Target duration for the composed video in seconds. Defaults to 10.0. :type: float .. attribute:: default_duration Fallback duration when duration is None. Defaults to 10.0. :type: float .. attribute:: duration_target If True, tries to match target duration while respecting frame duration constraints. If False, uses exact duration. Defaults to True. :type: bool .. attribute:: min_frame_duration Minimum duration for each frame in seconds. Defaults to 1/30. :type: float .. attribute:: max_frame_duration Maximum duration for each frame in seconds. Defaults to 2.0. :type: float .. attribute:: margin Margin size in pixels to add around clips. Defaults to 0. :type: int .. py:attribute:: compose_method :type: bencher.results.composable_container.composable_container_base.ComposeType .. py:attribute:: var_name :type: str | None :value: None .. py:attribute:: var_value :type: str | None :value: None .. py:attribute:: background_col :type: tuple[int, int, int] :value: (255, 255, 255) .. py:attribute:: duration :type: float :value: 10.0 .. py:attribute:: default_duration :type: float :value: 10.0 .. py:attribute:: duration_target :type: bool :value: True .. py:attribute:: min_frame_duration :type: float :value: 0.03333333333333333 .. py:attribute:: max_frame_duration :type: float :value: 2.0 .. py:attribute:: margin :type: int :value: 0 .. py:class:: ComposableContainerPanel Bases: :py:obj:`bencher.results.composable_container.composable_container_base.ComposableContainerBase` A base class for renderer backends. A composable renderer .. py:attribute:: name :type: str | None :value: None .. py:attribute:: var_name :type: str | None :value: None .. py:attribute:: var_value :type: str | None :value: None .. py:attribute:: width :type: int | None :value: None .. py:attribute:: background_col :type: str | None :value: None .. py:attribute:: horizontal :type: bool | None :value: None .. py:method:: __post_init__() -> None .. py:method:: append(obj) Add an object to the container. The relationship between the objects is defined by the ComposeType :param obj: Object to add to the container :type obj: Any .. py:method:: render() Return a representation of the container that can be composed with other render() results. This function can also be used to defer layout and rending options until all the information about the container content is known. You may need to override this method depending on the container. See composable_container_video as an example. :returns: Visual representation of the container that can be combined with other containers :rtype: Any .. py:class:: ComposableContainerDataset Bases: :py:obj:`bencher.results.composable_container.composable_container_base.ComposableContainerBase` A base class for renderer backends. A composable renderer .. py:attribute:: var_name :type: str | None :value: None .. py:attribute:: var_value :type: str | None :value: None .. py:method:: render(**kwargs) Return a representation of the container that can be composed with other render() results. This function can also be used to defer layout and rending options until all the information about the container content is known. You may need to override this method depending on the container. See composable_container_video as an example. :returns: Visual representation of the container that can be combined with other containers :rtype: Any