bencher.results.manim_cartesian

Cartesian product animation for bencher sweep visualisation.

Uses a PIL-based renderer for fast frame-by-frame rendering. No manim dependency required.

Submodules

Classes

CartesianProductCfg

Configuration describing an N-dimensional Cartesian product sweep.

SweepVar

A single dimension of the Cartesian product.

Functions

from_bench_cfg(→ CartesianProductCfg)

Build a CartesianProductCfg from a BenchCfg instance.

render_animation(→ str)

Render the dimensional extrusion animation.

Package Contents

class bencher.results.manim_cartesian.CartesianProductCfg

Configuration describing an N-dimensional Cartesian product sweep.

all_vars includes every dimension — input variables and meta variables (repeat, over_time). They are all first-class dimensions of the product.

all_vars

Every dimension of the Cartesian product.

result_names

Names of the result variables being collected.

all_vars: list[SweepVar] = []
result_names: list[str] = []
strobe_color: tuple[int, int, int] = (80, 80, 80)
strobe_pad: int = 12
strobe_mark_size: int = 2
strobe_mark_gap: int = 4
strobe_mark_row_h: int = 16
strobe_border_radius: int = 4
strobe_base_border_w: int = 2
property ndim: int

Number of dimensions.

property shape: tuple[int, Ellipsis]

Shape of the result tensor.

property total_cells: int

Total number of cells in the Cartesian product.

class bencher.results.manim_cartesian.SweepVar

A single dimension of the Cartesian product.

name

Human-readable variable name (e.g. “theta”, “repeat”).

values

The sampled values for this dimension.

name: str
values: list[Any] = []
bencher.results.manim_cartesian.from_bench_cfg(bench_cfg) CartesianProductCfg

Build a CartesianProductCfg from a BenchCfg instance.

Uses bench_cfg.all_vars (input_vars + meta_vars) so that repeat and over_time are included as full dimensions — they are just more dimensions of the Cartesian product.

This mirrors the extraction pattern in DimsCfg.__init__ (bench_cfg.py).

bencher.results.manim_cartesian.render_animation(cfg: bencher.results.manim_cartesian.cartesian_product_cfg.CartesianProductCfg, width: int = 400, height: int = 300, fps: int = 15, step_frames: int = 4, output_dir: str = 'cachedir/cartesian') str

Render the dimensional extrusion animation.

Parameters:
  • cfg (CartesianProductCfg) – Sweep configuration.

  • width (int) – Video resolution.

  • height (int) – Video resolution.

  • fps (int) – Frames per second.

  • step_frames (int) – Frames to show each extrusion step (per sub-copy).

  • output_dir (str) – Directory for the output video.

Returns:

Path to the output animation file.

Return type:

str