captest.CapTest.from_mapping

classmethod CapTest.from_mapping(sub, *, key='captest', base_dir=None, meas_loader=None, sim_loader=None)

Construct a CapTest from an already-parsed captest sub-mapping.

Direct-handoff constructor used by downstream wrappers that mutate the captest sub-mapping in memory – applying project-specific defaults, promoting fields, injecting paths – before asking captest to validate and build the CapTest. Exposes the same validate-and-construct pipeline that from_yaml runs after reading the file, without the file read.

Parameters:
  • sub (dict) – Captest sub-mapping. Typically obtained from load_config() or assembled by a downstream wrapper. Must contain test_setup. Supported keys are declared by _CAPTEST_YAML_KEYS / _CAPTEST_OVERRIDE_KEYS. sub is not mutated.

  • key (str, default 'captest') – Purely used in error messages (e.g. “Unknown key ‘x’ under the ‘captest’ sub-mapping”). Match the top-level yaml key under which this sub-mapping would normally live so error messages point users at the right place in their config file.

  • base_dir (str, Path, or None, default None) – Base directory used to resolve relative meas_path / sim_path values in sub. If the sub-mapping contains any relative path and base_dir is None, raises ValueError. URI-scheme values in the sub-mapping (e.g. s3://bucket/path) are treated as absolute and skip resolution even though pathlib.Path.is_absolute() returns False for them. URI-scheme base_dir values are joined to relative paths via string concatenation so the scheme is preserved; local base_dir values are joined via pathlib.Path.

  • meas_loader (callable or None, optional) – Programmatic-only loader callables that override the default resolution (captest.io.load_data / captest.io.load_pvsyst). Same semantics as from_yaml().

  • sim_loader (callable or None, optional) – Programmatic-only loader callables that override the default resolution (captest.io.load_data / captest.io.load_pvsyst). Same semantics as from_yaml().

Return type:

CapTest