Release v0.35.0 — 80 of 88 report fields from the file, and monitor logs (.MLG) #60
No files matched your search
@@ -640,16 +640,21 @@ MIC_PA_PER_COUNT = 0.25
|
|||||||
# 124.2, and the 81.94 first fitted to a handful of values misses counts 119
|
# 124.2, and the 81.94 first fitted to a handful of values misses counts 119
|
||||||
# and 132. Its display chain presumably carries rounded constants; the
|
# and 132. Its display chain presumably carries rounded constants; the
|
||||||
# window, not the physics, is what is measured.
|
# window, not the physics, is what is measured.
|
||||||
_MIC_DB_REF = 81.9384
|
# ⚠ CORRECTED 2026-11-09: that window was too high. Every count Blastware
|
||||||
|
# printed in DL2 -- 1,704 in waveform sample tables, 520 in histogram
|
||||||
|
# intervals, 494 histogram peaks -- leaves [81.9382058, 81.9382266]: count
|
||||||
|
# 129 (124.2) bounds it from below, 463 (135.2, which 81.9384 prints 135.3)
|
||||||
|
# and 677 (138.5) from above. One offset serves all three.
|
||||||
|
_MIC_DB_REF = 81.938216
|
||||||
|
|
||||||
|
|
||||||
def mic_count_to_db(count: int) -> float:
|
def mic_count_to_db(count: int) -> float:
|
||||||
"""Convert a MicL ADC count to dB(L) for BW-display-compatible output.
|
"""Convert a MicL ADC count to dB(L) for BW-display-compatible output.
|
||||||
|
|
||||||
dB = sign(count) × (81.9384 + 20 × log10(|count|)) for |count| ≥ 1
|
dB = sign(count) × (81.938216 + 20 × log10(|count|)) for |count| ≥ 1
|
||||||
dB = 0.0 for count == 0
|
dB = 0.0 for count == 0
|
||||||
|
|
||||||
81.9384 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
81.938216 ≈ 20 log10(0.25 Pa / 20 µPa); see _MIC_DB_REF.
|
||||||
count=±1 → ±81.94 dB; count=813 → 140.14 dB (the V70 fixture).
|
count=±1 → ±81.94 dB; count=813 → 140.14 dB (the V70 fixture).
|
||||||
"""
|
"""
|
||||||
if count == 0:
|
if count == 0:
|
||||||
|
|||||||
@@ -512,6 +512,19 @@ def test_mic_count_to_db_v70_peak():
|
|||||||
assert abs(mic_count_to_db(-813) - (-140.14)) < 0.1
|
assert abs(mic_count_to_db(-813) - (-140.14)) < 0.1
|
||||||
|
|
||||||
|
|
||||||
|
@pytest.mark.parametrize("count,printed", [
|
||||||
|
# Blastware's dB offset is pinned to [81.9382058, 81.9382266] by every DL2
|
||||||
|
# count it printed -- 1,704 in sample tables, 520 in histogram intervals,
|
||||||
|
# 494 histogram peaks (2026-11-09). These three counts bound it:
|
||||||
|
(129, "124.2"), # from below: the physical 81.93820 prints 124.1
|
||||||
|
(463, "135.2"), # from above in intervals and peaks: 81.9384 prints 135.3
|
||||||
|
(677, "138.5"), # from above in the sample tables
|
||||||
|
])
|
||||||
|
def test_mic_db_prints_as_blastware_at_its_rounding_edges(count, printed):
|
||||||
|
from minimateplus.decode_check import matches_printed
|
||||||
|
assert matches_printed(mic_count_to_db(count), printed), mic_count_to_db(count)
|
||||||
|
|
||||||
|
|
||||||
# ── End-to-end: decode_a5_frames (production entry point) ───────────────────
|
# ── End-to-end: decode_a5_frames (production entry point) ───────────────────
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user