histogram_codec + backfill: tighter peak ceiling, preserve bw_report
histogram_codec: drop _MAX_PEAK_COUNT 4096 → 2200. The old ceiling let extension-byte blocks slip through at up to 20.48 in/s per channel, producing 35× inflated PVS sums when first deployed to prod. 2200 covers Normal-range full-scale (10 in/s = 2000 counts) plus 10% headroom for quantization edge cases. backfill_sidecars: also preserve the bw_report block alongside review + extensions when regenerating sidecars. event_to_sidecar_dict takes a BwAsciiReport dataclass not a dict, so for bw_report we overlay the existing block after regen rather than passing as a kwarg. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -287,16 +287,25 @@ def main(argv=None) -> int:
|
||||
or ev.total_samples < derived // 4):
|
||||
ev.total_samples = derived
|
||||
|
||||
# Preserve user-edited review state + extensions from the
|
||||
# existing sidecar (false_trigger flag, notes, etc.) so a
|
||||
# backfill never wipes them out.
|
||||
preserved_review = None
|
||||
preserved_ext = None
|
||||
# Preserve user-edited review state + extensions + the
|
||||
# bw_report block from the existing sidecar so a backfill
|
||||
# never wipes them out. The bw_report block originates
|
||||
# from the paired .TXT ASCII report parsed at ORIGINAL
|
||||
# import time (ach forward / direct upload); the .TXT
|
||||
# file is not in the waveform store, so we can't re-derive
|
||||
# it from disk. event_to_sidecar_dict takes a
|
||||
# BwAsciiReport dataclass (not a dict), so for bw_report
|
||||
# we overlay the existing block after regen instead of
|
||||
# passing it as a kwarg.
|
||||
preserved_review = None
|
||||
preserved_ext = None
|
||||
preserved_bw_report = None
|
||||
if sidecar_path.exists():
|
||||
try:
|
||||
_existing = event_file_io.read_sidecar(sidecar_path)
|
||||
preserved_review = _existing.get("review")
|
||||
preserved_ext = _existing.get("extensions")
|
||||
preserved_review = _existing.get("review")
|
||||
preserved_ext = _existing.get("extensions")
|
||||
preserved_bw_report = _existing.get("bw_report")
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
@@ -311,6 +320,8 @@ def main(argv=None) -> int:
|
||||
review=preserved_review,
|
||||
extensions=preserved_ext,
|
||||
)
|
||||
if preserved_bw_report is not None:
|
||||
sidecar["bw_report"] = preserved_bw_report
|
||||
|
||||
# Also emit the .h5 clean-waveform file when:
|
||||
# - it's missing, OR
|
||||
|
||||
Reference in New Issue
Block a user