Rename kamil_adc to rph_radar and fix its data path

This commit is contained in:
Ayzen
2026-10-06 18:15:18 +03:00
parent aef549ea76
commit a185e61495
94 changed files with 2851 additions and 9485 deletions
+12 -15
View File
@@ -11,12 +11,12 @@ from python_app.models.run_config_schema import RunConfigModel
from python_app.workflows.neutral_preprocess import build_neutral_s21_sets, supports_neutral_preprocess_sets
def _kamil_config(*, points: int = 5) -> RunConfigModel:
def _rph_config(*, points: int = 5) -> RunConfigModel:
return RunConfigModel.from_dict(
{
"radar": {
"model": "kamil_adc",
"kamil_adc": {
"model": "rph_radar",
"rph_radar": {
"band": {"start_hz": 2_100_000_000.0, "stop_hz": 5_500_000_000.0, "points": points},
},
},
@@ -26,9 +26,9 @@ def _kamil_config(*, points: int = 5) -> RunConfigModel:
)
class KamilAdcNeutralPreprocessTest(unittest.TestCase):
class RphRadarNeutralPreprocessTest(unittest.TestCase):
def test_builds_passthrough_s21_sets_on_band_grid(self) -> None:
calibration, reference = build_neutral_s21_sets(_kamil_config(points=5))
calibration, reference = build_neutral_s21_sets(_rph_config(points=5))
expected_frequency = np.linspace(2_100_000_000.0, 5_500_000_000.0, 5).astype(np.float32)
self.assertEqual(len(calibration.traces), 2)
@@ -46,22 +46,19 @@ class KamilAdcNeutralPreprocessTest(unittest.TestCase):
def test_grid_matches_processor_grid(self) -> None:
"""The neutral axis must be byte-identical to the acquisition grid."""
from python_app.hardware_full.kamil_adc import (
KamilAdcProcessingParams,
KamilAdcSweepProcessor,
)
from python_app.hardware_full.rph_radar.processing import RphRadarSweepProcessor
config = _kamil_config(points=17)
processor = KamilAdcSweepProcessor(KamilAdcProcessingParams.from_kamil_model(config.radar.kamil_adc))
config = _rph_config(points=17)
processor = RphRadarSweepProcessor(config.radar.rph_radar)
calibration, _reference = build_neutral_s21_sets(config)
np.testing.assert_array_equal(calibration.traces[0].frequency_hz, processor.grid_hz)
def test_rejects_degenerate_band(self) -> None:
with self.assertRaisesRegex(ValueError, "points must be >= 2"):
build_neutral_s21_sets(_kamil_config(points=1))
with self.assertRaisesRegex(ValueError, "band.points must be"):
build_neutral_s21_sets(_rph_config(points=1))
def test_dtypes_are_float32_and_complex64(self) -> None:
calibration, _reference = build_neutral_s21_sets(_kamil_config())
calibration, _reference = build_neutral_s21_sets(_rph_config())
trace = calibration.traces[0]
self.assertEqual(trace.frequency_hz.dtype, np.float32)
self.assertEqual(trace.s21.dtype, np.complex64)
@@ -69,7 +66,7 @@ class KamilAdcNeutralPreprocessTest(unittest.TestCase):
def test_calibration_s21_is_a_nonzero_divisor(self) -> None:
# The preprocessor divides measured/calibration, so calibration S21
# must never be zero — that is the whole point of the '1+0j neutral' contract.
calibration, _reference = build_neutral_s21_sets(_kamil_config())
calibration, _reference = build_neutral_s21_sets(_rph_config())
for trace in calibration.traces:
self.assertTrue(bool(np.all(trace.s21 != 0)))