fix(decode_check): compare a mic level in the unit it is printed in

K441LA17.IN0W's report says Units 'in/s and psi(L)' yet prints
MicTriggerLevel '125.0 dB(L)'.  The value states its own unit, so that
is the one compared; the report's Units is the fallback.  It was the
only MicTriggerLevel mismatch in DL2 (SFM's 0.005158 psi is 125.0 dB).

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-03 14:02:27 -05:00
1 parent 6c2eda5f63
commit 8d5a9987c9
2 files changed
+13 -1

No files matched your search

+3 -1
View File
@@ -191,7 +191,9 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie
if not printed.strip() or printed.strip() == "N/A":
return FieldResult(tag, "no_reference", printed, None)
if tag in ("MicLPSPL", "MicTriggerLevel"):
units = ref.event_units or ""
# A printed value that states its unit is compared in that unit:
# K441LA17.IN0W's Units say psi(L), its MicTriggerLevel "125.0 dB(L)".
units = printed if ("dB(L)" in printed or "psi(L)" in printed) else (ref.event_units or "")
key = (f"{tag} dB(L)" if "dB(L)" in units else
f"{tag} psi(L)" if "psi(L)" in units else None)
value = sfm.values.get(key) if key else None
+10
View File
@@ -269,3 +269,13 @@ def test_dB_or_psi_is_blastwares_display_preference():
def test_the_units_carveout_still_needs_the_mic():
assert _units_case("in/s").verdict == "mismatch"
def test_a_mic_trigger_level_is_read_in_the_unit_it_is_printed_in():
# K441LA17.IN0W: Units "in/s and psi(L)", yet MicTriggerLevel "125.0 dB(L)".
# The printed value states its own unit; that is the one to compare in.
sf = FIX.parent / "setup-fields-11-03-26"
ref = parse_xml_report_file(sf / "T189HUD6_QE0W_XML.XML") # 128.0 dB(L)
ref.event_units = "in/s and psi(L)"
res = {r.field: r for r in compare(sfm_side((sf / "T189HUD6.QE0W").read_bytes()), ref, CARVEOUTS)}
assert res["MicTriggerLevel"].verdict == "match", res["MicTriggerLevel"]