some fixes and improvements
This commit is contained in:
@@ -4,8 +4,11 @@ from __future__ import annotations
|
||||
|
||||
from dataclasses import dataclass
|
||||
import json
|
||||
import logging
|
||||
from pathlib import Path
|
||||
|
||||
logger = logging.getLogger(__name__)
|
||||
|
||||
|
||||
@dataclass(slots=True)
|
||||
class GuiSessionState:
|
||||
@@ -32,13 +35,22 @@ class GuiSessionStateStore:
|
||||
if not self._path.exists():
|
||||
return GuiSessionState()
|
||||
|
||||
payload = json.loads(self._path.read_text(encoding="utf-8"))
|
||||
try:
|
||||
payload = json.loads(self._path.read_text(encoding="utf-8"))
|
||||
except (OSError, json.JSONDecodeError) as exc:
|
||||
# The state file is GUI-local cache — a corrupted file should not
|
||||
# prevent the app from starting. Reset to defaults and let the
|
||||
# next write overwrite it.
|
||||
logger.warning("Resetting unreadable GUI session-state %s: %s", self._path, exc)
|
||||
return GuiSessionState()
|
||||
if not isinstance(payload, dict):
|
||||
raise ValueError(f"GUI session-state root must be JSON object: {self._path}")
|
||||
logger.warning("Resetting GUI session-state with non-object root: %s", self._path)
|
||||
return GuiSessionState()
|
||||
|
||||
raw_path = payload.get("last_profile_path", "")
|
||||
if not isinstance(raw_path, str):
|
||||
raise ValueError("GUI session-state `last_profile_path` must be a string")
|
||||
logger.warning("Resetting GUI session-state with non-string last_profile_path: %s", self._path)
|
||||
return GuiSessionState()
|
||||
return GuiSessionState(last_profile_path=raw_path)
|
||||
|
||||
def write(self, state: GuiSessionState) -> Path:
|
||||
|
||||
@@ -36,6 +36,16 @@ class ProcessingLiveConfig:
|
||||
gpr_draw_top_m_objects: int = 2
|
||||
gpr_speed_m_s: float = 0.0
|
||||
gpr_look_angle_deg: float = 0.0
|
||||
# Motion-model knobs for the legacy GPR pipeline. `direction_sign` flips
|
||||
# which way later events appear deeper (+1) vs shallower (-1) along Z.
|
||||
# `apply_freq_phase_correction` enables intra-sweep frequency-domain phase
|
||||
# compensation that fires *before* the IFFT — needed when the radar moves
|
||||
# appreciably during one sweep.
|
||||
gpr_direction_sign: float = 1.0
|
||||
gpr_apply_freq_phase_correction: bool = True
|
||||
# Anchor for the motion model's per-event `dt_ref`: 'frame_center' (default)
|
||||
# or 'first_tx_event'. Mirrors Python `MOTION_CONFIG.reference_mode`.
|
||||
gpr_reference_mode: str = "frame_center"
|
||||
gpr_snr_thresh: float = 4.5
|
||||
gpr_snr_comp_max: float = 25.0
|
||||
gpr_start_freq_mhz: float = 3000.0
|
||||
@@ -93,6 +103,9 @@ class ProcessingLiveConfig:
|
||||
"gpr_draw_top_m_objects": int(self.gpr_draw_top_m_objects),
|
||||
"gpr_speed_m_s": float(self.gpr_speed_m_s),
|
||||
"gpr_look_angle_deg": float(self.gpr_look_angle_deg),
|
||||
"gpr_direction_sign": float(self.gpr_direction_sign),
|
||||
"gpr_apply_freq_phase_correction": bool(self.gpr_apply_freq_phase_correction),
|
||||
"gpr_reference_mode": str(self.gpr_reference_mode),
|
||||
"gpr_snr_thresh": float(self.gpr_snr_thresh),
|
||||
"gpr_snr_comp_max": float(self.gpr_snr_comp_max),
|
||||
"gpr_start_freq_mhz": float(self.gpr_start_freq_mhz),
|
||||
|
||||
Reference in New Issue
Block a user