32 lines
1.2 KiB
Python
32 lines
1.2 KiB
Python
"""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
|
|
from python_app.models.json_fields import json_object, read_str
|
|
|
|
|
|
def acquisition_command(config_path: Path) -> list[str]:
|
|
"""Select replay first, then the configured model's acquisition producer."""
|
|
payload = json_object(json.loads(config_path.read_text(encoding="utf-8")), "run config")
|
|
radar = json_object(payload.get("radar"), "radar")
|
|
replay = json_object(radar.get("replay"), "radar.replay")
|
|
dataset = read_str(replay, "dataset_dir", "")
|
|
model = read_str(radar, "model", RadarModel().model)
|
|
producers = {
|
|
"librevna": "matrix_raw_producer",
|
|
"librevna_multi": "matrix_raw_producer",
|
|
"kamil_adc": "kamil_adc_raw_producer",
|
|
}
|
|
if dataset.strip():
|
|
module = "replay_raw_producer"
|
|
else:
|
|
if model not in producers:
|
|
raise ValueError(f"Unsupported radar model: {model}")
|
|
module = producers[model]
|
|
return [sys.executable, "-m", f"python_app.scripts.{module}", "--config", str(config_path)]
|