diff --git a/minimateplus/decode_check.py b/minimateplus/decode_check.py index e1b1335..9004d1e 100644 --- a/minimateplus/decode_check.py +++ b/minimateplus/decode_check.py @@ -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: diff --git a/minimateplus/event_file_io.py b/minimateplus/event_file_io.py index 480f930..f29374c 100644 --- a/minimateplus/event_file_io.py +++ b/minimateplus/event_file_io.py @@ -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]: diff --git a/minimateplus/models.py b/minimateplus/models.py index 32d0d39..3e0af3d 100644 --- a/minimateplus/models.py +++ b/minimateplus/models.py @@ -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 diff --git a/tests/fixtures/over-range-11-09-26/K558KD43.NZ0H b/tests/fixtures/over-range-11-09-26/K558KD43.NZ0H new file mode 100755 index 0000000..ab73af4 Binary files /dev/null and b/tests/fixtures/over-range-11-09-26/K558KD43.NZ0H differ diff --git a/tests/fixtures/over-range-11-09-26/K558KD43_NZ0H_XML.XML b/tests/fixtures/over-range-11-09-26/K558KD43_NZ0H_XML.XML new file mode 100755 index 0000000..c428b86 --- /dev/null +++ b/tests/fixtures/over-range-11-09-26/K558KD43_NZ0H_XML.XML @@ -0,0 +1,117 @@ + + +8.0 +Full Histogram +BE9558 +V 10.72-8.17 MiniMate Plus +K558KD43.NZ0H +17:38:23 +2024-01-08 +17:38:59 +2024-01-08 + +Tran +Vert +Long +MicL + +1.00 +1 minute +1024 sps +6.2 Volts +May 31, 2023 by Instantel +in/s and dB(L) +CMU-RKM Hall-Loc 2-Museum-Scaife Gallery +PJ Dick Inc. +Terra-Mechanics Inc. - Harrison +Location #2 -Museum - Scaife Gallery + +10.000 +in/s + + +1.830 +in/s + + +4.935 +in/s + + +3.925 +in/s + + +16 +Hz + + +51 +Hz + + +8.0 +Hz + +17:38:59 +2024-01-08 +17:38:59 +2024-01-08 +17:38:59 +2024-01-08 + +5.012 +in/s + +17:38:59 +2024-01-08 +Linear Weighting + +OORANGE + + +17:38:59 +2024-01-08 + +18 +Hz + +7.4 Hz. +4.1 +Passed +7.6 Hz. +3.3 +Passed +7.4 Hz. +3.7 +Passed +0.0 Hz. +0 mv +Check +Out of Range + + +2024-01-08 17:38:22 - 2024-01-08 17:38:59 "Event Recorded Modem Exit" + + + Tran Peak in/s + Tran Freq Hz + Vert Peak in/s + Vert Freq Hz + Long Peak in/s + Long Freq Hz + Geo PVS in/s + MicL Peak psi(L) + MicL Peak dB(L) + MicL Freq Hz + + + + +1.830164.935513.9258.05.012OORANGEOORANGE18 + + + + + + diff --git a/tests/fixtures/over-range-11-09-26/M007JC05.OI0H b/tests/fixtures/over-range-11-09-26/M007JC05.OI0H new file mode 100755 index 0000000..7bcd795 Binary files /dev/null and b/tests/fixtures/over-range-11-09-26/M007JC05.OI0H differ diff --git a/tests/fixtures/over-range-11-09-26/M007JC05_OI0H_XML.XML b/tests/fixtures/over-range-11-09-26/M007JC05_OI0H_XML.XML new file mode 100755 index 0000000..51103f0 --- /dev/null +++ b/tests/fixtures/over-range-11-09-26/M007JC05_OI0H_XML.XML @@ -0,0 +1,743 @@ + + +8.0 +Full Histogram +BE11007 +V 10.72-8.17 MiniMate Plus +M007JC05.OI0H +07:48:18 +2022-01-17 +11:18:02 +2022-01-17 + +Tran +Vert +Long +MicL + +210.00 +1 minute +1024 sps +6.8 Volts +April 7, 2021 by Instantel +in/s and dB(L) +ECMS100607 - Loc 1 - 740 Washington Ave +J B Fay Co. +Terra-Mechanics Inc. - D. Harrison +Location #1 - 740 Washington - Church + +10.000 +in/s + + +8.360 +in/s + + +8.350 +in/s + + +8.385 +in/s + + +>100 +Hz + + +>100 +Hz + + +>100 +Hz + +11:18:02 +2022-01-17 +11:18:02 +2022-01-17 +11:18:02 +2022-01-17 + +14.49 +in/s + +11:18:02 +2022-01-17 +Linear Weighting + +144.9 +dB(L) + +11:18:02 +2022-01-17 + +1.7 +Hz + +7.5 Hz. +3.9 +Passed +7.5 Hz. +3.7 +Passed +7.5 Hz. +4.2 +Passed +20.5 Hz. +574 mv +Passed + + +2022-01-17 07:48:17 - 2022-01-17 11:18:02 "Event Recorded Modem Exit" + + + Tran Peak in/s + Tran Freq Hz + Vert Peak in/s + Vert Freq Hz + Long Peak in/s + Long Freq Hz + Geo PVS in/s + MicL Peak psi(L) + MicL Peak dB(L) + MicL Freq Hz + + + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.010>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00093.9864 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.010>1000.005>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0120.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.010>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.010>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.005>1000.005>1000.0090.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.010>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00091.4864 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0110.00087.96>100 + + +0.005>1000.010>1000.005>1000.0120.00087.96>100 + + +0.005>1000.010>1000.005>1000.0100.00087.96>100 + + +8.360>1008.350>1008.385>10014.490.051144.91.7 + + + + + + diff --git a/tests/fixtures/over-range-11-09-26/O121L4L1.GU0H b/tests/fixtures/over-range-11-09-26/O121L4L1.GU0H new file mode 100755 index 0000000..bc8314c Binary files /dev/null and b/tests/fixtures/over-range-11-09-26/O121L4L1.GU0H differ diff --git a/tests/fixtures/over-range-11-09-26/O121L4L1_GU0H_XML.XML b/tests/fixtures/over-range-11-09-26/O121L4L1_GU0H_XML.XML new file mode 100755 index 0000000..e93230d --- /dev/null +++ b/tests/fixtures/over-range-11-09-26/O121L4L1_GU0H_XML.XML @@ -0,0 +1,116 @@ + + +8.0 +Full Histogram +BE13121 +V 10.72-8.17 MiniMate Plus +O121L4L1.GU0H +18:17:18 +2025-06-25 +18:19:31 +2025-06-25 + +Tran +Vert +Long +MicL + +1.00 +5 minutes +1024 sps +6.4 Volts +April 29, 2025 by Instantel +in/s and dB(L) +Fay - Locks & Dam No3- Loc3- 735 Bunola +Fay Company +Terra-Mechanics Inc - Harrison +Loc. No 3 - 735 Bunola River Rd - Church + +10.000 +in/s + + +OORANGE +in/s + + +0.305 +in/s + + +0.405 +in/s + + +85 +Hz + + +47 +Hz + + +57 +Hz + +18:19:31 +2025-06-25 +18:19:31 +2025-06-25 +18:19:31 +2025-06-25 + +OORANGE +in/s + +18:19:31 +2025-06-25 +Linear Weighting + +123.4 +dB(L) + +18:19:31 +2025-06-25 + +85 +Hz + +7.3 Hz. +4.0 +Passed +7.7 Hz. +3.6 +Passed +7.6 Hz. +3.6 +Passed +0.0 Hz. +0 mv +Check + + +2025-06-25 18:17:17 - 2025-06-25 18:19:31 "Event Recorded Modem Exit" + + + Tran Peak in/s + Tran Freq Hz + Vert Peak in/s + Vert Freq Hz + Long Peak in/s + Long Freq Hz + Geo PVS in/s + MicL Peak psi(L) + MicL Peak dB(L) + MicL Freq Hz + + + + +OORANGE850.305470.40557OORANGE0.004123.485 + + + + + + diff --git a/tests/test_bw_file_fields.py b/tests/test_bw_file_fields.py index c7b3c2e..9129314 100644 --- a/tests/test_bw_file_fields.py +++ b/tests/test_bw_file_fields.py @@ -711,3 +711,29 @@ def test_without_a_whole_record_chain_there_is_no_monitor_log(): i = raw.find(b"\x00\xd4\x3c") raw[i + 1] = 0xd3 # one byte short: the footer is not proven assert decode_blastware_bytes(bytes(raw), name=None).monitor_log is None + + +# ── Over range: the unit's true peak beyond full scale ────────────────────── +# A channel is over range when the unit's own peak (its summary's min / max, +# D.6.12) passes 2,000: 32,000 counts, full scale, on either geophone range; +# the mic in counts. Blastware then 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 (geophones) / 1,933 (mic), +# 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. + +_OR = "over-range-11-09-26" + + +@pytest.mark.parametrize("rel,over", [ + # (tran, vert, long, mic, vector sum) + (f"{_US}/O117I1NK.R70W", (True, True, True, True, True)), + (f"{_OR}/O121L4L1.GU0H", (True, False, False, False, True)), + (f"{_OR}/K558KD43.NZ0H", (False, False, False, True, False)), + (f"{_OR}/M007JC05.OI0H", (False, False, False, False, False)), # vector sum 14.49 in/s, a number + (f"{_US}/I145L6UJ.3Y0W", (False, False, False, False, False)), +]) +def test_over_range_is_the_units_peak_beyond_full_scale(rel, over): + pv = read_blastware_file(_FIX / rel).peak_values + assert (pv.tran_over_range, pv.vert_over_range, pv.long_over_range, + pv.mic_over_range, pv.pvs_over_range) == over diff --git a/tests/test_check_s3_decode.py b/tests/test_check_s3_decode.py index 03f873d..015e5ff 100644 --- a/tests/test_check_s3_decode.py +++ b/tests/test_check_s3_decode.py @@ -28,8 +28,9 @@ def test_find_pairs_dedupes_and_pairs(tmp_path): def test_check_event_rows_and_attrs(): out = run.check_event("M007HVWF.K30W", str(FIX / "M007HVWF.K30W"), str(FIX / "M007HVWF_K30W_XML.XML")) assert out["attrs"]["range"] == "1.250" and out["attrs"]["model"] == "MiniMate Plus" - # clipped at its own 1.250 ceiling: accepted under the saturation carve-out - assert ["TranPPV", "accepted"] in [r[:2] for r in out["results"]] + # clipped at its own 1.250 ceiling: Blastware's OORANGE, matched by the unit's + # own peak since 2026-11-09 (it was accepted under the saturation carve-out) + assert ["TranPPV", "match"] in [r[:2] for r in out["results"]] def test_bad_input_is_one_error_row(tmp_path): @@ -129,7 +130,7 @@ def test_compare_to_marks_the_summary(tmp_path): def test_file_prints_one_event(tmp_path, capsys): assert run.main([str(FIX), str(FIX), "--file", "M007HVWF.K30W"]) == 0 out = capsys.readouterr().out - assert any("TranPPV" in line and "accepted" in line for line in out.splitlines()) + assert any("TranPPV" in line and "OORANGE" in line for line in out.splitlines()) # ── Final review fixes ────────────────────────────────────────────────────── diff --git a/tests/test_decode_check.py b/tests/test_decode_check.py index 8e8ea1a..78d39aa 100644 --- a/tests/test_decode_check.py +++ b/tests/test_decode_check.py @@ -109,19 +109,34 @@ def test_mic_units_pick_the_conversion(): from minimateplus.decode_check_carveouts import CARVEOUTS # noqa: E402 -def test_clipped_normal_range_is_accepted(): +def _no_unit_peaks(side): + """As for a file without the unit's summary: no over-range flags, so the + saturation carve-out decides (since 2026-11-09 the flags match first).""" + pv = side.event.peak_values + for ch in ("tran", "vert", "long", "mic", "pvs"): + setattr(pv, f"{ch}_over_range", False) + return side + + +def _results_without_unit_peaks(stem): + raw = (FIX / stem).read_bytes() + ref = parse_xml_report_file(FIX / (stem.replace(".", "_") + "_XML.XML")) + return {r.field: r for r in compare(_no_unit_peaks(sfm_side(raw)), ref, CARVEOUTS)} + + +@pytest.mark.parametrize("stem,clipped", [ # Blastware: Tran 5.445, Vert 6.310, Long OORANGE, PVS OORANGE; SFM Long 10.005, PVS 11.55 - res = _results("T438HGTZ.B30W", CARVEOUTS) - assert res["TranPPV"].verdict == "match" and res["VertPPV"].verdict == "match" - for f in ("LongPPV", "PeakVectorSum"): - assert (res[f].verdict, res[f].carveout) == ("accepted", "saturation") - - -def test_a_clipped_sensitive_event_is_accepted_at_its_own_ceiling(): + ("T438HGTZ.B30W", ("LongPPV", "PeakVectorSum")), # SFM reads the 1.250 range from the file; the clipped channels sit at 1.2506. - res = _results("M007HVWF.K30W", CARVEOUTS) - assert res["GeoRange"].verdict == "match" and res["samples.Tran"].verdict == "match" - for f in ("TranPPV", "PeakVectorSum"): + ("M007HVWF.K30W", ("TranPPV", "PeakVectorSum")), +]) +def test_a_clipped_event_matches_by_the_units_own_peak(stem, clipped): + res = _results(stem, CARVEOUTS) + for f in clipped: + assert res[f].verdict == "match", (f, res[f]) + # Without the unit's summary the saturation carve-out still accepts them. + res = _results_without_unit_peaks(stem) + for f in clipped: assert (res[f].verdict, res[f].carveout) == ("accepted", "saturation") @@ -129,7 +144,7 @@ def test_the_carveout_never_accepts_an_8x_value(): # What SFM produced while it assumed Normal on a Sensitive unit: 8x high. # The saturation rule must leave it a mismatch. raw = (FIX / "M007HVWF.K30W").read_bytes() - side = sfm_side(raw) + side = _no_unit_peaks(sfm_side(raw)) # the carve-out's guard, not the unit's peaks side.values.update(TranPPV=10.005, VertPPV=10.005, LongPPV=10.005, PeakVectorSum=17.33) side.geo_ips_per_count = 10.0 / 32000 res = {r.field: r for r in compare(side, parse_xml_report_file(FIX / "M007HVWF_K30W_XML.XML"), @@ -157,7 +172,7 @@ def test_pvs_carveout_needs_the_clipped_channel_at_the_ceiling(): raw = (FIX / "M007HVWF.K30W").read_bytes() ref = parse_xml_report_file(FIX / "M007HVWF_K30W_XML.XML") ref.scalars.update(TranPPV="0.157", VertPPV="0.157", LongPPV="0.157") - side = sfm_side(raw) + side = _no_unit_peaks(sfm_side(raw)) side.values.update(TranPPV=1.256, PeakVectorSum=2.0) res = {r.field: r for r in compare(side, ref, CARVEOUTS)} assert res["PeakVectorSum"].verdict == "mismatch" @@ -431,3 +446,30 @@ def test_the_monitor_log_matches_blastware(path): ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML")) res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)} assert res["MonitorLog"].verdict == "match", res["MonitorLog"] + + +# ── Over range (2026-11-09) ───────────────────────────────────────────────── +_OR = FIX.parent / "over-range-11-09-26" + + +@pytest.mark.parametrize("path", [ + _US / "O117I1NK.R70W", # everything over, the "Out of Range" line + _OR / "O121L4L1.GU0H", # Tran over: its PPV and the vector sum + _OR / "K558KD43.NZ0H", # the mic over, the "Out of Range" line + _OR / "M007JC05.OI0H", # vector sum 14.49 in/s, printed as a number +]) +def test_over_range_matches_blastware(path): + ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML")) + res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)} + for f in ("TranPPV", "VertPPV", "LongPPV", "PeakVectorSum", "MicLPSPL", "OORANGE"): + if ref.scalars.get(f) is not None: + assert res[f].verdict == "match", (f, res[f]) + + +def test_an_over_range_flag_against_a_printed_number_is_a_mismatch(): + path = _OR / "M007JC05.OI0H" + ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML")) + sfm = sfm_side(path.read_bytes()) + sfm.event.peak_values.pvs_over_range = True # SFM would print OORANGE; Blastware printed 14.49 + res = {r.field: r for r in compare(sfm, ref, CARVEOUTS)} + assert res["PeakVectorSum"].verdict == "mismatch"