Rework radar system
This commit is contained in:
@@ -79,7 +79,7 @@ def _load_string_dict(payload: dict[str, Any], key: str, context: str) -> dict[s
|
||||
return values
|
||||
|
||||
|
||||
def run_config_from_dict(payload: dict[str, Any]) -> RunConfigModel:
|
||||
def run_config_from_dict(payload: object) -> RunConfigModel:
|
||||
"""Decode JSON-like payload into :class:`RunConfigModel`."""
|
||||
if not isinstance(payload, dict):
|
||||
raise ValueError("Run config root must be a JSON object")
|
||||
@@ -331,24 +331,6 @@ def run_config_from_dict(payload: dict[str, Any]) -> RunConfigModel:
|
||||
model.preprocess.s21.object_calibration,
|
||||
)
|
||||
|
||||
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,
|
||||
)
|
||||
_load_preprocess_asset(
|
||||
_as_dict(s11_calibration_payload.get("short"), "preprocess.s11.calibration.short"),
|
||||
model.preprocess.s11.calibration.short,
|
||||
)
|
||||
_load_preprocess_asset(
|
||||
_as_dict(s11_calibration_payload.get("load"), "preprocess.s11.calibration.load"),
|
||||
model.preprocess.s11.calibration.load,
|
||||
)
|
||||
_load_preprocess_asset(
|
||||
_as_dict(s11_preprocess_payload.get("reference"), "preprocess.s11.reference"),
|
||||
model.preprocess.s11.reference,
|
||||
)
|
||||
notch_payload = _as_dict(preprocess_payload.get("notch"), "preprocess.notch")
|
||||
model.preprocess.notch = PreprocessNotchModel(
|
||||
enabled=_read_bool(notch_payload, "enabled", model.preprocess.notch.enabled),
|
||||
@@ -521,26 +503,22 @@ def run_config_to_dict(model: RunConfigModel) -> dict[str, Any]:
|
||||
"port1": {
|
||||
"name": model.output_switch.name,
|
||||
"driver_mode": model.output_switch.driver_mode,
|
||||
"driver": model.output_switch.driver,
|
||||
"radar_port": model.output_switch.radar_port,
|
||||
"positions": model.output_switch.positions,
|
||||
"default_position": model.output_switch.default_position,
|
||||
"gpio_chip": model.output_switch.gpio_chip,
|
||||
"pin_a": model.output_switch.pin_a,
|
||||
"pin_b": model.output_switch.pin_b,
|
||||
"invert_logic": model.output_switch.invert_logic,
|
||||
},
|
||||
"port2": {
|
||||
"name": model.input_switch.name,
|
||||
"driver_mode": model.input_switch.driver_mode,
|
||||
"driver": model.input_switch.driver,
|
||||
"radar_port": model.input_switch.radar_port,
|
||||
"positions": model.input_switch.positions,
|
||||
"default_position": model.input_switch.default_position,
|
||||
"gpio_chip": model.input_switch.gpio_chip,
|
||||
"pin_a": model.input_switch.pin_a,
|
||||
"pin_b": model.input_switch.pin_b,
|
||||
"invert_logic": model.input_switch.invert_logic,
|
||||
},
|
||||
},
|
||||
"control_button": {
|
||||
@@ -586,26 +564,6 @@ def run_config_to_dict(model: RunConfigModel) -> dict[str, Any]:
|
||||
"bundle_path": model.preprocess.s21.object_calibration.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,
|
||||
},
|
||||
},
|
||||
"notch": {
|
||||
"enabled": model.preprocess.notch.enabled,
|
||||
"bands_hz": [[low_hz, high_hz] for low_hz, high_hz in model.preprocess.notch.bands_hz],
|
||||
|
||||
Reference in New Issue
Block a user