36 lines
1.4 KiB
Python
36 lines
1.4 KiB
Python
"""Canonical preprocess asset definitions shared by GUI and runtime orchestration."""
|
|
|
|
from __future__ import annotations
|
|
|
|
from python_app.models.run_config_schema import PreprocessAssetModel, RunConfigModel
|
|
|
|
PREPROCESS_ASSET_NAMES = {
|
|
"s21_calibration": "S21 Calibration",
|
|
"s21_reference": "S21 Reference",
|
|
"s21_object_calibration": "Object Calibration",
|
|
}
|
|
REQUIRED_PREPROCESS_ASSET_KEYS = ("s21_calibration", "s21_reference")
|
|
|
|
|
|
def preprocess_asset_model(config: RunConfigModel, key: str) -> PreprocessAssetModel:
|
|
"""Return nested preprocess asset model by canonical asset key."""
|
|
if key == "s21_calibration":
|
|
return config.preprocess.s21.calibration
|
|
if key == "s21_reference":
|
|
return config.preprocess.s21.reference
|
|
if key == "s21_object_calibration":
|
|
return config.preprocess.s21.object_calibration
|
|
raise KeyError(f"Unknown preprocess asset key: {key}")
|
|
|
|
|
|
def preprocess_asset_display_name(key: str) -> str:
|
|
"""Return human-readable label for preprocess asset."""
|
|
return PREPROCESS_ASSET_NAMES[key]
|
|
|
|
|
|
def runtime_preprocess_asset_keys(config: RunConfigModel) -> tuple[str, ...]:
|
|
"""The through/reference pair plus the selected optional object correction."""
|
|
return (*REQUIRED_PREPROCESS_ASSET_KEYS, "s21_object_calibration") if (
|
|
config.preprocess.s21.object_calibration.set_name.strip()
|
|
) else REQUIRED_PREPROCESS_ASSET_KEYS
|