feat(decode): ZC frequency, peak displacement and times of peak from the unit's own event summary
After its embedded event record, every Blastware event file carries the
unit's own per-channel summary: a chain of [length][id][payload] records,
ids 0x32 Tran .. 0x35 MicL, each with min, max, peak sample,
half-period and a displacement integral; the event record itself holds
the vector-sum peak's sample. Blastware prints these as they are
(measured on DL2, 2026-11-05):
- ZC frequency = (rate / 2) / half-period: 15,844 / 15,844 waveform and
104,000 / 104,000 histogram values; every word too (">100" at <= 5
samples, "N/A" at 0, "<1.0" beyond rate / 2). Recomputing from the
samples had reached 46%: the unit works at full resolution.
- peak displacement = half the integral x 16 counts x in/s per count /
rate: 19,479 / 19,479 (84% recomputed).
- times of peak and the vector-sum time now come from the unit's peak
samples. They equal the samples' argmax on 25,962 / 25,966 channels;
the 4 others are O117I1NK.R70W, whose stored samples wrap at the
trigger (Blastware's own sample table has the same wrapped values).
The event-record readers return the validated record's offset, so the
summary is read from that spot only. No summary: nothing is set, and
times of peak stay the samples'.
The checker reports ZC frequency and displacement, and reads the mic's
above-range flag under its real name (mic_zc_above_range).
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
1 parent
c9f41deadd
commit
9091fe75a9
14 files changed
+14345
-27
No files matched your search
@@ -40,8 +40,10 @@ def test_event_type_comes_from_the_bytes():
|
||||
def test_report_fields_stay_blank():
|
||||
s = sfm_side((FIX / "T1905KDW.5F0W").read_bytes())
|
||||
# (BatteryLevel and Calibration are read since 2026-11-03, peak acceleration
|
||||
# since 2026-11-04: test_the_setup_fields_match_blastware, test_waveform_peak_detail_*)
|
||||
for tag in ("TranZCFreq", "TranPeakDisplacement", "TranTestResults"):
|
||||
# since 2026-11-04, ZC frequency and displacement since 2026-11-05:
|
||||
# test_the_setup_fields_match_blastware, test_waveform_peak_detail_*,
|
||||
# test_zc_frequency_and_displacement_match_blastware. Its Tran ZC is N/A.)
|
||||
for tag in ("TranZCFreq", "TranTestResults"):
|
||||
assert s.values.get(tag) is None
|
||||
|
||||
|
||||
@@ -67,7 +69,7 @@ def test_full_waveform_row_verdicts():
|
||||
for f in ("SampleRate", "RecordTime", "Pre-triggerLength", "EventDate", "EventTime",
|
||||
"notes", "samples.Tran", "samples.Vert", "samples.Long"):
|
||||
assert res[f].verdict == "match", (f, res[f])
|
||||
assert res["TranZCFreq"].verdict in ("sfm_blank", "no_reference")
|
||||
assert res["TranZCFreq"].verdict == "match" # ">100", the unit's own (2026-11-05)
|
||||
assert res["BatteryLevel"].verdict == "match" # 6.72 V, printed "6.7 Volts"
|
||||
assert "FileName" not in res
|
||||
|
||||
@@ -91,7 +93,7 @@ def test_an_extra_reference_row_is_a_mismatch_with_detail():
|
||||
def test_zc_frequency_na_and_above_range():
|
||||
res = _results("T1905KDW.5F0W") # its JobNumber: test_the_job_number_matches_blastware
|
||||
assert res["TranZCFreq"].verdict == "no_reference" # N/A
|
||||
assert res["VertZCFreq"].verdict == "sfm_blank" # >100, SFM has no flag yet
|
||||
assert res["VertZCFreq"].verdict == "match" # >100: the unit's half-period
|
||||
|
||||
|
||||
def test_mic_units_pick_the_conversion():
|
||||
@@ -355,3 +357,39 @@ def test_waveform_peak_detail_matches_blastware(path):
|
||||
"PeakVectorSumTimeSum", "TranPeakAcceleration", "VertPeakAcceleration",
|
||||
"LongPeakAcceleration"):
|
||||
assert res[f].verdict == "match", (f, res[f])
|
||||
|
||||
|
||||
# ── Group D, part 2: the unit's own summary (2026-11-05) ────────────────────
|
||||
_US = FIX.parent / "unit-summary-11-05-26"
|
||||
_ZC_AND_DISP = ([f"{ch}ZCFreq" for ch in ("Tran", "Vert", "Long", "MicL")]
|
||||
+ [f"{ch}PeakDisplacement" for ch in ("Tran", "Vert", "Long")])
|
||||
|
||||
|
||||
@pytest.mark.parametrize("path", [
|
||||
FIX / "R352HIUI.F40W", FIX / "T1905KDW.5F0W",
|
||||
FIX.parent / "setup-fields-11-03-26" / "T189HUD6.QE0W",
|
||||
FIX / "T004JTRF.ME0H", FIX / "M529L4XQ.R30H", # histograms
|
||||
_US / "K558IKSJ.P20W", # "<1.0" and N/A
|
||||
_US / "O117I1NK.R70W", # the mic's ">100"; clipped
|
||||
])
|
||||
def test_zc_frequency_and_displacement_match_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)}
|
||||
checked = 0
|
||||
for f in _ZC_AND_DISP:
|
||||
printed = ref.scalars.get(f)
|
||||
if printed is None:
|
||||
continue
|
||||
want = "no_reference" if printed == "N/A" else "match"
|
||||
assert res[f].verdict == want, (f, res[f])
|
||||
checked += want == "match"
|
||||
assert checked >= 3
|
||||
|
||||
|
||||
def test_a_clipped_events_peak_times_match_blastware():
|
||||
path = _US / "O117I1NK.R70W"
|
||||
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 ("TranTimeofPeak", "VertTimeofPeak", "LongTimeofPeak", "MicLTimeofPeak",
|
||||
"PeakVectorSumTimeSum"):
|
||||
assert res[f].verdict == "match", (f, res[f])
|
||||
Reference in new issue
Block a user