biapy.engine.check_configuration

Configuration checking utilities for BiaPy.

This module provides functions to validate, compare, and update BiaPy configuration objects, ensuring that all required settings are present and consistent for a given workflow. It includes compatibility checks for data, model, augmentation, and post-processing options.

biapy.engine.check_configuration.check_configuration(cfg, jobname, check_data_paths=True)[source]

Validate and update a BiaPy configuration object for workflow consistency.

This function checks that all required configuration options are present and consistent for the selected workflow, model, and data. It performs compatibility checks for data shapes, augmentation, model architecture, loss, metrics, post-processing, and file paths. It also updates dependent configuration variables if needed.

Parameters:
  • cfg (yacs.config.CfgNode) – The configuration object to validate and update.

  • jobname (str) – The job identifier (used for checkpoint path checks).

  • check_data_paths (bool, optional) – Whether to check that all required data paths exist (default: True).

Raises:
  • ValueError – If any configuration inconsistency or missing/invalid option is found.

  • FileNotFoundError – If a required file or directory does not exist.

  • AssertionError – If a configuration assertion fails.

biapy.engine.check_configuration.convert_old_model_cfg_to_current_version(old_cfg: dict) dict[source]

Convert old configuration to the current BiaPy version.

Backward compatibility until commit 6aa291baa9bc5d7fb410454bfcea3a3da0c23604 (version 3.2.0). Commit url: https://github.com/BiaPyX/BiaPy/commit/6aa291baa9bc5d7fb410454bfcea3a3da0c23604

Parameters:

old_cfg (dict) – Configuration to update in case old keys are found.

Returns:

new_cfg – Updated configuration to the current BiaPy version.

Return type:

dict

biapy.engine.check_configuration.diff_between_configs(old_dict: Dict | Config, new_dict: Dict | Config, path: str = '')[source]

Print differences between two given configurations.

Parameters:
  • old_dict (Config or Dict) – First dictionary to compare against new_dict.

  • new_dict (Config or Dict) – Second dictionary to compare against old_dict.

  • path (str) – Path to record the variables. As this function is recursive this will be used automatically to complete the path of the variables.