feat(decode): a waveform's time of peak, vector-sum time and peak acceleration

Group D, part 1, measured on 400 DL2 waveforms (2026-11-04):
- time of peak = (first peak sample - pre-trigger samples) / sample
  rate, per channel including the mic: 1,197 / 1,197 geophone values
- the vector sum's time, the same on sqrt(T^2 + V^2 + L^2): 398 / 399
- peak acceleration = the largest |v[i+1] - v[i]| x sample rate / g,
  with Blastware's g = 9.81 m/s^2: 1,190 / 1,197 (the standard 9.80665
  gives 1,073).  Blastware's manuals: 'subtracts two velocity readings
  and divides the result by the elapsed time between them'.

PeakValues gains *_time_of_peak, pvs_time and *_peak_accel_g, filled
for waveforms only.  The checker reports them.  Displacement (84% with
the manuals' half-cycle integral) and ZC frequency (46%) are not shipped
yet -- Blastware does something more there.

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 15:19:53 -05:00
1 parent 9b458b5d92
commit 233289d029
5 files changed
+99 -2

No files matched your search

+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])