Refactor radar system
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
"""One acquisition producer selection shared by supervisor and launcher."""
|
||||
|
||||
from __future__ import annotations
|
||||
|
||||
import json
|
||||
from pathlib import Path
|
||||
import sys
|
||||
|
||||
from python_app.models.run_config_schema import RadarModel
|
||||
|
||||
|
||||
def acquisition_command(project_root: Path, config_path: Path) -> list[str]:
|
||||
"""Select replay first, then the configured model's acquisition producer."""
|
||||
payload = json.loads(config_path.read_text(encoding="utf-8"))
|
||||
radar = payload.get("radar", {}) if isinstance(payload, dict) else {}
|
||||
radar = radar if isinstance(radar, dict) else {}
|
||||
replay = radar.get("replay", {})
|
||||
dataset = replay.get("dataset_dir") if isinstance(replay, dict) else None
|
||||
defaults = RadarModel()
|
||||
model = radar.get("model")
|
||||
if model is None and isinstance(payload, dict):
|
||||
model = defaults.model
|
||||
driver_mode = radar.get("driver_mode")
|
||||
if driver_mode is None:
|
||||
driver_mode = defaults.driver_mode
|
||||
if model in ("librevna", "librevna_multi") and driver_mode == "mock":
|
||||
model = "librevna_multi"
|
||||
module = "replay_raw_producer" if isinstance(dataset, str) and dataset.strip() else {
|
||||
"librevna_multi": "matrix_raw_producer",
|
||||
"kamil_adc": "kamil_adc_raw_producer",
|
||||
}.get(model if isinstance(model, str) else "")
|
||||
command = [sys.executable, "-m", f"python_app.scripts.{module}"] if module else [
|
||||
str(project_root / "build/bin/sweep_orchestrator"),
|
||||
]
|
||||
return [*command, "--config", str(config_path)]
|
||||
Reference in New Issue
Block a user