energytrackr.plot.builtin_plots packageΒΆ

SubmodulesΒΆ

energytrackr.plot.builtin_plots.bootstrap_comparison moduleΒΆ

BootstrapComparison using BasePlot and mixins for cleaner composition.

class energytrackr.plot.builtin_plots.bootstrap_comparison.BootStats(counts: list[int], lefts: list[float], rights: list[float], low_ci: float, high_ci: float)[source]ΒΆ

Bases: NamedTuple

Statistical summary for bootstrap CI histogram.

counts: list[int]ΒΆ

Alias for field number 0

high_ci: floatΒΆ

Alias for field number 4

lefts: list[float]ΒΆ

Alias for field number 1

low_ci: floatΒΆ

Alias for field number 3

rights: list[float]ΒΆ

Alias for field number 2

class energytrackr.plot.builtin_plots.bootstrap_comparison.BootstrapComparison[source]ΒΆ

Bases: ComparisonBase

Interactive bootstrap CI histogram for Ξ”-median between two commits.

energytrackr.plot.builtin_plots.boxplot_comparison moduleΒΆ

This module implements the BoxplotComparison plot for energytrackr.

BoxplotComparison using BasePlot and composable mixins for cleaner architecture, with notches, median-connecting line, and full/raw data sources restored.

class energytrackr.plot.builtin_plots.boxplot_comparison.BoxplotComparison[source]ΒΆ

Bases: ComparisonBase

Interactive boxplot comparison for two selected commits.

  • quartiles & whiskers

  • notches around medians

  • dashed line connecting medians

  • full & raw data sources for dynamic JS callbacks

  • tilted x-axis labels for readability

class energytrackr.plot.builtin_plots.boxplot_comparison.SingleStats(commit: str, quartiles: tuple[float, float, float], whiskers: tuple[float, float], notch: tuple[float, float])[source]ΒΆ

Bases: object

Statistical summary for a commit: quartiles, whiskers, and notch bounds.

commit: strΒΆ
notch: tuple[float, float]ΒΆ
quartiles: tuple[float, float, float]ΒΆ
whiskers: tuple[float, float]ΒΆ

energytrackr.plot.builtin_plots.change_point_comparison moduleΒΆ

ChangePointComparison using BasePlot and mixins for cleaner composition.

class energytrackr.plot.builtin_plots.change_point_comparison.ChangePointComparison(**params: dict[str, Any])[source]ΒΆ

Bases: FontMixin, HoverMixin, BasePlot, Configurable[ChangePointComparisonConfig]

Renders a median-trend plot with change-point detection overlays.

class energytrackr.plot.builtin_plots.change_point_comparison.ChangePointComparisonConfig(objects: list[str] = <factory>)[source]ΒΆ

Bases: object

Configuration for the ChangePointComparison plot.

objects: list[str]ΒΆ

energytrackr.plot.builtin_plots.cusum_comparison moduleΒΆ

CUSUMComparison using BasePlot and mixins with refactored stats dataclasses.

class energytrackr.plot.builtin_plots.cusum_comparison.CUSJStats(cusum_pos_j: ndarray[tuple[int, ...], dtype[float64]], cusum_neg_j: ndarray[tuple[int, ...], dtype[float64]], cusum_net_j: ndarray[tuple[int, ...], dtype[float64]], upper_j: float)[source]ΒΆ

Bases: object

Joule-based CUSUM statistics.

cusum_neg_j: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
cusum_net_j: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
cusum_pos_j: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
upper_j: floatΒΆ
class energytrackr.plot.builtin_plots.cusum_comparison.CUSPctStats(cusum_pos_pct: ndarray[tuple[int, ...], dtype[float64]], cusum_neg_pct: ndarray[tuple[int, ...], dtype[float64]], cusum_net_pct: ndarray[tuple[int, ...], dtype[float64]], upper_pct: float)[source]ΒΆ

Bases: object

Percentage-based CUSUM statistics.

cusum_neg_pct: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
cusum_net_pct: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
cusum_pos_pct: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
upper_pct: floatΒΆ
class energytrackr.plot.builtin_plots.cusum_comparison.CUSStats(medians: ndarray[tuple[int, ...], dtype[float64]], diffs: ndarray[tuple[int, ...], dtype[float64]], sigma: float, j: CUSJStats, pct: CUSPctStats)[source]ΒΆ

Bases: object

All the series we need for CUSUM Comparison.

diffs: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
j: CUSJStatsΒΆ
medians: ndarray[tuple[int, ...], dtype[float64]]ΒΆ
pct: CUSPctStatsΒΆ
sigma: floatΒΆ
class energytrackr.plot.builtin_plots.cusum_comparison.CUSUMComparison(**params: dict[str, Any])[source]ΒΆ

Bases: FontMixin, HoverMixin, BasePlot, Configurable[CUSUMComparisonConfig]

Enhanced CUSUM chart with both original areas and net-difference shading.

class energytrackr.plot.builtin_plots.cusum_comparison.CUSUMComparisonConfig(objects: list[str] = <factory>)[source]ΒΆ

Bases: object

Configuration for the CUSUMComparison plot.

objects: list[str]ΒΆ

energytrackr.plot.builtin_plots.ecdf_comparison moduleΒΆ

ECDFComparison using BasePlot and mixins for cleaner composition.

class energytrackr.plot.builtin_plots.ecdf_comparison.ECDFComparison[source]ΒΆ

Bases: ComparisonBase

Interactive ECDF comparison between two selected commits.

energytrackr.plot.builtin_plots.evolution_plot moduleΒΆ

EvolutionPlot module with commit-zoom selector and fixed y-axis.

