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

+4
View File
@@ -402,6 +402,10 @@ class IdfEvent:
project_info=pi,
record_type=self.kind,
rectime_seconds=self.record_time_sec,
# The .h5 stores the pre-trigger in samples; it was 0 for every
# Micromate event, report or not (#45).
pretrig_samples=(round(self.pre_trigger_sec * self.sample_rate)
if self.pre_trigger_sec is not None and self.sample_rate else None),
)
ev._waveform_key = waveform_key
return ev