Skip to content

Calibration

limen_core.calibration

Where the calibration lives: a folder the application names.

The scoring engines read their thresholds, weights and class cut-offs from YAML files. Those numbers are calibration: they belong to whoever measured them, so this package ships none. The application says once where they are:

from limen_core import calibration
calibration.use("/path/to/config")

and inside that folder the engines look for hazards/<hazard>.yaml (landslide, flood, wildfire), hazards/cascades.yaml and soglie_frane_regionali.yaml. Without :func:use, the folder named by the environment variable LIMEN_CALIBRATION_DIR is taken.

A loader given an explicit path never looks here.

CalibrationMissingError

Bases: RuntimeError

No calibration folder was named: neither :func:use nor the environment variable.

use

use(directory: Path | str) -> None

Name the folder of the calibration files, and forget what was loaded from another one.

clear

clear() -> None

Forget the files already read, so that the next load reads them again.

directory

directory() -> Path

The calibration folder; :class:CalibrationMissingError when none was named.

hazard_file

hazard_file(name: str) -> Path

The file name of the per-hazard folder (landslide.yaml, cascades.yaml).