kinextract.load_config_from_toml

kinextract.load_config_from_toml(path: str | Path) FitConfig[source]

Build a FitConfig from a TOML configuration file.

TOML tables are optional and purely organizational: any top-level scalar key, or any key nested one level inside a [section] table, is treated as a FitConfig field. Keys that are not recognized FitConfig fields are dropped with a warning (logged via log()), except for a small set of wrapper-level keys (run_errors_default, run_bootstrap_default, n_bootstrap, n_jobs) consumed by higher-level scripts rather than FitConfig itself. TOML arrays become tuples, matching the tuple-typed FitConfig fields (e.g. xlam_auto_grid, extra_absorption_lines).

Parameters:

path (str or pathlib.Path) – Path to the TOML config file.

Returns:

A validated configuration object (__post_init__ runs as usual).

Return type:

FitConfig

Raises:

ImportError – If neither the standard-library tomllib (Python >= 3.11) nor the tomli backport is available.

Examples

>>> from kinextract import load_config_from_toml
>>> cfg = load_config_from_toml("kinextract.config")

See also

FitConfig

The configuration object this function constructs.

FitConfig.describe

Print all tunable fields, e.g. after loading.