added s11!

This commit is contained in:
Ayzen
2026-03-26 18:29:42 +03:00
parent 9ddbde22bd
commit 077542cbd0
43 changed files with 713 additions and 347 deletions
+59 -44
View File
@@ -8,6 +8,7 @@ from python_app.models.run_config_schema import (
ComboModel,
GprRxGeometryModel,
GprTxGeometryModel,
PreprocessAssetModel,
RunConfigModel,
)
from python_app.models.run_config_validation import load_ring_payload, load_switch_payload, validate_gpr_model
@@ -22,6 +23,12 @@ def _as_dict(value: Any, context: str) -> dict[str, Any]:
return value
def _load_preprocess_asset(payload: dict[str, Any], target: PreprocessAssetModel) -> None:
"""Load preprocess asset fields into target model."""
target.set_name = str(payload.get("set_name", target.set_name))
target.bundle_path = str(payload.get("bundle_path", target.bundle_path))
def run_config_from_dict(payload: dict[str, Any]) -> RunConfigModel:
"""Decode JSON-like payload into :class:`RunConfigModel`."""
# Schema carries only minimal-safe fallbacks; operational defaults live in run_config.json.
@@ -65,47 +72,33 @@ def run_config_from_dict(payload: dict[str, Any]) -> RunConfigModel:
run_payload.get("processing_live_config_path", model.runtime.processing_live_config_path)
)
model.preprocess.s21_calibration_set = str(
preprocess_payload.get("s21_calibration_set", model.preprocess.s21_calibration_set)
s21_preprocess_payload = _as_dict(preprocess_payload.get("s21"), "preprocess.s21")
_load_preprocess_asset(
_as_dict(s21_preprocess_payload.get("calibration"), "preprocess.s21.calibration"),
model.preprocess.s21.calibration,
)
model.preprocess.s21_reference_set = str(
preprocess_payload.get("s21_reference_set", model.preprocess.s21_reference_set)
_load_preprocess_asset(
_as_dict(s21_preprocess_payload.get("reference"), "preprocess.s21.reference"),
model.preprocess.s21.reference,
)
model.preprocess.s21_calibration_bundle_path = str(
preprocess_payload.get(
"s21_calibration_bundle_path",
model.preprocess.s21_calibration_bundle_path,
)
s11_preprocess_payload = _as_dict(preprocess_payload.get("s11"), "preprocess.s11")
s11_calibration_payload = _as_dict(s11_preprocess_payload.get("calibration"), "preprocess.s11.calibration")
_load_preprocess_asset(
_as_dict(s11_calibration_payload.get("open"), "preprocess.s11.calibration.open"),
model.preprocess.s11.calibration.open,
)
model.preprocess.s21_reference_bundle_path = str(
preprocess_payload.get(
"s21_reference_bundle_path",
model.preprocess.s21_reference_bundle_path,
)
_load_preprocess_asset(
_as_dict(s11_calibration_payload.get("short"), "preprocess.s11.calibration.short"),
model.preprocess.s11.calibration.short,
)
model.preprocess.s11_open_calibration_bundle_path = str(
preprocess_payload.get(
"s11_open_calibration_bundle_path",
model.preprocess.s11_open_calibration_bundle_path,
)
_load_preprocess_asset(
_as_dict(s11_calibration_payload.get("load"), "preprocess.s11.calibration.load"),
model.preprocess.s11.calibration.load,
)
model.preprocess.s11_short_calibration_bundle_path = str(
preprocess_payload.get(
"s11_short_calibration_bundle_path",
model.preprocess.s11_short_calibration_bundle_path,
)
)
model.preprocess.s11_load_calibration_bundle_path = str(
preprocess_payload.get(
"s11_load_calibration_bundle_path",
model.preprocess.s11_load_calibration_bundle_path,
)
)
model.preprocess.s11_reference_bundle_path = str(
preprocess_payload.get(
"s11_reference_bundle_path",
model.preprocess.s11_reference_bundle_path,
)
_load_preprocess_asset(
_as_dict(s11_preprocess_payload.get("reference"), "preprocess.s11.reference"),
model.preprocess.s11.reference,
)
model.gpr.mode = str(gpr_payload.get("mode", model.gpr.mode))
@@ -213,14 +206,36 @@ def run_config_to_dict(model: RunConfigModel) -> dict[str, Any]:
"combos": [{"input": combo.input, "output": combo.output} for combo in model.combos],
},
"preprocess": {
"s21_calibration_set": model.preprocess.s21_calibration_set,
"s21_reference_set": model.preprocess.s21_reference_set,
"s21_calibration_bundle_path": model.preprocess.s21_calibration_bundle_path,
"s21_reference_bundle_path": model.preprocess.s21_reference_bundle_path,
"s11_open_calibration_bundle_path": model.preprocess.s11_open_calibration_bundle_path,
"s11_short_calibration_bundle_path": model.preprocess.s11_short_calibration_bundle_path,
"s11_load_calibration_bundle_path": model.preprocess.s11_load_calibration_bundle_path,
"s11_reference_bundle_path": model.preprocess.s11_reference_bundle_path,
"s21": {
"calibration": {
"set_name": model.preprocess.s21.calibration.set_name,
"bundle_path": model.preprocess.s21.calibration.bundle_path,
},
"reference": {
"set_name": model.preprocess.s21.reference.set_name,
"bundle_path": model.preprocess.s21.reference.bundle_path,
},
},
"s11": {
"calibration": {
"open": {
"set_name": model.preprocess.s11.calibration.open.set_name,
"bundle_path": model.preprocess.s11.calibration.open.bundle_path,
},
"short": {
"set_name": model.preprocess.s11.calibration.short.set_name,
"bundle_path": model.preprocess.s11.calibration.short.bundle_path,
},
"load": {
"set_name": model.preprocess.s11.calibration.load.set_name,
"bundle_path": model.preprocess.s11.calibration.load.bundle_path,
},
},
"reference": {
"set_name": model.preprocess.s11.reference.set_name,
"bundle_path": model.preprocess.s11.reference.bundle_path,
},
},
},
"gpr": {
"mode": model.gpr.mode,