feat(decode): over range from the unit's own peaks -- Blastware's OORANGE

A channel is over range when the unit's own peak (its summary's min /
max) passes 2,000: 32,000 counts, full scale, on either geophone range;
the mic in counts.  Blastware prints OORANGE for that channel's peak,
for the vector sum when any geophone is over, and its "Out of Range"
line when the mic is (DL2, 2026-11-09): numeric up to 1,991 / 1,933,
OORANGE from 2,001; the vector sum is OORANGE on all 43 events with a
geophone over and on none of the 38 whose vector sum alone passes
10 in/s -- the open "vector sum alone" carve-out was never needed.

PeakValues gains tran/vert/long/mic/pvs_over_range.  The checker matches
OORANGE by the flag, and calls a flag against a printed number a
mismatch.  Clipped events that the saturation carve-out used to accept
now match outright; the carve-out stays as the fallback for a file
without the unit's summary, and its guards are tested that way.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-09 12:51:57 -05:00
1 parent e542e61b68
commit af8dde5114
12 files changed
+1097 -19

No files matched your search

+17 -2
View File
@@ -157,6 +157,10 @@ def sfm_side(raw: bytes) -> SfmSide:
("LongZCFreq", pv.long_zc_freq), ("MicLZCFreq", pv.mic_zc_freq)):
if hz is not None:
values[tag] = "<1.0" if hz < 1.0 else hz
# Blastware's "Out of Range" line: on every DL2 event whose mic is over
# range, and on no other (18 / 18, 2026-11-09).
if pv is not None and pv.mic_over_range:
values["OORANGE"] = "Out of Range"
# The event's Monitor Log line, from the footer (2026-11-08).
if ev.monitor_log is not None:
ml = ev.monitor_log
@@ -269,6 +273,11 @@ def _mic_converter(ref: XmlReport) -> Optional[Callable[[int], float]]:
return None
_OVER_RANGE = {"TranPPV": "tran_over_range", "VertPPV": "vert_over_range",
"LongPPV": "long_over_range", "PeakVectorSum": "pvs_over_range",
"MicLPSPL": "mic_over_range"}
def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> FieldResult:
if not printed.strip() or printed.strip() == "N/A":
return FieldResult(tag, "no_reference", printed, None)
@@ -288,8 +297,14 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie
ch = tag[:-len("ZCFreq")].lower()
flag = getattr(sfm.event.peak_values, ("mic" if ch == "micl" else ch) + "_zc_above_range", False)
return FieldResult(tag, "match" if flag else "mismatch", printed, str(value))
if printed == "OORANGE":
return FieldResult(tag, "mismatch", printed, str(value))
# Over range: SFM agrees with Blastware's OORANGE only by setting its flag,
# and a flag against a printed number is a disagreement.
over = _OVER_RANGE.get(tag)
flagged = bool(over and getattr(sfm.event.peak_values, over, False))
if printed == "OORANGE" or flagged:
ok = printed == "OORANGE" and flagged
return FieldResult(tag, "match" if ok else "mismatch", printed,
"OORANGE" if flagged else _render(value, printed))
if isinstance(value, (int, float)) and not isinstance(value, bool) and _printed_number(printed):
ok = matches_printed(float(value), printed)
else:
+11 -1
View File
@@ -857,7 +857,11 @@ def _apply_unit_summary(pv: PeakValues, summary: dict, geo_fs_ins: float, sample
* a waveform's peak displacement = half its integral: 19,479 / 19,479
* a waveform's times of peak and vector-sum time, from the unit's peak
samples (`pretrig` given): they replace the samples' own, which differ
only where the stored samples wrap (O117I1NK.R70W)."""
only where the stored samples wrap (O117I1NK.R70W)
* over range, every record type: a channel whose peak passes full scale,
and the vector sum when any geophone does -- Blastware's OORANGE on all
43 such events, and on none of the 38 whose vector sum alone passes
the range (2026-11-09)."""
# The summary's geophone values are decoder units, as a histogram's are.
unit_ins = _HIST_GEO_COUNTS_PER_UNIT * geo_fs_ins / _GEO_INT16_FS
for ch, attr in (("Tran", "tran"), ("Vert", "vert"), ("Long", "long"), ("MicL", "mic")):
@@ -867,11 +871,13 @@ def _apply_unit_summary(pv: PeakValues, summary: dict, geo_fs_ins: float, sample
hz, above = _zc_from_half_period(c["half_period"], sample_rate)
setattr(pv, f"{attr}_zc_freq", hz)
setattr(pv, f"{attr}_zc_above_range", above)
setattr(pv, f"{attr}_over_range", max(abs(c["min"]), abs(c["max"])) > _SUMMARY_FULL_SCALE)
if pretrig is None:
continue
setattr(pv, f"{ch.lower()}_time_of_peak", (c["peak_sample"] - pretrig) / sample_rate)
if ch != "MicL":
setattr(pv, f"{attr}_peak_disp_in", c["disp_integral"] * unit_ins / sample_rate / 2)
pv.pvs_over_range = pv.tran_over_range or pv.vert_over_range or pv.long_over_range
if pretrig is not None and all(ch in summary for ch in ("Tran", "Vert", "Long")):
pv.pvs_time = (summary["pvs_sample"] - pretrig) / sample_rate
@@ -1109,6 +1115,10 @@ _EVENT_RECORD_ID = 0x05
_SUMMARY_PVS_SAMPLE = slice(25, 29)
_SUMMARY_CHANNELS = {0x32: "Tran", 0x33: "Vert", 0x34: "Long", 0x35: "MicL"}
_SUMMARY_CHANNEL_LEN = 21 # the payload; the record is 22 with its id
# Full scale in the summary's units: 2,000 x 16 = 32,000 counts on either
# geophone range, and 2,000 counts on the mic. A peak past it is Blastware's
# OORANGE: numeric up to 1,991 / 1,933, OORANGE from 2,001 (DL2, 2026-11-09).
_SUMMARY_FULL_SCALE = 2000
def _unit_summary(chain: dict[int, bytes]) -> Optional[dict]:
+8
View File
@@ -381,6 +381,14 @@ class PeakValues:
tran_peak_disp_in: Optional[float] = None
vert_peak_disp_in: Optional[float] = None
long_peak_disp_in: Optional[float] = None
# Over range: the unit's own peak passed full scale (2026-11-09). Blastware
# prints OORANGE for that peak, and for the vector sum when any geophone is
# over; the value beside it is then a lower bound.
tran_over_range: bool = False
vert_over_range: bool = False
long_over_range: bool = False
mic_over_range: bool = False
pvs_over_range: bool = False
@dataclass