hil: segmented capture with tuner-fault recovery, in-window IQ accounting
This commit is contained in:
@@ -130,10 +130,18 @@ for off in cands:
|
||||
if hits > best_hits:
|
||||
best_hits, best_off = hits, float(off)
|
||||
|
||||
# match each TX event to its nearest burst under the winning offset
|
||||
matched, our_peaks = [], []
|
||||
# Match each TX event to its nearest burst under the winning offset.
|
||||
# The IQ may cover only part of the serial log (bounded IQ segments, or a
|
||||
# tuner fault mid-run), so TX events whose aligned time falls outside the
|
||||
# IQ timeline are "not observable" rather than "not observed" -- counting
|
||||
# them as failures would understate the result.
|
||||
iq_span_ms = len(db)
|
||||
matched, our_peaks, in_window = [], [], 0
|
||||
for ev, t in zip(tx_events, tx_ms):
|
||||
target = t + best_off
|
||||
if target < 0 or target > iq_span_ms:
|
||||
continue
|
||||
in_window += 1
|
||||
if not len(burst_start):
|
||||
continue
|
||||
j = int(np.argmin(np.abs(burst_start - target)))
|
||||
@@ -181,8 +189,9 @@ result = {
|
||||
"bursts_total": len(burst_info),
|
||||
"firmware_tx_ok": len(tx_events),
|
||||
"firmware_rx_crc_ok": len(rx_events),
|
||||
"tx_events_in_iq_window": in_window,
|
||||
"tx_events_with_rf": len(matched),
|
||||
"tx_rf_confirmed_pct": round(100.0 * len(matched) / len(tx_events), 1),
|
||||
"tx_rf_confirmed_pct": round(100.0 * len(matched) / in_window, 1) if in_window else None,
|
||||
"clock_offset_ms": round(best_off, 1),
|
||||
"align_error_ms": stat([abs(m["align_error_ms"]) for m in matched]),
|
||||
"burst_duration_error_ms": stat(dur_err),
|
||||
@@ -200,7 +209,8 @@ else:
|
||||
f"clipped={result['clipped_sample_pct']}%")
|
||||
print(f" bursts in window: {len(burst_info)}")
|
||||
print(f" firmware TX ok / RX crc-ok: {len(tx_events)} / {len(rx_events)}")
|
||||
print(f" TX events with RF in IQ: {len(matched)}/{len(tx_events)} "
|
||||
print(f" TX events inside IQ window: {in_window} of {len(tx_events)}")
|
||||
print(f" TX events with RF in IQ: {len(matched)}/{in_window} "
|
||||
f"({result['tx_rf_confirmed_pct']} %)")
|
||||
print(f" clock offset: {best_off:.0f} ms")
|
||||
print(f" alignment error min/med/max: {result['align_error_ms']}")
|
||||
|
||||
Reference in New Issue
Block a user