Refactor radar system
This commit is contained in:
@@ -45,9 +45,7 @@ def main() -> int:
|
||||
config = RunConfigModel.load_from_path(args.config)
|
||||
config.ensure_combos()
|
||||
if not supports_neutral_preprocess_sets(config):
|
||||
raise RuntimeError(
|
||||
"Neutral S21 sets are available only for kamil_adc and librevna_multi"
|
||||
)
|
||||
raise RuntimeError("Neutral S21 sets are not supported for this radar configuration")
|
||||
|
||||
radar_key = radar_key_from_config(
|
||||
model_name=config.radar.model,
|
||||
@@ -61,12 +59,19 @@ def main() -> int:
|
||||
)
|
||||
store = NpzStore(PROJECT_ROOT / "python_app/data")
|
||||
|
||||
kinds = ("s21_calibration", "s21_reference")
|
||||
existing = [
|
||||
kind
|
||||
for kind in ("s21_calibration", "s21_reference")
|
||||
for kind in kinds
|
||||
if args.set_name in store.list_sets(kind, radar_key)
|
||||
]
|
||||
if existing and not args.force:
|
||||
if len(existing) != len(kinds):
|
||||
missing = ", ".join(kind for kind in kinds if kind not in existing)
|
||||
raise RuntimeError(
|
||||
f"Neutral set pair '{args.set_name}' is incomplete: missing {missing}; "
|
||||
"use --force to replace both sets."
|
||||
)
|
||||
logger.info(
|
||||
"Sets '%s' already exist for %s (radar_key=%s); nothing to do (use --force to overwrite).",
|
||||
args.set_name, ", ".join(existing), radar_key,
|
||||
@@ -74,8 +79,7 @@ def main() -> int:
|
||||
return 0
|
||||
|
||||
calibration, reference = build_neutral_s21_sets(config)
|
||||
store.save_set("s21_calibration", radar_key, args.set_name, calibration)
|
||||
store.save_set("s21_reference", radar_key, args.set_name, reference)
|
||||
store.save_sets(radar_key, args.set_name, dict(zip(kinds, (calibration, reference))))
|
||||
logger.info(
|
||||
"Neutral S21 sets saved: set=%s, radar_key=%s, combos=%d, points=%d",
|
||||
args.set_name,
|
||||
|
||||
Reference in New Issue
Block a user