energytrackr.plot package¶
Subpackages¶
- energytrackr.plot.builtin_data_transforms package
- Submodules
- energytrackr.plot.builtin_data_transforms.commit_details module
- energytrackr.plot.builtin_data_transforms.commit_stats module
- energytrackr.plot.builtin_data_transforms.compute_distribution module
- energytrackr.plot.builtin_data_transforms.detect_changes module
- energytrackr.plot.builtin_data_transforms.filter_outliers module
- energytrackr.plot.builtin_data_transforms.load_csv module
- Module contents
- energytrackr.plot.builtin_page_sections package
- Submodules
- energytrackr.plot.builtin_page_sections.base module
- energytrackr.plot.builtin_page_sections.change_table module
- energytrackr.plot.builtin_page_sections.level_legend module
- energytrackr.plot.builtin_page_sections.plot_embed module
- energytrackr.plot.builtin_page_sections.summary_box module
- Module contents
- energytrackr.plot.builtin_plot_objects package
- Submodules
- energytrackr.plot.builtin_plot_objects.bollinger_bands module
- energytrackr.plot.builtin_plot_objects.candlestick module
- energytrackr.plot.builtin_plot_objects.change_events module
- energytrackr.plot.builtin_plot_objects.distribution_scatter module
- energytrackr.plot.builtin_plot_objects.dynamic_ticks module
- energytrackr.plot.builtin_plot_objects.ema_line module
- energytrackr.plot.builtin_plot_objects.error_bars module
- energytrackr.plot.builtin_plot_objects.legend_policy module
- energytrackr.plot.builtin_plot_objects.macd_line module
- energytrackr.plot.builtin_plot_objects.median_line module
- energytrackr.plot.builtin_plot_objects.series_line module
- energytrackr.plot.builtin_plot_objects.sma_line module
- Module contents
- energytrackr.plot.builtin_plots package
- Submodules
- energytrackr.plot.builtin_plots.bootstrap_comparison module
- energytrackr.plot.builtin_plots.boxplot_comparison module
- energytrackr.plot.builtin_plots.change_point_comparison module
- energytrackr.plot.builtin_plots.cusum_comparison module
- energytrackr.plot.builtin_plots.ecdf_comparison module
- energytrackr.plot.builtin_plots.evolution_plot module
- energytrackr.plot.builtin_plots.mixins module
- energytrackr.plot.builtin_plots.qq_comparison module
- energytrackr.plot.builtin_plots.registry module
- energytrackr.plot.builtin_plots.violin_comparison module
- Module contents
Submodules¶
energytrackr.plot.config module¶
Configuration module for plot module for EnergyTrackr.
- class energytrackr.plot.config.AnalysisCfg(*, thresholds: Thresholds = Thresholds(normality_p=0.05, welch_p=0.05, min_pct_increase=0.02, min_values_for_normality_test=3, cohen_d={'negligible': 0.2, 'small': 0.5, 'medium': 0.8, 'large': 1.2}, pct_change={'minor': 0.05, 'moderate': 0.1, 'major': inf}, practical={'info': 0.05, 'warning': 0.1, 'critical': 0.2}))[source]
Bases:
BaseModelConfiguration model for analysis steps and thresholds.
- thresholds
An instance of the Thresholds class specifying threshold values for the analysis. Defaults to a new Thresholds instance.
- Type:
Thresholds
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- thresholds: Thresholds
- class energytrackr.plot.config.ColumnCfg(*, key: str | None = None, group: str | None = None, label: str | None = None, width: str | None = None, align: Literal['left', 'right', 'center'] | None = None, fmt: str | None = None, include: Sequence[str] = (), exclude: Sequence[str] = ())[source]
Bases:
BaseModelConfiguration model for a table column in the plotting module.
- key
The unique identifier for the column, typically corresponding to a data field.
- Type:
str | None
- group
Optional group name to which this column belongs.
- Type:
str | None
- label
Display label for the column header.
- Type:
str | None
- width
Optional width specification for the column (e.g., ‘100px’, ‘10%’).
- Type:
str | None
- align
Text alignment for the column content.
- Type:
Literal[“left”, “right”, “center”] | None
- fmt
Optional format string for displaying the column’s values.
- Type:
str | None
- include
Sequence of dataset names or contexts where this column should be included.
- Type:
Sequence[str]
- exclude
Sequence of dataset names or contexts where this column should be excluded.
- Type:
Sequence[str]
- align: Literal['left', 'right', 'center'] | None
- exclude: Sequence[str]
- fmt: str | None
- group: str | None
- include: Sequence[str]
- key: str | None
- label: str | None
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- width: str | None
- class energytrackr.plot.config.DataCfg(*, csv_columns: Sequence[str] = ('commit', 'energy-pkg', 'energy-core', 'energy-gpu'), energy_fields: Sequence[str] = ('energy-pkg', 'energy-core', 'energy-gpu'), min_measurements: int = 2, drop_outliers: bool = True, outlier_iqr: float = 1.5)[source]
Bases:
BaseModelConfiguration model for energy data plotting.
- csv_columns
Tuple of column names expected in the CSV data, including commit identifier and energy measurements.
- Type:
Sequence[str]
- energy_fields
Tuple of column names corresponding to energy measurement fields.
- Type:
Sequence[str]
- min_measurements
Minimum number of measurements required for analysis.
- Type:
int
- drop_outliers
Whether to remove outlier data points based on the IQR method.
- Type:
bool
- outlier_iqr
The interquartile range (IQR) multiplier used to determine outliers.
- Type:
float
- csv_columns: Sequence[str]
- drop_outliers: bool
- energy_fields: Sequence[str]
- min_measurements: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- outlier_iqr: float
- class energytrackr.plot.config.EnergyTrackRCfg(*, data: DataCfg = DataCfg(csv_columns=('commit', 'energy-pkg', 'energy-core', 'energy-gpu'), energy_fields=('energy-pkg', 'energy-core', 'energy-gpu'), min_measurements=2, drop_outliers=True, outlier_iqr=1.5), analysis: AnalysisCfg = AnalysisCfg(thresholds=Thresholds(normality_p=0.05, welch_p=0.05, min_pct_increase=0.02, min_values_for_normality_test=3, cohen_d={'negligible': 0.2, 'small': 0.5, 'medium': 0.8, 'large': 1.2}, pct_change={'minor': 0.05, 'moderate': 0.1, 'major': inf}, practical={'info': 0.05, 'warning': 0.1, 'critical': 0.2})), report: ReportCfg = ReportCfg(theme='light', font='Roboto', font_size=12, chart={}), plot: PlotCfg = PlotCfg(transforms=(), objects=(), page=(), plots=()))[source]
Bases:
BaseModelConfiguration model for the EnergyTrackR application.
This class aggregates the main configuration sections required for the application, including data handling, analysis, reporting, plotting, and plugins. Each section is represented by its own configuration model.
- data
Configuration for data sources and preprocessing.
- Type:
DataCfg
- analysis
Settings for analysis routines and parameters.
- Type:
AnalysisCfg
- report
Options for report generation and formatting.
- Type:
ReportCfg
- plot
Plotting and visualization configuration.
- Type:
PlotCfg
- plugins
Plugin management and extension settings.
- Type:
PluginsCfg
- analysis: AnalysisCfg
- data: DataCfg
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- plot: PlotCfg
- report: ReportCfg
- class energytrackr.plot.config.PlotCfg(*, transforms: Sequence[dict[str, Any]] = (), objects: Sequence[dict[str, Any]] = (), page: Sequence[dict[str, Any]] = (), plots: Sequence[dict[str, Any]] = ())[source]
Bases:
BaseModelConfiguration model for plotting.
- transforms
A sequence of transformation configurations to be applied to the plot data.
- Type:
Sequence[dict[str, Any]]
- objects
A sequence of plot object configurations (e.g., lines, bars, markers).
- Type:
Sequence[dict[str, Any]]
- page
A sequence of page-level configuration dictionaries (e.g., layout, titles).
- Type:
Sequence[dict[str, Any]]
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- objects: Sequence[dict[str, Any]]
- page: Sequence[dict[str, Any]]
- plots: Sequence[dict[str, Any]]
- transforms: Sequence[dict[str, Any]]
- class energytrackr.plot.config.ReportCfg(*, theme: str = 'light', font: str = 'Roboto', font_size: int = 12, chart: dict[str, ~typing.Any] = <factory>)[source]
Bases:
BaseModelConfiguration model for report settings.
- theme
The theme to use for the report, e.g., “light” or “dark”. Defaults to “light”.
- Type:
str
- chart
Dictionary containing chart-specific configuration options.
- Type:
dict[str, Any]
- chart: dict[str, Any]
- font: str
- font_size: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- theme: str
- class energytrackr.plot.config.Settings(*, energytrackr: EnergyTrackRCfg)[source]
Bases:
BaseModelFacade imported by all modules: from plot.config import get_settings().
- energytrackr: EnergyTrackRCfg
- classmethod load(path: Path | str | None = None) Settings[source]
Load the configuration settings from a YAML file.
This class method attempts to load configuration data from the specified path. If no path is provided, it defaults to ‘plot.yml’ in the current working directory. If the file does not exist, it returns a Settings instance with built-in defaults. If the file exists, it parses the YAML content and expects a top-level ‘energytrackr’ key. Raises a KeyError if the required key is missing. If the configuration is invalid, logs the error and exits the program.
- Parameters:
path (Path | str | None, optional) – The path to the YAML configuration file. Defaults to None.
- Returns:
An instance of the Settings class loaded with configuration data.
- Return type:
Settings
- Raises:
MissingEnergyTrackrKeyError – If the top-level ‘energytrackr’ key is missing in the YAML file.
SystemExit – If the configuration file is invalid.
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- class energytrackr.plot.config.Thresholds(*, normality_p: float = 0.05, welch_p: float = 0.05, min_pct_increase: float = 0.02, min_values_for_normality_test: int = 3, cohen_d: dict[str, float] = <factory>, pct_change: dict[str, float] = <factory>, practical: dict[str, float] = <factory>)[source]
Bases:
BaseModelConfiguration model for statistical thresholds used in energy analysis.
- No-index:
- normality_p
Significance level for normality tests (default: 0.05).
- Type:
float
- welch_p
Significance level for Welch’s t-test (default: 0.05).
- Type:
float
- min_pct_increase
Minimum percentage increase considered significant (default: 0.02).
- Type:
float
- cohen_d
Dictionary mapping metric names to Cohen’s d effect size thresholds.
- Type:
dict[str, float]
- pct_change
Dictionary mapping metric names to percentage change thresholds.
- Type:
dict[str, float]
- practical
Dictionary mapping metric names to practical significance thresholds.
- Type:
dict[str, float]
- cohen_d: dict[str, float]
- min_pct_increase: float
- min_values_for_normality_test: int
- model_config: ClassVar[ConfigDict] = {}
Configuration for the model, should be a dictionary conforming to [ConfigDict][pydantic.config.ConfigDict].
- normality_p: float
- pct_change: dict[str, float]
- practical: dict[str, float]
- welch_p: float
- energytrackr.plot.config.get_settings(path: Path | str | None = None) Settings[source]
Return the singleton Settings, loading + validating once.
Subsequent calls ignore path and return the cached instance.
- Parameters:
path (Path | str | None) – Path to the YAML configuration file. If None, defaults to “plot.yml” in the current directory.
- Returns:
An instance of the Settings class, containing
- Return type:
Settings
energytrackr.plot.pipeline module¶
Main orchestration module for energy consumption data analysis and reporting.
- energytrackr.plot.pipeline.plot(input_path: str, git_repo_path: str | None = None, config_path: str | None = None) None[source]¶
Main entry point: orchestrate loading, plotting, and report generation.
- Parameters:
input_path (str) – Path to the CSV file containing energy data.
git_repo_path (str | None) – Optional path to a Git repository.
config_path (str | None) – Optional path to the configuration file.
Module contents¶
Plot module for energytrackr.