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:
1 parent
e542e61b68
commit
af8dde5114
12 files changed
+1097
-19
No files matched your search
+55
-13
@@ -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"
|
||||
Reference in new issue
Block a user