merge: a waveform's time of peak, vector-sum time and peak acceleration (group D, part 1)

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-04 17:54:56 -05:00
commit 401d83dc2c
5 files changed
+103 -2

No files matched your search

+27
View File
@@ -495,3 +495,30 @@ def test_a_histogram_without_its_record_falls_back_to_the_footer_and_says_so():
assert ev.timestamp_source == "footer"
assert ev.timestamp.second == 25 # the footer's start, a second early
assert any("histogram event record" in p for p in ev.decode_problems)
# ── Group D, part 1: time of peak, vector-sum time, peak acceleration ───────
# Measured on 400 DL2 waveforms (2026-11-04):
# time of peak = (peak sample - pre-trigger samples) / sample rate: 1,197 / 1,197
# vector-sum time, the same on sqrt(T^2 + V^2 + L^2): 398 / 399
# peak acceleration = largest |v[i+1] - v[i]| x rate / g, with Blastware's g
# fitted to [386.2236, 386.2240] in/s^2 by every DL2 value: 19,475 / 19,479
@pytest.mark.parametrize("rel,times,pvs_time,accel", [
(f"{_SF}/T189HUD6.QE0W",
{"tran": 0.004, "vert": 0.001, "long": 0.024, "micl": 0.003}, 0.016, (0.027, 0.013, 0.027)),
("decode-checker-10-29-26/R352HIUI.F40W",
{"tran": 0.000, "vert": 0.000, "long": 0.000, "micl": 0.005}, 0.000, (1.617, 0.278, 0.318)),
])
def test_waveform_peak_detail_comes_from_the_samples(rel, times, pvs_time, accel):
pv = read_blastware_file(_FIX / rel).peak_values
for ch, t in times.items():
assert abs(getattr(pv, f"{ch}_time_of_peak") - t) <= 0.0005 + 1e-9, (ch, getattr(pv, f"{ch}_time_of_peak"))
assert abs(pv.pvs_time - pvs_time) <= 0.0005 + 1e-9
for got, want in zip((pv.tran_peak_accel_g, pv.vert_peak_accel_g, pv.long_peak_accel_g), accel):
assert abs(got - want) <= 0.0005 + 1e-9, (got, want)
def test_a_histogram_has_no_waveform_peak_detail():
pv = read_blastware_file(_FIX / "decode-checker-10-29-26/T004JTRF.ME0H").peak_values
assert (pv.tran_time_of_peak, pv.pvs_time, pv.tran_peak_accel_g) == (None, None, None)
+14 -2
View File
@@ -39,8 +39,9 @@ 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: test_the_setup_fields_match_blastware)
for tag in ("TranZCFreq", "TranPeakAcceleration", "TranTestResults"):
# (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"):
assert s.values.get(tag) is None
@@ -343,3 +344,14 @@ def test_histogram_times_match_blastware(path):
for f in (("HistogramStartDate", "HistogramStartTime", "HistogramStopTime", "intervals.Time")
+ tuple(t for t in _PEAK_TIMES if t in ref.scalars)):
assert res[f].verdict == "match", (f, res[f])
@pytest.mark.parametrize("path", [FIX / "R352HIUI.F40W",
FIX.parent / "setup-fields-11-03-26" / "T189HUD6.QE0W"])
def test_waveform_peak_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 ("TranTimeofPeak", "VertTimeofPeak", "LongTimeofPeak", "MicLTimeofPeak",
"PeakVectorSumTimeSum", "TranPeakAcceleration", "VertPeakAcceleration",
"LongPeakAcceleration"):
assert res[f].verdict == "match", (f, res[f])