fix(idf): a Thor file's own settings, notes and time (#44, #45)

A Micromate event read without Thor's report (SFM's own downloads) came out
with sample rate, pre-trigger and record time 0, empty notes, and a
1970-01-01 time; every Micromate .h5, report or not, stored pre-trigger 0.

- The settings were found by the bytes be 80 00 00 00 00 -- a -0.25 s
  pre-trigger and Fixed stop mode, not a marker -- so any other pre-trigger
  left them unread.  The event's settings record is now found by its own
  signature 00 2a 04 00 00 (fields at the live 0x1A block's head offsets).
- The event time is read at settings record + 0x34, not two fixed offsets
  that miss a header shape.
- The four notes are read at 0x23c ([label 22][value 42] x 4).
- IdfEvent.to_minimateplus_event sets pretrig_samples.
- save_imported_idf fills the pre-trigger and notes from the file when the
  report lacks them.

Measured against Thor's own reports on 2,027 corpus files: sample rate and
notes 2,027 / 2,027; record time and pre-trigger 291 / 291 waveforms; event
time = filename on 2,384 / 2,384.  The issues' 20 UM12947 bench files now
store 4096 S/s, 4096 pre-trigger samples (1.0 s), 3 s and their notes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-20 14:45:52 -05:00
1 parent c0561f9de6
commit f7a02b1fee
12 files changed
+5856 -33

No files matched your search

+7
View File
@@ -607,6 +607,13 @@ class WaveformStore:
report_dict["sample_rate"] = binary_md.sample_rate
if binary_md.record_time_sec and not report_dict.get("record_time_sec"):
report_dict["record_time_sec"] = binary_md.record_time_sec
# The pre-trigger and notes, from the file's own settings record
# and note block (#44, #45; 2,027 / 2,027 against Thor's reports).
if binary_md.pre_trigger_sec is not None and report_dict.get("pre_trigger_sec") is None:
report_dict["pre_trigger_sec"] = binary_md.pre_trigger_sec
for key in ("project", "client", "operator", "notes"):
if getattr(binary_md, key) and not report_dict.get(key):
report_dict[key] = getattr(binary_md, key)
# Calibration date (binary) vs calibration text (.txt) cohabit
# under different keys; no overwrite needed.
if binary_md.event_datetime and not report_dict.get("event_type"):