feat(decode): a histogram's interval detail -- frequencies (#50), vector sums, interval size, stop

Group B of the file-only decode, measured on DL2 2026-11-03:

- Frequency = (sample rate / 2) / half-period: 527,915 / 527,915 cells
  at 1024 sps and 1,725 / 1,725 at 2048.  #50: half_period_to_hz took a
  fixed 512 and halved every 2048-sps frequency; it now takes the rate
  (default 1024).  Blastware prints 'N/A' for a half-period of 0, '>100'
  ('>200' at 2048) at 5 samples or fewer, '<1.0' below 1 Hz.
- Each interval's vector sum, sqrt(PVS^2) at the event's range:
  771,354 / 771,354.
- Interval size: uint16 seconds at k - 40 (Series IV [8:10]).
- Stop: the footer's (2,995 / 2,999 sampled; 4 print a second earlier).

Event gains histogram_interval_sec, interval_half_periods, interval_pvs
and stop_time; the .h5 gains /intervals/half_period/<ch>,
/intervals/pvs_ips and a histogram_interval_sec attr.  The decoder walks
a histogram once (histogram_codec.channels_from_records) and takes the
event's PVS from the same records.  The checker compares each interval
column, number or Blastware's word; the test that pinned Tran Freq Hz
as blank now pins the match.

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 17:34:27 -05:00
1 parent 67b3ef8d0a
commit 2b698e74cf
10 files changed
+312 -32

No files matched your search

+22 -1
View File
@@ -96,7 +96,7 @@ def test_zc_frequency_na_and_above_range():
def test_mic_units_pick_the_conversion():
res = _results("T004JTRF.ME0H") # psi(L)
assert res["intervals.MicL Peak dB(L)"].verdict in ("match", "mismatch")
assert res["intervals.Tran Freq Hz"].verdict == "sfm_blank"
assert res["intervals.Tran Freq Hz"].verdict == "match" # read since 2026-11-03
fields = set(_results("R352HFZ7.530H")) # no mic
assert not any(f.startswith(("samples.MicL", "intervals.MicL")) for f in fields)
@@ -279,3 +279,24 @@ def test_a_mic_trigger_level_is_read_in_the_unit_it_is_printed_in():
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"]
@pytest.mark.parametrize("path", [FIX / "T004JTRF.ME0H",
FIX.parent / "histogram-intervals-11-03-26" / "T190LD42.T00H"])
def test_histogram_interval_detail_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 ("IntervalSize", "HistogramStopDate", "HistogramStopTime", "intervals.Tran Freq Hz",
"intervals.Vert Freq Hz", "intervals.Long Freq Hz", "intervals.MicL Freq Hz",
"intervals.Geo PVS in/s"):
assert res[f].verdict == "match", (f, res[f])
@pytest.mark.parametrize("halfp,sr,want", [
(0, 1024, "N/A"), (5, 1024, ">100"), (5, 2048, ">200"), (1024, 1024, "<1.0"),
])
def test_blastwares_interval_frequency_words(halfp, sr, want):
# N/A for a half-period of 0, ">100" / ">200" at 5 samples or fewer, "<1.0"
# below 1 Hz -- on ~3.1 M DL2 cells, 2026-11-03.
from minimateplus.decode_check import interval_frequency
assert interval_frequency(halfp, sr) == want