chore(repo): cosim_dir replay revival + ruff lint cleanup

cosim_dir revival:
- gen_realdata_hex.py: also emit decimated_range_{i,q}.npy (48x512)
  and doppler_map_{i,q}.npy (512x48) at production dimensions; the
  same Python pipeline that produces the RTL .hex stimuli now writes
  the .npy intermediates v7.replay COSIM_DIR loads. Replaces the
  workflow lost when golden_reference.py was deleted in e8b495c
- test_v7.py: update test_get_frame_cosim shape from pre-PR-O.6
  (64,32) to (NUM_RANGE_BINS, NUM_DOPPLER_BINS)
- check in 4 .npy reference files (~400 KB, deterministic SCENE_SEED=42)

Ruff lint cleanup (was 66 errors; now 0):
- pyproject.toml: ignore T20 in tb/cosim/**.py (CLI tools)
- compare_independent.py: drop redundant int() casts (RUF046),
  swap try/except scipy import for importlib.util.find_spec,
  remove dead duplicate np import, ASCII-ize comment unicode,
  wrap E501 format strings
- fpga_reference.py: drop unused fs arg from nco_reference,
  collapse if/else to ternary, mark _out_im unused
- v7/processing.py: ASCII-ize x in docstring, collapse if-branches
- {dashboard,software_fpga,workers,radar_protocol}.py: wrap E501
- test_v7.py: ASCII-ize comment unicode, _alias renames where unused

Result: test_v7 100/100 (0 skips on radar_venv, was 9 graceful
skips); 5 cosim_dir orphan tests now active and passing.
This commit is contained in:
Jason
2026-05-02 15:45:56 +05:45
parent 5a7e8b8689
commit 3d2ffc3f2c
14 changed files with 107 additions and 62 deletions
+1 -1
View File
@@ -94,7 +94,7 @@ def _make_dspin() -> QDoubleSpinBox:
# =============================================================================
class RangeDopplerCanvas(FigureCanvasQTAgg):
"""Matplotlib canvas showing the Range-Doppler map (NUM_RANGE_BINS x NUM_DOPPLER_BINS) with dark theme."""
"""Matplotlib canvas showing the Range-Doppler map (NUM_RANGE_BINS x NUM_DOPPLER_BINS) with dark theme.""" # noqa: E501
def __init__(self, _parent=None):
fig = Figure(figsize=(10, 6), facecolor=DARK_BG)
+2 -4
View File
@@ -573,7 +573,7 @@ def unfold_velocity_crt(
alias depth k_0 ∈ [-K, K] generates candidates
``v_true = v_meas_0 + k_0 · 2 · v_unamb_0``. A candidate is
*valid* when it folds back into all other active PRIs to within
``tol_factor × max(v_res)``.
``tol_factor * max(v_res)``.
Args:
v_meas_per_sf: signed velocity measurement per active sub-frame
@@ -652,9 +652,7 @@ def unfold_velocity_crt(
confidence = "AMBIGUOUS"
elif n_sf == 3 and n_cands == 1:
confidence = "CONFIRMED"
elif n_sf == 3 and n_cands == 2:
confidence = "LIKELY"
elif n_sf == 2 and n_cands == 1:
elif (n_sf == 3 and n_cands == 2) or (n_sf == 2 and n_cands == 1):
confidence = "LIKELY"
else: # n_sf == 2 and n_cands == 2
confidence = "AMBIGUOUS"
+5 -1
View File
@@ -192,7 +192,11 @@ class SoftwareFPGA:
# to math-generated twiddles otherwise).
range_i = np.zeros((n_chirps, n_samples), dtype=np.int64)
range_q = np.zeros((n_chirps, n_samples), dtype=np.int64)
twiddle_path = TWIDDLE_2048 if (n_samples == 2048 and os.path.exists(TWIDDLE_2048)) else None
twiddle_path = (
TWIDDLE_2048
if (n_samples == 2048 and os.path.exists(TWIDDLE_2048))
else None
)
for c in range(n_chirps):
range_i[c], range_q[c] = run_range_fft(
iq_i[c].astype(np.int64),
+5 -1
View File
@@ -196,7 +196,11 @@ class RadarDataWorker(QThread):
# for SHORT/MEDIUM sub-frame bins until PR-Q.5 replaces this path
# with extract_targets_from_frame_crt.
v_res = self._waveform.velocity_resolution_long_mps
n_doppler = frame.detections.shape[1] if frame.detections.ndim == 2 else self._waveform.n_doppler_bins
n_doppler = (
frame.detections.shape[1]
if frame.detections.ndim == 2
else self._waveform.n_doppler_bins
)
doppler_center = n_doppler // 2
for idx in det_indices: