qxmt.utils.yaml module#
- qxmt.utils.yaml.load_object_from_yaml(config, dynamic_params={}, use_cache=False)
Extract object from yaml configuration and convert it to a function or class instance.
- Parameters:
config (dict) – configuration of the object
dynamic_params (dict, optional) – dynamic parameters to be passed to the object. Defaults to {}.
use_cache (bool, optional) – use cache when loading the module. Defaults to False.
- Raises:
ModuleNotFoundError – module not found in the path
AttributeError – object not found in the module
TypeError – object is not a class or function
- Returns:
function or instance of the extracted object
- Return type:
Any
- qxmt.utils.yaml.load_yaml_config(file_path)
Load yaml from configuration file.
- Parameters:
file_path (str | Path) – path to the configuration file
- Returns:
configuration
- Return type:
dict
- qxmt.utils.yaml.save_experiment_config_to_yaml(config, save_path, delete_source_path=True)
Save the experiment configuration to a yaml file.
- Parameters:
config (ExperimentConfig) – experiment configuration
save_path (str | Path) – path to save the configuration file
delete_source_path (bool, optional) – delete the source path in the configuration. Defaults to True.
- Return type:
None