From b6e726f850e1b0db14e1db528c37093a7083b525 Mon Sep 17 00:00:00 2001 From: serversdown Date: Mon, 2 Nov 2026 14:03:47 -0500 Subject: [PATCH] docs: the event-file fields SFM reads from the file alone (reference Appendix D.6) New Appendix D.6 records the bytes and DL2 verification for every field SFM reads from a Blastware event file: record type STRT[18], the recording-setup block (sample rate k-42, pre-trigger k-36, record time k-30, the four notes), the geophone range (label+29), each histogram interval's PVS^2, and the mic scale (0.25 Pa per count, dB offset 81.9384). None of these were written down outside code and issues. Retracted in place: - D.3.1's STRT[20] = record time: it is 00 on 70,041 / 70,041 DL2 files. - the 2026-08-26 reading of sub-minute histogram records as little- endian: big-endian from byte 5 since v0.32.0 (#47/#49), and the '2-word tail' is the PVS^2. Also in CLAUDE.md. Measured for #48 (files only): the 1A 'stable anchor' be 80 00 00 00 00 is the setup's pre-trigger -0.25 s plus 00 00. It is present only on the 3,886 / 6,541 DL2 waveforms recorded at exactly -0.25 s, and on no histogram. The live 1A read is still unmeasured. CLAUDE.md: Where things stand reflects the range fix on dev (6,524 / 6,524 waveforms exact); the 8x sensitive-range item and the MicL dB item are marked resolved in place. Co-Authored-By: Claude Opus 5.5 Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9 --- CLAUDE.md | 49 ++++++--- docs/instantel_protocol_reference.md | 156 ++++++++++++++++++++++++++- 2 files changed, 187 insertions(+), 18 deletions(-) diff --git a/CLAUDE.md b/CLAUDE.md index 8ceb078..83fd210 100644 --- a/CLAUDE.md +++ b/CLAUDE.md @@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as --- -## Where things stand (updated 2026-11-01) +## Where things stand (updated 2026-11-02) Read this first when picking the project back up. @@ -25,14 +25,16 @@ Read this first when picking the project back up. `~/dl2-archive/checker-runs/` and is never committed. - **The rule:** every mismatch is SFM's bug unless a carve-out with evidence covers it. + - **Byte layouts** of every field read from the file: + `docs/instantel_protocol_reference.md` Appendix **D.6**. - **As of v0.33.0:** + **As of v0.33.0, plus the range fix on `dev` (`057df47`, 2026-11-02):** - ✅ **Match on every event:** sample rate, record time, pre-trigger, notes, - and event type (#41, from STRT[18]). - - ✅ **Geophone samples** are exact on 6,491 / 6,524 waveforms in every year. - The 33 others are the 1.250 in/s range, 8× under SFM's Normal-range - assumption. - - ✅ **Histogram PVS** = the stored per-interval PVS²: 69,919 / 70,042. + event type (#41, from STRT[18]), and geophone range (`dev`). + - ✅ **Geophone samples** are exact on **6,524 / 6,524** waveforms in every + year (`dev`). v0.33.0 had 6,491: the 33 others were on the 1.250 in/s + range, 8× high under SFM's old Normal-range assumption. + - ✅ **Histogram PVS** = the stored per-interval PVS²: 69,952 / 70,042. - ✅ **Mic: one count = 0.25 Pa,** with Blastware's dB offset at 81.9384. It fails on only a few dozen events. - ❌ **Open:** @@ -44,8 +46,12 @@ Read this first when picking the project back up. - Blastware prints `OORANGE` when the vector sum alone exceeds the range (a carve-out to prove) - ⬜ **Not read yet:** job number, ZC frequency, acceleration, displacement, - time of peak, sensor check, battery, calibration, range, units, monitor - log. + time of peak, sensor check, battery, calibration, units, monitor log. + - 🔶 **#48, measured on files only:** the 1A "stable anchor" + `be 80 00 00 00 00` is the setup's pre-trigger −0.25 s followed by + `00 00`. It appears only on the 3,886 / 6,541 DL2 waveforms recorded at + exactly −0.25 s, and on no histogram. Whether the live 1A read breaks the + same way is still unmeasured (reference D.6.2). - **The Series-4 LIVE wire protocol is reverse-engineered end to end (2026-09-25).** `docs/micromate_protocol_reference.md` is the Series-4 Rosetta Stone, sibling to `instantel_protocol_reference.md`. **A Micromate @@ -229,8 +235,9 @@ Read this first when picking the project back up. over) needs a BW capture of a spanning event first. Do not ship layer one alone without a loud truncation warning — a silently short event is the failure mode this codec has been bitten by repeatedly. -- **Open, not blocking:** 14 sensitive-range files show an exact 8x - (= 10.0/1.25) units discrepancy; `scripts/backfill_sidecars.py --force` also +- **Open, not blocking:** ~~14 sensitive-range files show an exact 8x + (= 10.0/1.25) units discrepancy~~ (**resolved on `dev` 2026-11-02:** the + range is read from the file, reference D.6.4); `scripts/backfill_sidecars.py --force` also inserts DB rows for store files that have none (one-time per store) and the dry-run does not report that count. - **After any codec change, regenerate the store** — `backfill_sidecars.py` @@ -640,6 +647,14 @@ block still covers exactly one minute: | 15 s | 4 | 92 | | 2 s | 30 | 612 | +> ⚠ **CORRECTED in v0.32.0 (#47/#49), recorded here 2026-11-02.** The +> records are **big-endian, starting at byte 5**. Each holds a uint16 peak +> and a uint16 half-period per channel, then the interval's **PVS² as a +> uint32 BE**. Record = 4 × channels + 4 bytes: 20 with the mic, 16 +> without. `stride = 12 + n × record`. The little-endian reading below was +> the same words shifted by one byte. Its "2-word tail" is the PVS² +> (reference D.6.5). + `stride = 12 + n * 20`. Block = `[00][segment][ctr uint16 LE][0a][00]`, then n x 20-byte records of 8 x uint16 **LITTLE**-endian values (`T_peak, T_halfp, V_peak, V_halfp, L_peak, L_halfp, M_peak, M_halfp`) @@ -647,6 +662,7 @@ plus a 2-word tail whose first word is `0000` on every real interval, then a 6-byte block trailer. ⚠ The standard 32-byte block is BIG-endian; this variant is LITTLE-endian. +*(Retracted: both are big-endian; see the box above.)* Recovers **415 files** (216 on BE18193, 199 on BE9440) that decoded to nothing. Ground truth `BE9440/K440L3AQ.T70H` matches its BW ASCII export @@ -674,6 +690,9 @@ block has its own tail signature. Two long-standing errors: `1e 0a 00 00`, with arbitrary bytes at `[21:23]`. Rejecting it dropped the final interval of nearly every histogram — frequently the one holding the event peak, so the file's PPV read low. +- **`[21:25]` is the interval's PVS² as a uint32 BE** (v0.33.0, reference + D.6.5). The "arbitrary bytes" above are probably its high half + (inferred). Verified against 1211 production histograms paired with their BW ASCII exports: **1211/1211 decode exactly** (interval count plus every @@ -682,11 +701,13 @@ with zero mismatches. Before: 1 of 1196. ### What's NOT solved -- **MicL channel conversion to dB(L)** — the codec emits MicL as +- ~~**MicL channel conversion to dB(L)** — the codec emits MicL as raw ADC counts (same format as geo channels), but BW's ASCII export shows mic in dB(L) with ~6 dB quantization steps. Need to map ADC counts → dB(L) for direct comparison; likely - `dB = 20*log10(|counts|) + offset` or similar. + `dB = 20*log10(|counts|) + offset` or similar.~~ **Solved in v0.33.0.** + One count = 0.25 Pa, and dB(L) = 81.9384 + 20·log10(|count|), an offset + measured from Blastware's printed values (reference D.6.6). - **Variable-prefix segment descriptors** — 3 of the 75 ground-truth production events still truncate. The walk reaches a segment header whose channel-id field is preceded by a *variable-width* prefix (2, 4 @@ -1345,7 +1366,7 @@ Do NOT use fixed absolute offsets for sample_rate or record_time. | trigger_level_geo | float32 BE, located in channel block | | alarm_level_geo | float32 BE, adjacent to trigger_level_geo | | geo_hardware_constant (adc_scale_factor) | float32 BE at **channel_label+28** in both read (E5) and write (SUB 71) payloads — reads **6.206053** on BOTH tested units (BE11529 and BE18189); identical across all geo channels (Tran/Vert/Long) and all captures. **Confirmed 2026-04-17 from Interface Handbook §4.5**: this is the **ADC-to-velocity scale factor** = 1/sensitivity = (in/s per V). Firmware uses it as: `PPV (in/s) = ADC_voltage × 6.206053`. Cross-check: `1.61133 V (ADC full-scale) × 6.206053 = 10.000 in/s` (Normal range ✅). Do NOT write this field — it is a hardware/firmware constant. | -| geo_range (sensitivity selector) | **uint8 at channel_label+33** in both read (E5) and write (SUB 71) payloads — **CONFIRMED 2026-04-20** from 4-20-26 geo sensitivity captures: `0x00` = Normal 10.000 in/s (standard gain), `0x01` = Sensitive 1.250 in/s (high gain). Present in all three geo channel blocks (Tran, Vert, Long). **NOTE: `channel_label+20` reads `0x01` on ALL captures regardless of range setting — it is NOT this field.** Note: the "SUB 71 write offset = +29" that appears in earlier analysis was an artifact of incorrect BW-style destuffing applied to write frame data — write frame data is RAW, so the literal `0x10` bytes in the channel block header are preserved, and the offset is the same as in the E5 read payload. | +| geo_range (sensitivity selector) | **uint8 at channel_label+33** in both read (E5) and write (SUB 71) payloads (an event file's setup copy has it at label+29: reference D.6.4) — **CONFIRMED 2026-04-20** from 4-20-26 geo sensitivity captures: `0x00` = Normal 10.000 in/s (standard gain), `0x01` = Sensitive 1.250 in/s (high gain). Present in all three geo channel blocks (Tran, Vert, Long). **NOTE: `channel_label+20` reads `0x01` on ALL captures regardless of range setting — it is NOT this field.** Note: the "SUB 71 write offset = +29" that appears in earlier analysis was an artifact of incorrect BW-style destuffing applied to write frame data — write frame data is RAW, so the literal `0x10` bytes in the channel block header are preserved, and the offset is the same as in the E5 read payload. | | setup_name | ASCII, null-padded, in cfg body | | project / client / operator / sensor_location | ASCII, label-value pairs | diff --git a/docs/instantel_protocol_reference.md b/docs/instantel_protocol_reference.md index ccd9fa9..a59d4b7 100644 --- a/docs/instantel_protocol_reference.md +++ b/docs/instantel_protocol_reference.md @@ -11,9 +11,10 @@ | Date | Section | Change | |---|---|---| +| 2026-11-02 | Appendix D.3.1, D.6 (NEW), §15 | ✅ **Event fields SFM reads from the file alone (v0.33.0, plus the range on `dev`).** New D.6 records the bytes and the DL2 verification for each field: the record type `STRT[18]`, the recording-setup block (sample rate, pre-trigger, record time, the four notes), the geophone range (label + 29 in the setup's channel blocks), each histogram interval's PVS², and the mic scale (one count = 0.25 Pa). **Retracted in place:** D.3.1's `STRT[20]` = record time (it is `00` on every DL2 file; the "70 s" SFM used to report was `STRT[18]`, the record-type byte), and the 2026-08-26 reading of sub-minute histogram records as little-endian (big-endian from byte 5 since v0.32.0, #47/#49). 🔶 **For #48 (measured on files only):** the 1A "stable anchor" `be 80 00 00 00 00` is the file's pre-trigger −0.25 s followed by `00 00`. It appears only on the 3,886 / 6,541 DL2 waveforms recorded at exactly −0.25 s, and on no histogram. | | 2026-10-26 (5) | §7.8.9 | ✅ **The embedded event record: the instrument's trigger time, inside the 5A stream.** Every Blastware waveform file carries `00 28 05 00 ?? ?? fe 80 [trigger 8 B][stop 8 B]`, times as `dd mm yyyy(BE) 00 hh mm ss`. The trigger equals Blastware's report 1,320/1,320, the filename 7,935/7,935 and the unit's 0C record 10/10. It occurs once in the unit's own A5 payloads (8/8 events) and in SFM-only downloads (2/2): instrument data, not Blastware's. The footer's `ts2 - record time` is only an estimate, a second off on ~19%. Decoder rule, validation and an open case (3 waveform-named files the codec does not recognise) in §7.8.9. 🔶 The §7.5 `0C` "sub_code" timestamp variants look like the same 8-byte form read with its escapes. | | 2026-10-17 | §7.6.1 | 🔶 **OPEN — the 6-byte "stable anchor" may be two settings at their defaults, not a constant.** Series IV's `0x1A` has the same field order as the S3 compliance block, and a keypad diff pass on a Micromate (UM20147) measured the bytes in the anchor's position: `[f32 BE pre-trigger, negative seconds][record stop mode, 00 00 = Fixed]`. `be 80 00 00` is exactly −0.25 s. If S3 matches — **inferred, not measured on S3** — then any S3 unit set to Record Stop Mode = Auto (a basic Blastware Compliance Setup option) or a non-default pre-trigger loses the anchor, and `client.py` silently decodes no recording mode / sample rate / interval / record time and skips them on write. No S3 capture has ever been taken in Auto stop mode (see the 2026-03-09 Auto Window rows), which would explain why the anchor never broke. To settle: one BW capture with Record Stop Mode = Auto. See `docs/micromate_protocol_reference.md` → *The `0x1A` field map from a keypad pass*. | -| 2026-08-26 | S7.6.2, S15 | **MULTI-INTERVAL HISTOGRAM BLOCKS - sub-minute intervals pack several per block.** The device always writes one minute of data per block, so a shorter histogram interval means more intervals packed into a longer block: 1 min -> 1 (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612), with `stride = 12 + n * 20`. Each 20-byte record holds 8 x uint16 **little**-endian values (peak/half-period per channel) plus a 2-word tail whose first word is `0000` on every real interval. The standard block is big-endian - the variant is not. This recovers **415 files** (216 on BE18193 at 2 s, 199 on BE9440 at 15 s) that previously decoded to nothing, and before that were being accepted by the WAVEFORM codec and returning garbage up to 400x the device-reported PPV. | +| 2026-08-26 | S7.6.2, S15 | **MULTI-INTERVAL HISTOGRAM BLOCKS - sub-minute intervals pack several per block.** ⚠ *Corrected 2026-11-02: the records are big-endian from byte 5, not little-endian (v0.32.0, #47/#49), and the "2-word tail" is the interval's PVS². See D.6.5.* The device always writes one minute of data per block, so a shorter histogram interval means more intervals packed into a longer block: 1 min -> 1 (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612), with `stride = 12 + n * 20`. Each 20-byte record holds 8 x uint16 **little**-endian values (peak/half-period per channel) plus a 2-word tail whose first word is `0000` on every real interval. The standard block is big-endian - the variant is not. This recovers **415 files** (216 on BE18193 at 2 s, 199 on BE9440 at 15 s) that previously decoded to nothing, and before that were being accepted by the WAVEFORM codec and returning garbage up to 400x the device-reported PPV. | | 2026-08-25 (3) | S7.6.1, S15 | **THE WAVEFORM BODY IS A RECORD CHAIN, NOT A TAG STREAM — supersedes the segment-header model entirely.** Records are self-delimiting: `off+2` is a uint16 BE length and `next = off + 2 + len`; the chain ends on a record whose chan_id is `0x06`. `off+8` holds a 3-valued mode enum - `02 00` (14-byte header, anchors, cumulative deltas), `01 00` (10-byte, no anchors, ABSOLUTE values), `00 03` (10-byte, no tags at all, raw 12-bit absolute). **`40 NN` is an ordinary int16 BE data block of length 2*NN+2**, never a header; reading it as a 2*NN+16 header is what made walks drift, and the 'variable prefix' of 0/2/4/6/8 bytes reported earlier the same day was walker drift, exactly `4 - (old_stop - true_record_start)`. Verified: chain terminates on `06` in 1387/1388 files; all four channels equal length in **1388/1388** (was 156/1388); ASCII sample-count exact 72/75 -> **75/75**, fully exact 70/75 -> **73/75**; device PPV on a live decode **1306/1306** waveform (mean abs ratio error 0.00000) and **4458/4459** histogram. Also eliminated the walker-over-read class: 24 of those files were histograms the waveform codec was wrongly accepting. The superseded model is retained as `decode_waveform_legacy` because `micromate/idf_file.py` pins it for Thor IDFW body-offset search. | | 2026-08-25 (2) | S7.6.2, S15 | **HISTOGRAM BLOCK IS BIG-ENDIAN + terminal block tail.** The 32-byte histogram block's per-channel fields are uint16 **big-endian** (`T_peak` [5:7], `T_halfperiod` [7:9], `V_peak` [9:11], `V_halfperiod` [11:13], `L_peak` [13:15], `L_halfperiod` [15:17], `M_peak` [17:19], `M_halfperiod` [19:21]); only `block_ctr` [2:4] is little-endian. The marker is `block[4]` alone - the previous uint16 LE marker test at [4:6] forced `block[5] == 0` and thereby capped every geo peak at 255 counts (1.275 in/s), silently clipping larger peaks. The byte previously documented as a per-channel "annotation" is the high byte of the big-endian half-period, which is why it was non-zero exactly on sub-Hz intervals. Separately, the **final block of each stream carries tail `9c 06 00 42`** rather than `1e 0a 00 00` and holds arbitrary bytes at [21:23]; rejecting it dropped the last interval of nearly every histogram. Verified against 1211 production histograms paired with their Blastware ASCII exports: 1211/1211 decode exactly, plus 842,442 per-interval frequency comparisons with zero mismatches (previously 1 of 1196 files fully correct). | | 2026-08-25 | §7.6.1, §15, Appendix E (NEW) | **BODY CODEC + SCALE PASS — five findings, all verified against 75 production events paired with their preserved Blastware ASCII exports.** (1) **Geo full scale is 32000 ADC counts, not 32768** — one decoder unit (16 counts) is exactly 0.005 in/s, so 10.000 in/s = 32000 counts. Consumers dividing by 32768 read every geophone sample and derived peak **2.34% low**; the error scales with amplitude so it was invisible on quiet events and worst on loud ones. 216 per-channel comparisons: 32768 → 151/216 exact (worst 0.238 in/s on a 10 in/s event); 32000 → 216/216 exact, worst 1 LSB. Affects waveforms, histograms and series-4 alike. (2) **Wide-NN RLE `0X NN`** — the 12-bit NN encoding already known for `1X`/`2X` also applies to the `00 NN` RLE tag (runs > 252 samples). (3) **`30 NN` is not capped at NN=0x10** — data-section blocks reach at least 0x18; the length formula was already right. (4) **`40 NN` segment headers are variable width** — NN counts the previous-channel continuation deltas, so the header is `2*NN + 16` bytes; `40 01` and `40 03` occur alongside `40 02`. A header can also appear **tagless** (the NN=0 case): just the 14-byte tail. (5) **The header field documented as a "monotonic uint32 LE counter" is really `[channel_id][00][00][segment_index]`** with 0x46=Tran 0x47=Vert 0x48=Long 0x49=MicL — verified on 1697/1697 segment headers, zero disagreements. Decoders should take the channel from this field, not from rotation position. Items (2)–(5) each caused **silent channel truncation**: an unhandled tag ends the walk and the decoder returns short channels with no error. Corpus result end-to-end: exact 37 → 72, truncated 23 → 3, full-length value errors 15 → 0. New Appendix E documents the field-observed "offset" device fault. | @@ -3170,7 +3171,7 @@ The `.bin` files produced by `s3_bridge` are **not raw wire bytes**. The logger | **RV55 DCD/DTR default** — newer Sierra Wireless RV55 firmware does not assert DCD/DTR by default, so the MiniMate Plus never detects TCP disconnect and stays idle instead of resuming monitoring. Root cause: RV55 ACEmanager `DCD Control` setting. Workaround not yet found. | MEDIUM | 2026-04-11 | Still open | | ~~**Variable-prefix segment descriptors**~~ - **RESOLVED 2026-08-25:** there is no variable prefix. The body is a chain of self-delimiting records (see S7.6.1); the 0/2/4/6/8-byte prefix was walker drift from reading `40 NN` as a segment header. All 25 affected files now chain cleanly to the `06` terminator. | RESOLVED | 2026-08-25 | Resolved 2026-08-25 | | ~~**Histogram codec drops trailing intervals (series-3)**~~ - **RESOLVED 2026-08-25.** Two errors, both in the block model. (1) The block is **uniformly big-endian**: peaks and half-periods are uint16 BE (`T_peak` [5:7], `T_halfperiod` [7:9], `V_peak` [9:11], ...); only `block_ctr` [2:4] is LE. The old uint8-peak + "annotation"-byte model silently clipped any peak above 1.275 in/s, and the "annotation" byte was really the half-period high byte - non-zero exactly on the sub-Hz intervals BW renders `<1.0`. The marker is `block[4]` alone; testing [4:6] as a uint16 LE marker forced `block[5] == 0`, which is what capped the peak at one byte. (2) The **final block of the stream carries tail `9c 06 00 42`** instead of `1e 0a 00 00`, with arbitrary bytes at [21:23]; rejecting it dropped the last interval of nearly every histogram - often the one holding the event peak. Verified on 1211 production histograms vs their BW ASCII exports: **1211/1211 exact** (interval count + every per-interval peak) and 842,442 frequency comparisons with zero mismatches; was 1/1196. | RESOLVED | 2026-08-25 | Resolved 2026-08-25 | -| ~~**Unmapped histogram block variant (415 files, 2 units)**~~ - **RESOLVED 2026-08-26.** When the histogram interval is SHORTER than one minute the device packs several intervals into a single block so each block still covers exactly one minute: 1 min -> 1 interval (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612). `stride = 12 + n * 20`. Block is `[00][segment][ctr uint16 LE][0a][00]` then n x 20-byte records of 8 x uint16 **LITTLE**-endian `T_peak,T_halfp,V_peak,V_halfp,L_peak,L_halfp,M_peak,M_halfp` plus a 2-word tail whose first word is `0000` on every real interval (a session ending mid-block leaves buffer garbage in the remaining slots), then a 6-byte block trailer. **Note the endianness flip** - the standard 32-byte block is big-endian. Ground truth `BE9440/K440L3AQ.T70H` (5,710 intervals at 15 s) decodes with 17,130/17,130 geo peaks, 22,840/22,840 frequencies and 5,710/5,710 mic dB(L) matching its Blastware ASCII export exactly; across all 455 affected files 1,354/1,365 channel peaks (99.2%) match the device-reported PPV. | RESOLVED | 2026-08-25 | Resolved 2026-08-26 | +| ~~**Unmapped histogram block variant (415 files, 2 units)**~~ - **RESOLVED 2026-08-26.** ⚠ *Corrected 2026-11-02: the records are big-endian from byte 5, not little-endian (v0.32.0, #47/#49), and the "2-word tail" is the interval's PVS². See D.6.5.* When the histogram interval is SHORTER than one minute the device packs several intervals into a single block so each block still covers exactly one minute: 1 min -> 1 interval (the standard 32-byte block), 15 s -> 4 (stride 92), 2 s -> 30 (stride 612). `stride = 12 + n * 20`. Block is `[00][segment][ctr uint16 LE][0a][00]` then n x 20-byte records of 8 x uint16 **LITTLE**-endian `T_peak,T_halfp,V_peak,V_halfp,L_peak,L_halfp,M_peak,M_halfp` plus a 2-word tail whose first word is `0000` on every real interval (a session ending mid-block leaves buffer garbage in the remaining slots), then a 6-byte block trailer. **Note the endianness flip** - the standard 32-byte block is big-endian. Ground truth `BE9440/K440L3AQ.T70H` (5,710 intervals at 15 s) decodes with 17,130/17,130 geo peaks, 22,840/22,840 frequencies and 5,710/5,710 mic dB(L) matching its Blastware ASCII export exactly; across all 455 affected files 1,354/1,365 channel peaks (99.2%) match the device-reported PPV. | RESOLVED | 2026-08-25 | Resolved 2026-08-26 | | **Micromate (UM-series) IDF decode is ~1000x low** — e.g. `UM11402_20260406130113.IDFW` decodes a Tran peak of 0.0009 in/s against a device-reported 1.1168. Distinct from the Thor IDF path, which decodes sanely. Suspect a different per-count LSB or a body offset that does not hold for UM-series files. | MEDIUM | 2026-08-25 | Still open | | **Thor IDF per-count LSB** — after the 32000 geo full-scale correction, series-4 Thor peaks sit at a median 0.983 of the device-reported peak (was 0.960 under 32768). Closer, but the residual ~1.7% suggests Thor uses its own per-count LSB rather than the BW 16-count/0.005 in/s convention. A code comment in `sfm/waveform_store.py` claims Thor's LSB is 0.0003 in/s, which would predict Thor reading *high* — the measurement shows the opposite, so that comment is unverified. | LOW | 2026-08-25 | Still open | @@ -3397,8 +3398,16 @@ The STRT record immediately follows the 22-byte header. | 4 | 2 | `ff fe` | Fixed | | 6 | 4 | event key (key4) | 4-byte waveform key | | 10 | 4 | device-specific | NOT a repeat of key4 — device-internal field | -| 14 | 6 | device-specific | NOT zero-padded — device-internal fields | -| 20 | 1 | rectime | uint8 seconds | +| 14 | 4 | device-specific | not identified (see the retraction below) | +| 18 | 1 | **record type** ✅ | `0x46` waveform, `0x0A` histogram: 6,541 / 6,541 `…W` and 63,500 / 63,500 `…H` DL2 files (2026-11-02). See D.6.1 | +| 19 | 2 | `00 00` | zero on 70,041 / 70,041 DL2 files | + +> ⚠ **RETRACTED 2026-11-02.** This table used to end `| 14 | 6 | device-specific |` and +> `| 20 | 1 | rectime | uint8 seconds |`. `STRT[20]` is `0x00` on every DL2 file, so it is not +> the record time. Until v0.33.0, SFM read a record time from `STRT[18]`, the record-type byte, +> which is why every waveform reported "70 s" (`0x46`). It also read pre-trigger and sample count +> from `[16:18]`; both were wrong (#45). The record time and pre-trigger live in the +> recording-setup block (D.6.2). **Critical:** The STRT record must be copied verbatim from A5[0].data[7+strt_pos:] — bytes [10:20] contain device-specific values that cannot be reconstructed from protocol-level Event fields alone. @@ -3576,6 +3585,10 @@ observed) and does NOT follow the AB0T formula. **DLE-shift offset note for reading recording_mode from N00/9T0 body:** +> ⚠ **2026-11-02:** this note finds the block by the 6-byte anchor. In an event file that anchor +> exists only when the pre-trigger is exactly −0.25 s: 3,886 / 6,541 DL2 waveforms, and no +> histogram. Find the block by its setup name instead (D.6.2). + The compliance block in the file body has been through `_strip_inner_frame_dles`. The 0x10 constant at logical `anchor−7` (between recording_mode and sample_rate_HI) gets stripped when sample_rate_HI = `0x04` (1024 sps), because `0x10` precedes `0x04 ∈ {0x02,0x03,0x04}`. After stripping, the anchor shifts left by 1, so: | 1024 sps (strip occurs) | 2048 or 4096 sps (no strip) | @@ -3594,6 +3607,141 @@ file[anc−4]: histogram_interval_HI file[anc−3]: histogram_interval_LO ``` +### D.6 Event fields read from the file alone ✅ 2026-10-29 → 2026-11-02 + +Since v0.33.0, SFM decodes the fields below from an event file's bytes alone: no filename, no +Blastware report. The code is in `minimateplus/event_file_io.py`, `histogram_codec.py` and +`waveform_codec.py`. + +Each field was proven by the decode checker, `scratch/check_s3_decode.py`. It compares SFM's +decode with Blastware's `_XML.XML` report for every DL2 event: 70,042 events, 2016–2026, local +copy in `~/dl2-archive`. Counts below are from that archive unless stated otherwise. + +#### D.6.1 Record type — `STRT[18]` ✅ + +| `STRT[18]` | Type | DL2 | +|---|---|---| +| `0x46` | Waveform | 6,541 / 6,541 `…W` files | +| `0x0A` | Histogram | 63,500 / 63,500 `…H` files | + +- The 5A stream shows the same byte after the STRT keys (§7.8.5, `data[35]`). +- The filename's `W` / `H` is only a cross-check. On a disagreement SFM logs it and keeps the + byte (#41). +- Checker, event type: 70,042 / 70,042. + +#### D.6.2 Recording-setup block — sample rate, pre-trigger, record time ✅ + +**Find the block by structure:** `1c 08`, then the setup name (1–40 printable ASCII), then `00`. +That pattern occurs exactly once in every DL2 file. Do not search for the name "Standard +Recording Setup": 37% of DL2 files use another name. + +Offsets are from `k`, the first byte of the setup name: + +| Offset | Type | Field | Notes | +|---|---|---|---| +| `k − 42` | uint16 BE | sample rate | 1024 / 2048 / 4096 | +| `k − 36` | float32 BE | pre-trigger | seconds, ≤ 0: `−0.25` is a quarter second before the trigger | +| `k − 32` | 2 bytes | — | `00 00` on 70,041 / 70,041 files | +| `k − 30` | float32 BE | record time | seconds | + +- Pre-trigger samples = `round(−pre-trigger × sample rate)`. +- A histogram carries the block too, with pre-trigger `0.0` (63,500 / 63,500). Blastware reports + no record time or pre-trigger for a histogram, and SFM reports none. +- Sample rate, record time and pre-trigger match Blastware on every DL2 event that reports them + (#44, #45). + +⚠ **The 1A "stable anchor" sits on the pre-trigger (measured on files, 2026-11-02).** +- This is the 1A compliance layout: sample rate at anchor − 6 and record time at anchor + 6 + (§7.6.1) put the anchor at `k − 36`. +- The 6-byte `be 80 00 00 00 00` is the pre-trigger −0.25 s (`be 80 00 00`) followed by the + `00 00` at `k − 32`. +- It occurs in a file only when the pre-trigger is exactly −0.25 s: 3,886 / 6,541 waveforms. + The other 2,655 waveforms (−0.249, −0.248, −0.2471, 0.0 and others) and all 63,500 + histograms contain it nowhere. +- 🔶 **The live 1A read is not measured.** This supports #48 but does not prove it. Live 1A + captures in Histogram mode did show the anchor, while histogram files store 0.0, so the file + and the 1A differ in at least this field. + +#### D.6.3 Notes — four label/value pairs after the name ✅ + +- After the name's `00`, NUL-terminated `label`, `value` pairs fill four slots, in order: + project, client, operator ("User Name") and sensor location ("Seis Loc"). +- **Read them by position, never by label.** Blastware lets the operator relabel the slots + ("Seis. Loc:", "Location:", "Project: "). +- An empty value means none. +- They match Blastware on every DL2 event. +- Not read yet: extended notes, job number. + +#### D.6.4 Geophone range — the setup's channel blocks ✅ 2026-11-01 + +The channel blocks follow the notes, within 2,000 bytes of the name: `00 00 01` then `Tran` / +`Vert` / `Long`. The range is the byte at label + 29, where label is the first byte of +`Tran` / `Vert` / `Long`: + +| label + 29 | Range | Full scale | +|---|---|---| +| `0x00` | Normal | 10.000 in/s | +| `0x01` | Sensitive | 1.250 in/s | + +- It matches the report's `GeoRange` on 70,042 / 70,042 events. The three channels agree on + every event, and 35 are Sensitive. +- The live 1A carries the same byte at label + 33 (§7.6, confirmed 2026-04-20). +- Full scale is 32,000 counts at either range, so a Sensitive count is 8× smaller. +- Until `dev` `057df47` (2026-11-02), SFM assumed Normal and read every Sensitive event 8× high. +- If the channels disagree, a value is unknown or a block is missing, SFM reports no range, logs + a decode problem and assumes Normal. + +#### D.6.5 Histogram interval peak vector sum ✅ 2026-10-30 + +Each interval stores its peak vector sum **squared**: + +| Block | Where | Type | +|---|---|---| +| Standard 32-byte block (intervals of a minute or more) | `[21:25]` | uint32 BE | +| Sub-minute record | the record's last 4 bytes | uint32 BE | + +- `PVS = √value × unit`. The unit is 16 counts: 0.005 in/s at Normal, 0.000625 in/s at + Sensitive. +- **The event's PVS is the largest interval's.** Combining the three channel peaks instead read + high on 86% of DL2 histograms, because the peaks can come from different moments. +- **Verified:** √value matches Blastware's "Geo PVS" on 34.5 M DL2 sub-minute intervals, and the + event PVS matches on 69,952 / 70,042 events. The rest are the open histogram cases in D.6.7. +- 🔶 On the stream's last block, the "arbitrary bytes at [21:23]" in the 2026-08-25 note are + probably the high half of this field (inferred from the layout, not measured). + +**Sub-minute records (corrected in v0.32.0, #47/#49):** +- They are **big-endian, starting at byte 5** of the block. +- Each holds, per channel, a uint16 peak and a uint16 half-period (Tran, Vert, Long, and MicL + when the mic is on), then the uint32 PVS². +- Record = 4 × channels + 4 bytes: 20 with the mic, 16 without. `stride = 12 + n × record`. + +> ⚠ **RETRACTED:** the 2026-08-26 notes (Changelog, §15) read these records as 8 × uint16 +> little-endian after a 6-byte header. That was the same big-endian words shifted by one byte. +> Their "2-word tail whose first word is 0000" is the PVS², whose high word reads `0000`. + +#### D.6.6 Mic ✅ v0.33.0 + +- One count = **0.25 Pa**, so psi = count × 0.25 / 6894.757. +- dB(L) = **81.9384** + 20·log10(|count|). + - The exact value, 20·log10(0.25 Pa / 20 µPa), is 81.9382. Blastware's printed values pin the + offset in [81.9383, 81.9385] instead. + - With the exact value, 280 events mismatched, all at count 129. + - float32 rounding does not explain the difference. +- **Verified:** interval psi mismatches fell from 42,783 to 26, and mic peak mismatches from 345 + to 40. + +#### D.6.7 Not read from the file yet + +- **Fields:** job number, extended notes, ZC frequency, acceleration, displacement, time of + peak, sensor check results, battery, calibration, units, monitor log. +- **Open cases:** + - histogram start times are 1 s early (#51) + - 35 sub-minute histograms and 2 one-minute mic-off histograms decode wrongly + - 26 histogram start dates are a day off + - the per-interval PVS is not stored + - Blastware prints `OORANGE` when the vector sum alone exceeds the range (a carve-out still to + prove) + --- *All findings reverse-engineered from live RS-232 bridge captures.*