docs: where file-only decoding stands, and that prod's ASCII overlay is scaffolding

CLAUDE.md 'Where things stand' now says plainly how prod uses a paired
Blastware ASCII report (save_imported_bw overlays its peaks, notes,
sample rate and record time onto SFM's decode), that only report-less
events run on the decoder alone, and that the overlay is scaffolding to
retire at step 3 of the plan.  The checker status is brought up to dev:
18 of 88 fields, the remaining groups A-F in the proposed order.

README roadmap: the same framing and progress.

Protocol reference:
- D.3.3: the footer is the file's last 26 bytes; footer[18:24] is not
  fixed (retracted).
- D.6.1: STRT[18] picks the codec.
- D.6.3: the job number.
- D.6.5: the PVS^2 high word is non-zero above 1.28 in/s (retracted
  'reads 0000'); the peak/PVS consistency check; Blastware's Number of
  Intervals is the monitoring time / the interval.
- D.6.7: refreshed.

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-03 13:05:58 -05:00
1 parent fcacc8f28c
commit 5a089671e8
3 files changed
+132 -29

No files matched your search

+50 -16
View File
@@ -10,10 +10,27 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
---
## Where things stand (updated 2026-11-02)
## Where things stand (updated 2026-11-03)
Read this first when picking the project back up.
- **🔑 Prod still leans on Blastware's ASCII report, and that is scaffolding.**
- **How it works today:** when a `_ASCII.TXT` report arrives with a
Blastware file, `WaveformStore.save_imported_bw` overlays its peaks, notes,
sample rate and record time onto SFM's decode
(`event_file_io.apply_report_to_event`).
- **Only events without a report** run on the decoder alone: all DL2 events
before 2025, and everything SFM downloads itself.
- **Why that matters:** the overlay made SFM trustworthy from day one. It
also hid how much the decoder could not yet do; until the checker (below)
there was no full list of what Blastware reports.
- **The goal is full function without Blastware (Brian, 2026-10-29).** The
README roadmap has four steps:
1. the checker ✅
2. complete the file-only decode, one field group at a time
3. switch ingest so reports are kept only for checking (retire the overlay)
4. stop the watchers forwarding reports
- Until step 3, prod keeps the report as truth wherever one exists.
- **🔑 The Series-3 decode checker (2026-10-29; v0.33.0).**
- **Goal:** SFM produces everything Blastware reports, from the event file
alone (spec and plan in `docs/superpowers/`).
@@ -28,25 +45,42 @@ Read this first when picking the project back up.
- **Byte layouts** of every field read from the file:
`docs/instantel_protocol_reference.md` Appendix **D.6**.
**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,
event type (#41, from STRT[18]), and geophone range (`dev`).
**Where the decoder stands on `dev`** (2026-11-03, run `20261103-121047`):
**18 of 88 fields match on every event**, up from about 6 before v0.33.0.
The four `dev` fixes below share one release and one backfill.
- ✅ **Match on every event:**
- sample rate, record time, pre-trigger, notes and event type (v0.33.0)
- geophone range, job number, event times (6,524 / 6,524) and histogram
start dates (63,518 / 63,518) — `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.
year (`dev`; v0.33.0 had 6,491, its 33 others being Sensitive-range events
read 8× high).
- ✅ **Histograms** decode to Blastware's own interval table on every DL2
file: Tran / Vert / Long interval peaks have 0 mismatches (`dev`).
- The codec is now chosen by STRT[18]. The waveform codec had been
claiming 2018 5 s histograms.
- The sub-minute layout check now tests peak ≤ PVS ≤ √3·peak.
- Blastware's "Number of Intervals" is the monitoring time ÷ the interval:
a carve-out, 8 events.
- ✅ **Histogram PVS** = the stored per-interval PVS²: 69,989 / 70,042.
**Mic:** one count = 0.25 Pa, dB offset 81.9384; a few dozen stragglers.
- ❌ **Open:**
- histogram start times are 1 s early (#51)
- 35 sub-minute (5 s / 2 s) histograms decode wrongly, plus 2 one-minute
no-mic histograms (`R352HFZ7`-shaped, likely a separate cause)
- 26 histogram start dates are a day off
- the per-interval PVS is not stored
- histogram start times are 1 s early (#51; fixing it moves every stored
histogram by 1 s, and the event key is (serial, time), so it needs a
decision first)
- the mic stragglers: ~20 one-minute histograms with an interval or two off
- 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, units, monitor log.
- ⬜ **Not read yet, in the order proposed** (2026-11-03):
- **A. Setup fields:** trigger source and levels, stop mode, mic type,
display units, firmware version, serial number, calibration, battery.
- **B. Histogram interval detail:** per-interval frequencies (#50: they
assume 1024 sps), per-interval PVS, interval size, stop time.
- **C. #51 timing:** start time, per-interval times, peak times.
- **D. Blastware's waveform calculations:** ZC frequency, acceleration,
displacement, time of peak.
- **E. Sensor check results.**
- **F. Monitor log:** probably not in the event file at all.
- 🔶 **#48 is still open.** The event file's setup block puts the pre-trigger
where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though,
it is **each event's own pre-trigger**, not the setting: 253–256 samples at
+23 -5
View File
@@ -621,16 +621,34 @@ Implementation steps (concrete):
### High-impact (unblocks product features)
- [x] **Series III waveform body codec reverse-engineering.** ✅ The body codec is fully decoded (`minimateplus/waveform_codec.py`, `histogram_codec.py`), and verified per-sample against Blastware's own exports. As of v0.33.0, geophone samples are exact on 6,491 / 6,524 DL2 waveforms against their `_XML.XML` reports, across 2016–2026.
- [ ] **SFM produces everything Blastware reports, from the event file alone.** The four-piece plan:
- [x] **Series III waveform body codec reverse-engineering.** ✅ The body codec is fully decoded (`minimateplus/waveform_codec.py`, `histogram_codec.py`), and verified per-sample against Blastware's own exports. Geophone samples are exact on all 6,524 DL2 waveforms against their `_XML.XML` reports, across 2016–2026 (`dev`; v0.33.0 had 6,491, before the geophone range was read from the file).
- [ ] **SFM produces everything Blastware reports, from the event file alone.**
**Why this matters:** until it's done, prod overlays Blastware's ASCII report onto SFM's decode wherever a report exists. That made SFM trustworthy from day one, but it is scaffolding: the goal is full function without Blastware.
The four-piece plan:
1. the decode checker ✅ v0.33.0
2. complete the file-only decode, one field group at a time, each proven by the checker
3. flip ingest so reports are kept only for checking
3. flip ingest so reports are kept only for checking (retire the overlay)
4. stop the watchers forwarding reports
**Done so far:** setup fields, notes, event type, histogram PVS, mic.
**Done so far: 18 of 88 report fields match on every DL2 event.**
- In v0.33.0: setup fields, notes, event type, histogram PVS, mic.
- On `dev`:
- the geophone range
- the job number
- histograms that decoded wrongly
- the footer: no more day-late histograms; every waveform time exact
**Next:** histogram start times (#51), the 37 histograms that decode wrongly, the job number, the geophone range (Sensitive-range events read 8×), and the values Blastware computes itself (ZC frequency, acceleration, displacement, time of peak), plus the sensor check, battery, calibration and monitor log. Design: `docs/superpowers/specs/2026-10-29-s3-decode-checker-design.md`.
**Next:**
- setup fields still unread: trigger, stop mode, units, serial, calibration, battery
- histogram interval detail: frequencies (#50), per-interval PVS, interval size, stop time
- histogram start times (#51)
- the values Blastware computes itself: ZC frequency, acceleration, displacement, time of peak
- the sensor check results
- the monitor log
Design: `docs/superpowers/specs/2026-10-29-s3-decode-checker-design.md`. Status detail: CLAUDE.md "Where things stand".
- [x] **Series IV (Thor IDF) binary codec reverse-engineering.** ✅ v0.21.0 — `micromate/idf_file.read_idf_file()` decodes both IDFW (waveform body at offset `0x0f1f`, reusing `decode_waveform_v2()`; 87–99% sample fidelity on quiet events) and IDFH (dedicated segment-based decoder: all 859 corpus files decode, 181,071 intervals, peaks within ~1.8% of sidecar values). `WaveformStore.save_imported_idf` now also projects parsed Thor data into a `bw_report` block via `micromate/idf_to_bw_report.py` so Thor events render in the existing Event Report PDF pipeline without a separate renderer.
- [ ] **In-app waveform viewer accuracy.** Depends on Series III codec decode. Plot.v1 JSON pipeline + viewer skeleton already exist; will start showing real waveforms automatically once `_decode_a5_waveform` produces correct samples. Series IV waveforms come online when the IDF codec lands.
- [ ] **Series IV live-device support.** Once the IDF binary is decoded, extend `micromate/` with `transport.py` / `framing.py` / `protocol.py` / `client.py` mirroring the `minimateplus/` package layout — depends on capturing Thor's wire protocol (TCP / RS-232 captures TBD).
+59 -8
View File
@@ -11,6 +11,7 @@
| Date | Section | Change |
|---|---|---|
| 2026-11-03 | Appendix D.3.3, D.6.1, D.6.3, D.6.5, D.6.7, §8 | ✅ **File-only decode, second pass (on `dev`).** **D.3.3:** the footer is the file's last 26 bytes (70,041 / 70,041); an earlier stop-time record fooled the first-match search on 14 files, making histograms a day late. Its `[18:24]` is **not** fixed (retracted). **D.6.1:** STRT[18] now picks the codec; the waveform codec had claimed 2018 5 s histograms. **D.6.3:** the job number (flags `k − 9` bit `0x02`, uint16 at `k − 8`; 2,997 / 2,997). **D.6.5:** the PVS² high word is non-zero above 1.28 in/s (retracted "reads 0000"), so the layout check now uses peak ≤ PVS ≤ √3·peak (34,502,955 / 34,502,955); Blastware's "Number of Intervals" is the monitoring time ÷ the interval. **§8:** where the 1995 default-clock events come from. 18 of 88 report fields now match on every DL2 event. |
| 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:** the file's copy of the block puts the pre-trigger where the 1A "stable anchor" `be 80 00 00 00 00` sits. In the file, though, it is each event's own pre-trigger, which varies on the same unit on the same day (253–256 samples at 1024 sps), and Blastware reports it per event. So the file says little about whether the live 1A loses its anchor, and #48 stays open. |
| 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*. |
@@ -3441,12 +3442,16 @@ The body is reconstructed from the raw A5 bulk waveform stream frames by strippi
The footer terminates the N00 file. Its bytes come directly from the terminator A5 frame's inner content — do NOT reconstruct from event metadata.
✅ **It is the file's last 26 bytes** (2026-11-03): `0e 08` and two valid times end every one of 70,041 DL2 files.
- ⚠ **Do not search for the first `0e 08` + plausible year.** 14 DL2 files also hold an earlier record of that shape, about 1.1 KB before the end, carrying the stop time followed by zeros.
- Taking it made a histogram start at its own stop (a day late on BE9558's daily histograms). It also cost a waveform its stop, and with it the trigger time.
| Offset | Length | Field | Notes |
|---|---|---|---|
| 0 | 2 | `0e 08` | Fixed marker |
| 2 | 8 | ts1 | Start timestamp (8B big-endian) |
| 10 | 8 | ts2 | Stop timestamp (8B big-endian) |
| 18 | 6 | `00 01 00 02 00 00` | Fixed |
| 18 | 6 | varies | ⚠ **Not fixed** (2026-11-03). `00 01 00 02 00 00` in M529LIY6.N00. Elsewhere: `00 21 04 00 00 00` (K558L9XP.FK0H, K439I2WY.RK0H, T1895KDW.6J0H), `00 01 02 00 00 00` (K5575KDW.5L0W), `00 01 00 01 00 00` (S3545KFL.S60W). Not identified |
| 24 | 2 | CRC | 2-byte CRC — algorithm unconfirmed |
**CRC:** The 2-byte CRC at footer[24:26] has an unconfirmed algorithm. In M529LIY6.N00 it reads `fe da`. Attempts to match CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), and 40+ polynomial/init combinations all failed. The writer copies it verbatim from the terminator frame.
@@ -3633,6 +3638,9 @@ copy in `~/dl2-archive`. Counts below are from that archive unless stated otherw
- 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.
- **It also picks the codec** (2026-11-03). Trying the waveform codec first handed it BE9440,
BE9557 and BE17354's 2018 5 s histograms. It accepted them and returned about 5× too many
"samples" (K440HDXX.XH0H: 44,504 for Blastware's 6,976).
#### D.6.2 Recording-setup block — sample rate, pre-trigger, record time ✅
@@ -3689,7 +3697,21 @@ Offsets are from `k`, the first byte of the setup name:
("Seis. Loc:", "Location:", "Project: ").
- An empty value means none.
- They match Blastware on every DL2 event.
- Not read yet: extended notes, job number.
- Not read yet: extended notes.
**Job number** ✅ 2026-11-02, in Series IV's `0x1A` layout (`[39]` report flags, `[40:42]` the
number):
| Offset | Type | Field |
|---|---|---|
| `k − 9` | uint8 | report flags: bit `0x02` = job number shown |
| `k − 8` | uint16 BE | job number, kept while not shown |
- **The flag** matches Blastware's `JobNumber` on 2,997 / 2,997 DL2 events that print one, and
66,986 / 66,986 that don't.
- **The value** matches on all 2,997, but every printed value is 1, so it is only proven for 1.
Hidden ones hold real numbers (802, 1012, 1013, 622).
- Bit `0x04` is also seen (2,311 files); it is not identified.
#### D.6.4 Geophone range — the setup's channel blocks ✅ 2026-11-01
@@ -3724,7 +3746,11 @@ Each interval stores its peak vector sum **squared**:
- **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.
event PVS matches on 69,989 / 70,042 events (`dev`, 2026-11-03).
- **A consistency check** (2026-11-03): an interval's vector sum is never below its largest
channel peak, nor above √3 times it, give or take one unit of rounding. That holds on
34,502,955 / 34,502,955 DL2 sub-minute intervals, and is what the codec now uses to recognise
a sub-minute record layout.
- 🔶 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).
@@ -3737,6 +3763,20 @@ Each interval stores its peak vector sum **squared**:
> ⚠ **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`.
>
> ⚠ **RETRACTED 2026-11-03:** "the high word reads `0000`" holds only on quiet intervals. It is
> non-zero above 1.28 in/s. The layout check required it, so a one-block histogram with a loud
> interval was not recognised at all (T193KR5M.X90H, K440HA3C.JM0H, R352HFZ7.530H). The check is
> now the consistency test above.
**Blastware's "Number of Intervals" is the monitoring time ÷ the interval** (measured
2026-11-03), from the footer's start and stop:
- It is exact on T193KSWP.FF0H (2,880), M462KSWR.1R0H (1,650) and T193KY0A.740H (6,390).
- When the unit never wrote the last minute, the file holds one block fewer (30 intervals at
2 s). Blastware's own interval table lists only the stored intervals, which is what SFM
decodes.
- A decode-checker carve-out (`interval-count-is-duration`) covers the 8 DL2 events where the
two differ.
#### D.6.6 Mic ✅ v0.33.0
@@ -3751,15 +3791,26 @@ Each interval stores its peak vector sum **squared**:
#### 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.
*Updated 2026-11-03. 18 of 88 report fields now match on every DL2 event.*
- **Fields not read yet:**
- trigger source and levels, stop mode, mic type, display units, firmware version, serial
number, calibration, battery
- per-interval frequencies (#50: they assume 1024 sps), per-interval PVS, interval size,
histogram stop time
- extended notes
- the values Blastware computes: ZC frequency, acceleration, displacement, time of peak
- sensor check results
- 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
- about 20 one-minute histograms with a mic peak an interval or two off
- Blastware prints `OORANGE` when the vector sum alone exceeds the range (a carve-out still to
prove)
- **Resolved on `dev`, 2026-11-02 → 03:**
- the 37 histograms that decoded wrongly (D.6.1, D.6.5)
- the 26 histogram start dates a day off (D.3.3; 17 of them were the same 5 s files, timed
as waveforms)
- the job number (D.6.3)
---