new kamil adc

This commit is contained in:
Ayzen
2026-06-11 13:02:02 +03:00
parent 21f76d7cd2
commit 9661504e51
46 changed files with 12097 additions and 1063 deletions
+7
View File
@@ -185,6 +185,12 @@ def gui_profile_from_dict(payload: dict[str, Any]) -> GuiProfileModel:
gui.processing.pass_through.show_phase,
"gui.processing.pass_through",
),
unwrap_phase=_optional_bool(
pass_through_object,
"unwrap_phase",
gui.processing.pass_through.unwrap_phase,
"gui.processing.pass_through",
),
combo_filter=_optional_string(
pass_through_object,
"combo_filter",
@@ -521,6 +527,7 @@ def gui_profile_to_dict(model: GuiProfileModel) -> dict[str, Any]:
"pass_through": {
"show_magnitude": gui.processing.pass_through.show_magnitude,
"show_phase": gui.processing.pass_through.show_phase,
"unwrap_phase": gui.processing.pass_through.unwrap_phase,
"combo_filter": gui.processing.pass_through.combo_filter,
"fixed_y_enabled": gui.processing.pass_through.fixed_y_enabled,
"y_min_db": gui.processing.pass_through.y_min_db,
+1
View File
@@ -30,6 +30,7 @@ class GuiPassThroughStateModel:
show_magnitude: bool = True
show_phase: bool = True
unwrap_phase: bool = False
combo_filter: str = ""
fixed_y_enabled: bool = False
y_min_db: float = -100.0
+24
View File
@@ -239,6 +239,19 @@ def run_config_from_dict(payload: dict[str, Any]) -> RunConfigModel:
model.radar.kamil_adc.stop_timeout_s = _read_float(
kamil_adc_payload, "stop_timeout_s", model.radar.kamil_adc.stop_timeout_s
)
phase_calibration_payload = _as_dict(
kamil_adc_payload.get("phase_calibration"), "radar.kamil_adc.phase_calibration"
)
calibration = model.radar.kamil_adc.phase_calibration
calibration.phase0_rad = _read_float(phase_calibration_payload, "phase0_rad", calibration.phase0_rad)
calibration.freq0_hz = _read_float(phase_calibration_payload, "freq0_hz", calibration.freq0_hz)
calibration.phase1_rad = _read_float(phase_calibration_payload, "phase1_rad", calibration.phase1_rad)
calibration.freq1_hz = _read_float(phase_calibration_payload, "freq1_hz", calibration.freq1_hz)
band_payload = _as_dict(kamil_adc_payload.get("band"), "radar.kamil_adc.band")
band = model.radar.kamil_adc.band
band.start_hz = _read_float(band_payload, "start_hz", band.start_hz)
band.stop_hz = _read_float(band_payload, "stop_hz", band.stop_hz)
band.points = _read_int(band_payload, "points", band.points)
model.radar.laser_control.enabled = _read_bool(
laser_control_payload, "enabled", model.radar.laser_control.enabled
@@ -490,6 +503,17 @@ def run_config_to_dict(model: RunConfigModel) -> dict[str, Any]:
"startup_timeout_s": model.radar.kamil_adc.startup_timeout_s,
"sweep_timeout_s": model.radar.kamil_adc.sweep_timeout_s,
"stop_timeout_s": model.radar.kamil_adc.stop_timeout_s,
"phase_calibration": {
"phase0_rad": model.radar.kamil_adc.phase_calibration.phase0_rad,
"freq0_hz": model.radar.kamil_adc.phase_calibration.freq0_hz,
"phase1_rad": model.radar.kamil_adc.phase_calibration.phase1_rad,
"freq1_hz": model.radar.kamil_adc.phase_calibration.freq1_hz,
},
"band": {
"start_hz": model.radar.kamil_adc.band.start_hz,
"stop_hz": model.radar.kamil_adc.band.stop_hz,
"points": model.radar.kamil_adc.band.points,
},
},
"laser_control": {
"enabled": model.radar.laser_control.enabled,
+4
View File
@@ -6,7 +6,9 @@ from python_app.models.run_config_schema import (
GprModel,
GprRxGeometryModel,
GprTxGeometryModel,
KamilAdcBandModel,
KamilAdcModel,
KamilAdcPhaseCalibrationModel,
LaserControlModel,
LaserManualModeModel,
LaserVariationModeModel,
@@ -37,7 +39,9 @@ __all__ = [
"GprModel",
"GprRxGeometryModel",
"GprTxGeometryModel",
"KamilAdcBandModel",
"KamilAdcModel",
"KamilAdcPhaseCalibrationModel",
"LaserControlModel",
"LaserManualModeModel",
"LaserVariationModeModel",
+36
View File
@@ -42,6 +42,38 @@ class RadarMultiDeviceModel:
recovery_attempts: int = 3
@dataclass(slots=True)
class KamilAdcPhaseCalibrationModel:
"""Affine law mapping the reference signal's unwrapped phase to frequency.
Two fixed anchor points ``(phase0_rad, freq0_hz)`` and ``(phase1_rad, freq1_hz)``
define ``f(phase) = freq0_hz + (phase - phase0_rad) * (freq1_hz - freq0_hz)
/ (phase1_rad - phase0_rad)``, applied to the *absolute* unwrapped phase of
every sweep. These are physical constants of the reference arm and must be
supplied by config — never derived from a live sweep.
"""
phase0_rad: float = 0.0
freq0_hz: float = 2_046_000_000.0
phase1_rad: float = 300.0
freq1_hz: float = 5_612_000_000.0
@dataclass(slots=True)
class KamilAdcBandModel:
"""Fixed frequency window every sweep is cropped to and resampled onto.
Each sweep is resampled onto ``linspace(start_hz, stop_hz, points)`` so all
sweeps share one identical axis and can be averaged/subtracted. The window
must lie inside the (floating) range each sweep actually covers; sweeps that
fail to cover it are rejected rather than edge-extrapolated.
"""
start_hz: float = 2_100_000_000.0
stop_hz: float = 5_500_000_000.0
points: int = 2048
@dataclass(slots=True)
class KamilAdcModel:
"""External Kamil ADC acquisition process settings."""
@@ -54,6 +86,10 @@ class KamilAdcModel:
startup_timeout_s: float = 5.0
sweep_timeout_s: float = 5.0
stop_timeout_s: float = 2.0
phase_calibration: KamilAdcPhaseCalibrationModel = field(
default_factory=KamilAdcPhaseCalibrationModel
)
band: KamilAdcBandModel = field(default_factory=KamilAdcBandModel)
@dataclass(slots=True)