Configuration

Hydra

Contains utilities for managing Hydra-based calibration configurations.

This module defines utility functions for managing and configuring calibration workflows via Hydra.

class calisim.config.hydra_bridge.HydraConfiguration[source]

Utility wrapper around Hydra config composition and instantiation.

apply_overrides(cfg: DictConfig, overrides: list[str]) DictConfig | None[source]

Override the contents of the configuration.

Parameters:
  • cfg (DictConfig) – The configuration object.

  • overrides (list[str]) – Overrides for the configuration.

Returns:

The overridden configuration.

Return type:

DictConfig | None

property available: bool

Check if Hydra is available.

Returns:

Whether Hydra is available.

Return type:

bool

get_configuration(config_name: str, config_dir: str, job_name: str = 'app', overrides: list[str] | None = None) DictConfig | None[source]

Get the configuration object.

Parameters:
  • config_name (str) – The name of the configuration file.

  • config_dir (str) – The configuration directory file path.

  • job_name (str, optional) – The name of the Hydra job. Defaults to “app”.

  • overrides (list[str] | None, optional) – Overrides for the configuration. Defaults to None.

Returns:

The configuration object.

Return type:

DictConfig | None

get_raw_config(config_name: str, config_dir: str, job_name: str = 'app', overrides: list[str] | None = None) dict | None[source]

Get the raw configuration object.

Parameters:
  • config_name (str) – The name of the configuration file.

  • config_dir (str) – The configuration directory file path.

  • job_name (str, optional) – The name of the Hydra job. Defaults to “app”.

  • overrides (list[str] | None, optional) – Overrides for the configuration. Defaults to None.

Returns:

The configuration object.

Return type:

dict | None

instantiate(cfg: dict) DictConfig | None[source]

Instantiate the raw configuration object.

Parameters:

cfg (dict) – The raw configuration dictionary.

Returns:

The instantiated configuration.

Return type:

DictConfig | None

merge(*configs: DictConfig) DictConfig | None[source]

Merge a list of configuration objects into one.

Parameters:

configs (DictConfig) – A variable number of configuration objects to merge.

Returns:

The merged configuration object.

Return type:

DictConfig | None

pretty(cfg: DictConfig) str[source]

Prettify the configuration object.

Parameters:

cfg (DictConfig) – The configuration object.

Returns:

The configuration object as a string.

Return type:

str

to_dict(cfg: DictConfig) dict | None[source]

Convert a configuration object to a dictionary.

Parameters:

cfg (DictConfig) – The configuration object.

Returns:

The converted configuration.

Return type:

dict | None

validate(cfg: DictConfig) bool[source]

Validate the configuration object.

Parameters:

cfg (DictConfig) – The configuration object.

Returns:

Whether the configuration object is valid.

Return type:

bool