Refactor radar system

This commit is contained in:
Ayzen
2026-10-05 16:46:28 +03:00
parent 515049d2ed
commit 8f097dfa2e
179 changed files with 8212 additions and 6676 deletions
@@ -187,31 +187,23 @@ class ManualComboCaptureUsesTargetedAcquisitionTest(unittest.TestCase):
def test_manual_capture_runs_one_inner_collection_per_median_sweep(self) -> None:
config = self._switched_mock_config()
session = SequentialCaptureSession(
config=config,
kind="s21_calibration",
set_name="targeted_test",
median_sweep_count=2,
)
with mock.patch.object(
MultiDeviceLibreVnaService,
"acquire_collection",
autospec=True,
side_effect=MultiDeviceLibreVnaService.acquire_collection,
) as inner_acquire:
session.open()
try:
trace = session.capture_current_combo()
finally:
session.close()
service, inner, _ = _switched_service(input_steps=3)
with mock.patch(
"python_app.workflows.sequential_capture_workflow.create_matrix_radar_service",
return_value=service,
):
session = SequentialCaptureSession(
config=config, kind="s21_calibration", set_name="targeted_test", median_sweep_count=2,
)
session.open()
try:
trace = session.capture_current_combo()
finally:
session.close()
first_combo = config.combos[0]
self.assertEqual(
(trace.combo.input, trace.combo.output),
(first_combo.input, first_combo.output),
)
self.assertEqual((trace.combo.input, trace.combo.output), (first_combo.input, first_combo.output))
# 2 median sweeps of ONE physical step — not 2 x 3 full-matrix steps.
self.assertEqual(inner_acquire.call_count, 2)
self.assertEqual(inner.acquire_count, 2)
class PerPointStimulusSwitchingConfigTest(unittest.TestCase):
@@ -238,7 +230,9 @@ class PerPointStimulusSwitchingConfigTest(unittest.TestCase):
# The switch is stepped by the controller in the hardware trigger loop, so the
# host must acquire the whole 4x4 matrix in ONE sweep and never wrap the
# service in the sweep-per-step widener.
service = create_matrix_radar_service(self._config(2))
config = self._config(2)
config.radar.driver_mode = "native"
service = create_matrix_radar_service(config)
self.assertIsInstance(service, MultiDeviceLibreVnaService)
self.assertNotIsInstance(service, SwitchedMatrixRadarService)
self.assertEqual(service.output_position_count, 4)