bencher.results.composable_container
Submodules
- bencher.results.composable_container.composable_container_base
- bencher.results.composable_container.composable_container_dataframe
- bencher.results.composable_container.composable_container_panel
- bencher.results.composable_container.composable_container_rerun
- bencher.results.composable_container.composable_container_video
Classes
StrEnum is a Python |
|
A base class for renderer backends. A composable renderer |
|
Controls how multi-dimensional data is laid out in panel displays. |
|
A base class for renderer backends. A composable renderer |
|
Configuration class for video rendering options. |
|
A base class for renderer backends. A composable renderer |
|
A base class for renderer backends. A composable renderer |
Package Contents
- class bencher.results.composable_container.ComposeType
Bases:
strenum.StrEnumStrEnum is a Python
enum.Enumthat inherits fromstr. The defaultauto()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"
- right
- down
- sequence
- overlay
- flip()
- static from_horizontal(horizontal: bool)
- class bencher.results.composable_container.ComposableContainerBase
A base class for renderer backends. A composable renderer
- compose_method: ComposeType
- container: list[Any] = []
- label_len: int = 0
- static label_formatter(var_name: str, var_value: int | float | str) str
Take a variable name and values and return a pretty version with approximate fixed width
- Parameters:
var_name (str) – The name of the variable, usually a dimension
var_value (int | float | str) – The value of the dimension
- Returns:
Pretty string representation with fixed width
- Return type:
str
- append(obj: Any) None
Add an object to the container. The relationship between the objects is defined by the ComposeType
- Parameters:
obj (Any) – Object to add to the container
- 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
- Return type:
Any
- class bencher.results.composable_container.PaneLayout
Bases:
strenum.StrEnumControls 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
- grid
- tabs
- tabs_and_grid
- classmethod all() list[PaneLayout]
Return all layout values. Use this instead of hard-coded name lists.
- class bencher.results.composable_container.ComposableContainerVideo
Bases:
bencher.results.composable_container.composable_container_base.ComposableContainerBaseA base class for renderer backends. A composable renderer
- append(obj: moviepy.VideoClip | moviepy.ImageClip | str | numpy.ndarray) None
Appends an image or video to the container
- Parameters:
obj (VideoClip | ImageClip | str | np.ndarray) – Any representation of an image or video
- Raises:
RuntimeWarning – if file format is not recognised
- 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
- Parameters:
compose_method (ComposeType, optional) – optionally override the default compose type. Defaults to None.
- Returns:
A composite video clip containing the images/videos added via append()
- Return type:
CompositeVideoClip
- to_video(render_args: RenderCfg | None = None) str
Returns the composite video clip as a webm file path
- Returns:
webm filepath
- Return type:
str
- deep()
- extend_clip(clip: moviepy.VideoClip, desired_duration: float)
- class bencher.results.composable_container.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.
- compose_method
Method to compose multiple clips (sequence, right, down, overlay). Defaults to ComposeType.sequence.
- Type:
- var_name
Variable name for labeling. Defaults to None.
- Type:
str, optional
- var_value
Variable value for labeling. Defaults to None.
- Type:
str, optional
- background_col
RGB color for background. Defaults to white (255, 255, 255).
- Type:
tuple[int, int, int]
- duration
Target duration for the composed video in seconds. Defaults to 10.0.
- Type:
float
- default_duration
Fallback duration when duration is None. Defaults to 10.0.
- Type:
float
- duration_target
If True, tries to match target duration while respecting frame duration constraints. If False, uses exact duration. Defaults to True.
- Type:
bool
- min_frame_duration
Minimum duration for each frame in seconds. Defaults to 1/30.
- Type:
float
- max_frame_duration
Maximum duration for each frame in seconds. Defaults to 2.0.
- Type:
float
- margin
Margin size in pixels to add around clips. Defaults to 0.
- Type:
int
- var_name: str | None = None
- var_value: str | None = None
- background_col: tuple[int, int, int] = (255, 255, 255)
- duration: float = 10.0
- default_duration: float = 10.0
- duration_target: bool = True
- min_frame_duration: float = 0.03333333333333333
- max_frame_duration: float = 2.0
- margin: int = 0
- class bencher.results.composable_container.ComposableContainerPanel
Bases:
bencher.results.composable_container.composable_container_base.ComposableContainerBaseA base class for renderer backends. A composable renderer
- name: str | None = None
- var_name: str | None = None
- var_value: str | None = None
- width: int | None = None
- background_col: str | None = None
- horizontal: bool | None = None
- __post_init__() None
- append(obj)
Add an object to the container. The relationship between the objects is defined by the ComposeType
- Parameters:
obj (Any) – Object to add to the container
- 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
- Return type:
Any
- class bencher.results.composable_container.ComposableContainerDataset
Bases:
bencher.results.composable_container.composable_container_base.ComposableContainerBaseA base class for renderer backends. A composable renderer
- var_name: str | None = None
- var_value: str | None = None
- 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
- Return type:
Any