fix(decode): the mic's own range -- a range-1 mic reads an eighth

The mic's channel block carries a range byte at the geophones' offset
(label + 29, reference D.6.4).  At 1 each count is an eighth, 0.25 / 8
Pa: set on 7 DL2 events, all of them Blastware's values divided by 8,
and on none of the other 70,026 -- independently of the geophone range
(28 events have Sensitive geophones and a range-0 mic).  SFM read those
7 mics 8x high: K557J1XQ.GF0W is 79.4 dB(L), not 97.5.

Event.mic_range; the decoded mic peak (and so the .h5 mic samples, whose
scale is the peak's) and the checker's mic conversions follow it.

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 13:32:07 -05:00
1 parent af8dde5114
commit 836c9e864b
7 files changed
+3266 -12

No files matched your search

Binary file not shown.
File diff suppressed because it is too large. Load diff
+22
View File
@@ -737,3 +737,25 @@ 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
# ── The mic's own range ─────────────────────────────────────────────────────
# The mic's channel block carries a range byte at the geophones' offset (label
# + 29, D.6.4): 1 makes each count an eighth -- 0.25 / 8 Pa. It is set on 7 DL2
# events, all of them Blastware's ÷8 values, and on none of the 70,026 others,
# independently of the geophone range (28 events have Sensitive geophones and
# a range-0 mic). SFM read those 7 mics 8x high (2026-11-09).
def test_a_range_1_mic_reads_an_eighth():
ev = read_blastware_file(_FIX / f"{_OR}/K557J1XQ.GF0W")
assert ev.mic_range == 1
peak = max(abs(c) for c in ev.raw_samples["MicL"]) # 6 counts
# Blastware: 79.4 dB(L) = 6 / 8 counts; as a range-0 mic it would be 97.5
assert ev.peak_values.micl == pytest.approx(peak * 0.25 / 8 / 6894.757, rel=1e-6)
def test_a_range_0_mic_is_unchanged():
ev = read_blastware_file(_FIX / f"{_US}/I145L6UJ.3Y0W")
assert ev.mic_range == 0
peak = max(abs(c) for c in ev.raw_samples["MicL"])
assert ev.peak_values.micl == pytest.approx(peak * 0.25 / 6894.757, rel=1e-6)
+10
View File
@@ -473,3 +473,13 @@ def test_an_over_range_flag_against_a_printed_number_is_a_mismatch():
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"
def test_a_range_1_mic_matches_blastware():
# Its mic range byte is 1: every count is an eighth (79.4 dB(L), not 97.5).
path = _OR / "K557J1XQ.GF0W"
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 ("MicLPSPL", "samples.MicL"):
assert res[f].verdict == "match", (f, res[f])