From 8d5a9987c93863c4b5c548f98d4f7218572bd342 Mon Sep 17 00:00:00 2001 From: serversdown Date: Tue, 3 Nov 2026 14:02:27 -0500 Subject: [PATCH] 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 Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9 --- minimateplus/decode_check.py | 4 +++- tests/test_decode_check.py | 10 ++++++++++ 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/minimateplus/decode_check.py b/minimateplus/decode_check.py index 63f09f0..e3d396b 100644 --- a/minimateplus/decode_check.py +++ b/minimateplus/decode_check.py @@ -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 diff --git a/tests/test_decode_check.py b/tests/test_decode_check.py index 6c76c80..da1eca3 100644 --- a/tests/test_decode_check.py +++ b/tests/test_decode_check.py @@ -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"]