hydromodpy.calibration.state#

Shared state primitives reused by both calibration runners.

The functions in this module deal with the out-of-loop concerns:

  • default CalibrationStore factory,

  • params_hash cache preload from DuckDB,

  • input-file fingerprinting feeding the params_hash context,

  • helpers to translate a TOML calibration declaration into a runtime ParameterSpace.

They are intentionally decoupled from the ask/tell loop so the CLI and programmatic runners can share the same plumbing.

Functions

build_cache_context(*, cfg, trial_ctx, ...)

Return the scientific context that scopes calibration cache hits.

default_store_factory(workspace, persistence)

Open the default calibration store (project catalog DuckDB).

load_metric_fn_entry_point(spec)

Import a callable from module.path:fn for the escape-hatch path.

override_paths(cfg)

Return the {parameter_name: dotted_path} mapping for trial injection.

preload_hash_cache(catalog_conn, cache)

Populate cache from previously-promoted calibration iterations.

space_from_config(cfg)

Return a ParameterSpace built from the calibration declarations.