class energytrackr.plot.builtin_plots.evolution_plot.EvolutionPlot(**params: dict[str, Any])[source]ΒΆ

Bases: SingleCommitZoomMixin, FontMixin, BasePlot, Configurable[EvolutionPlotConfig]

Energy-per-commit evolution plot with commit zoom and fixed y-axis.

class energytrackr.plot.builtin_plots.evolution_plot.EvolutionPlotConfig(template: str = 'templates/base_plot.html', objects: list[str] = <factory>, zoom_window: int = 5)[source]ΒΆ

Bases: object

Configuration for EvolutionPlot, including how wide the zoom box is.

objects: list[str]ΒΆ
template: str = 'templates/base_plot.html'ΒΆ
zoom_window: int = 5ΒΆ

energytrackr.plot.builtin_plots.mixins moduleΒΆ

Reusable mixin classes for common plot behavior.

class energytrackr.plot.builtin_plots.mixins.ColorbarMixin[source]ΒΆ

Bases: object

Adds a Viridis palette colorbar on the right.

class energytrackr.plot.builtin_plots.mixins.CommitSelectorsMixin[source]ΒΆ

Bases: object

Adds two Autocomplete selectors for commit A/B with JS callback wiring.

class energytrackr.plot.builtin_plots.mixins.ComparisonBase[source]ΒΆ

Bases: CommitSelectorsMixin, FontMixin, HoverMixin, BasePlot

Abstract base for any β€œcompare-two commits” plot.

class energytrackr.plot.builtin_plots.mixins.FontMixin[source]ΒΆ

Bases: object

Configures consistent fonts for axes and title.

class energytrackr.plot.builtin_plots.mixins.HoverMixin[source]ΒΆ

Bases: object

Adds a hover tool to the first data renderer with custom tooltips.

class energytrackr.plot.builtin_plots.mixins.RangeToolMixin[source]ΒΆ

Bases: object

Adds a drag-to-zoom minimap under the chart.

class energytrackr.plot.builtin_plots.mixins.SingleCommitZoomMixin[source]ΒΆ

Bases: object

Adds an AutocompleteInput to zoom the x-range around one commit.

energytrackr.plot.builtin_plots.mixins.draw_additional_objects(objects: list[str], fig: figure, ctx: Context) None[source]ΒΆ

Draw additional plot objects on the figure.

Parameters:
  • objects (list[str]) – List of object names to be drawn.

  • fig (figure) – The Bokeh figure object.

  • ctx (Context) – The context object containing the data and configuration.

energytrackr.plot.builtin_plots.mixins.get_labels_and_dists(ctx: Context) tuple[list[str], list[ndarray]][source]ΒΆ

Extracts and returns the labels and corresponding distributions from the given context.

Parameters:

ctx (Context) – The context object containing statistical data and artefacts.

Returns:

A tuple containing a list of short hash labels and a list of distributions.

Return type:

tuple[list[str], list[np.ndarray]]

energytrackr.plot.builtin_plots.mixins.initial_commits(labels: Sequence[str]) tuple[str, str][source]ΒΆ

Returns the first and last elements from a sequence of label strings.

Parameters:

labels (Sequence[str]) – A sequence of label strings.

Returns:

A tuple containing the first and last label from the input sequence.

Return type:

tuple[str, str]

energytrackr.plot.builtin_plots.mixins.make_selectors(labels: list[str], js_code_path: str | Path, cb_args: Mapping[str, Any]) tuple[AutocompleteInput, AutocompleteInput][source]ΒΆ

Create two AutocompleteInput widgets wired to the same CustomJS callback.

Parameters:
  • labels (list[str]) – List of labels to be used for the AutocompleteInput widgets.

  • js_code_path (str | Path) – Path to the JavaScript code file for the CustomJS callback.

  • cb_args (Mapping[str, Any]) – Additional arguments to be passed to the CustomJS callback.

Returns:

A tuple containing two AutocompleteInput widgets.

Return type:

tuple[AutocompleteInput, AutocompleteInput]

energytrackr.plot.builtin_plots.qq_comparison moduleΒΆ

QQComparison using BasePlot and mixins for cleaner composition.

class energytrackr.plot.builtin_plots.qq_comparison.QQComparison[source]ΒΆ

Bases: CommitSelectorsMixin, FontMixin, ColorbarMixin, HoverMixin, BasePlot

Interactive QQ-plot comparing two commits with percentile coloring and tooltips.

energytrackr.plot.builtin_plots.registry moduleΒΆ

Registry for BasePlot subclasses, enabling automatic discovery of available plots.

energytrackr.plot.builtin_plots.registry.get_registered_plots() dict[str, type[BasePlot]][source]ΒΆ

Return mapping of plot names to BasePlot subclasses.

Returns:

Mapping of plot names to BasePlot subclasses.

Return type:

dict[str, type[BasePlot]]

energytrackr.plot.builtin_plots.registry.register_plot(plot_cls: type[BasePlot]) type[BasePlot][source]ΒΆ

Class decorator to register a BasePlot subclass.

Usage:

@register_plot
class MyPlot(BasePlot): ...

Registered under its class name.

Parameters:

plot_cls (type[BasePlot]) – A subclass of BasePlot

Returns:

The registered plot class.

Return type:

type[BasePlot]

Raises:

PlotAlreadyRegisteredError – If the plot class is already registered.

energytrackr.plot.builtin_plots.violin_comparison moduleΒΆ

ViolinComparison using BasePlot and mixins for cleaner composition.

class energytrackr.plot.builtin_plots.violin_comparison.ViolinComparison[source]ΒΆ

Bases: ComparisonBase

Interactive violin plot comparing two selected commits with hover tooltips.

Module contentsΒΆ

Builtin plots for energytrackr.