SmartBuildSim

Utilities

smartbuildsim.utils.helpers contains shared helpers for configuration management, randomness, and filesystem preparation.

Key functions

Python example

from pathlib import Path
from smartbuildsim.data.generator import DataGeneratorConfig
from smartbuildsim.utils.helpers import (
    apply_overrides,
    ensure_directory,
    load_yaml,
    model_from_mapping,
)

config_path = Path("examples/configs/default.yaml")
config = load_yaml(config_path)
overrides = ["data.days=5", "models.forecasting.horizon=3"]
customised = apply_overrides(config, overrides)

data_config = model_from_mapping(DataGeneratorConfig, customised.get("data"))
print(data_config)

output_dir = Path(customised.get("paths", {}).get("output_dir", "outputs"))
ensure_directory(output_dir)
print(f"Outputs will be written to {output_dir.resolve()}")

These helpers power the CLI flows described in Command Line Interface and the example script at examples/scripts/run_example.py.