# Changelog All notable changes to seismo-relay are documented here. --- ## Unreleased ### Added - **ZC frequency, peak displacement and times of peak come from the unit's own event summary** (group D, part 2 of the file-only decode; `feat/waveform-zc-displacement`, merged 2026-11-06). Measured on DL2 2026-11-05. - **Where they are:** every event file carries the unit's per-channel summary right after its embedded event record. It is a chain of `[length][id][payload]` records, ids `0x32`–`0x35`, each holding min, max, peak sample, half-period and a displacement integral (reference D.6.12). Blastware prints these values as they are. - **ZC frequency** = (rate / 2) / half-period, on every record type. It matches 25,966 / 25,966 waveform and 253,958 / 253,958 histogram channel values, including the words (">100", "N/A", "<1.0"). Above range the value is Blastware's threshold, flagged, as when it comes from a report. - **Peak displacement** = half the integral (new `PeakValues.*_peak_disp_in`): 19,479 / 19,479. - **Times of peak and the vector-sum time** now come from the unit's peak samples. They differ from the samples' own only on O117I1NK.R70W, whose stored samples wrap at the trigger. Blastware's own sample table has the same wrapped values. - **Why recomputing failed:** from the samples, ZC frequency had matched 46% and displacement 84%. The unit computes them at full resolution. - **Peak acceleration** stays Blastware's own computation from the samples. The unit stores its own largest step too (`[15:21]`, inferred), and Blastware ignores it. - **Decode checker:** 59 of 88 fields now match on every DL2 event, 47 before group D (run `20261105-140021`, 0 regressions). Still open: O117I1NK's three accelerations and S353I5PZ.EP0W's Vert acceleration. - ⚠ **Operational:** codec change. - The next release bumps `TOOL_VERSION`, then runs `backfill_sidecars.py` and `backfill_event_shape.py`: about 8 h on the NAS (v0.34.0's took 13:13 → 21:16 on 2026-11-05). - No schema change, no migration, and no stored time moves. - **Report-less events gain a ZC frequency** in the existing `*_zc_freq` / `*_zc_above_range` columns, so Terra-View shows a frequency where it showed "—". - Report-paired events keep the report's values, which are equal. A report's "<1.0" still overlays as no value until the overlay is retired. - Displacement and times of peak are not stored in the DB or `.h5` yet. - **Sensor check results come from the unit's own records** (group E of the file-only decode; `feat/sensor-check-results`, merged 2026-11-07). Measured on DL2 2026-11-06. - **Where they are:** the header of each sensor-check record (`0x3c` Tran .. `0x3f` MicL), whose traces `minimateplus/sensor_check.py` already decoded (reference D.6.13). - **What it holds:** channel type, status, frequency × 10, ratio × 10 and amplitude in mV. - **Blastware prints them as they are:** - 209,943 / 209,943 geophone frequencies and ratios - 69,975 / 69,975 mic frequencies and amplitudes - the result: "Passed" at status 0, "Check" at any other, "Disabled" when the check is off - **"Check" is the unit's own verdict.** K559L6N1's Tran is a Check at 8.1 Hz and 3.3, inside every passing range. SFM keeps the status code; its bits are not decoded. - New `Event.sensor_check_results`: channel → `SensorCheckResult`, with `result`, `status`, `freq_hz`, `ratio` and `amplitude_mv`. - **The tail of every event file is one record chain:** event record → unit's summary → sensor checks → footer. It ends exactly at the file's end on all 70,041 DL2 files. - SFM now reads none of it unless it does. - An unknown id inside an intact chain leaves only that record unread. Before, it left everything after it unread too. - **Decode checker:** 71 of 88 fields now match on every DL2 event, 59 before (run `20261106-125854`, 0 regressions). All 12 sensor-check fields match on every event that has them. - ⚠ **Operational:** codec change. - Rides the next release's `TOOL_VERSION` bump and backfill with group D part 2. - No schema change and no migration. - The results are on the decoded event only. They are not stored in the DB, sidecar or `.h5` yet. Report-paired events keep the report's values in the sidecar. - **The Monitor Log line comes from the file's footer** (group F; `feat/monitor-log`, merged 2026-11-09). Measured on DL2 2026-11-08. - Blastware prints one line per event: the footer's start and stop, then words for the footer's flag word `[18:20]` (reference D.6.14). - The words: Event Recorded, then how the session ended — Keyboard, Remote or Modem Exit, Timer Stop, Selfcheck Passed, Battery Low or Memory Full Exit. - Rebuilt that way it equals Blastware's line character for character on 69,983 / 69,983 DL2 lines. - One line sets two session-end bits and prints the higher, so the order of the others is inferred. - Footer `[20:22]` is the trigger source again. `[24:26]` is still unknown. - New `Event.monitor_log`: `MonitorLogLine(start, stop, flags, description)`. It is read only when the record chain is whole, which proves the footer. - **Decode checker:** 72 of 88 fields now match on every DL2 event, 71 before (run `20261108-034313`, 0 regressions). - ⚠ **Operational:** codec change. It rides the next release's `TOOL_VERSION` bump and backfill. No schema change. The line is on the decoded event only: not stored in the DB, sidecar or `.h5` yet. - **Over range from the unit's own peaks: Blastware's `OORANGE`** (`feat/decode-last-fields`, merged 2026-11-11; measured on DL2 2026-11-09; reference D.6.15). - **The rule:** a peak past full scale, 2,000 units (32,000 counts on either geophone range; the mic in counts), is `OORANGE`. It holds per channel and per histogram interval, from the unit's summary peaks, which stay true where the stored samples clip or wrap. - **The vector sum** is `OORANGE` exactly when a geophone is over: 43 / 43, and never on its own (38 / 38 numeric, up to 14.49 in/s). That retracts the open "vector sum alone" carve-out. - **The report's "Out of Range" line** marks the mic over: 18 / 18. - New `PeakValues.tran/vert/long/mic/pvs_over_range`, and `event_file_io.over_full_scale()`. - **Checker:** it matches `OORANGE` only by the flag, and a flag against a printed number is a mismatch. The `saturation` carve-out now accepts no DL2 event; it stays for a file without the unit's summary. - **The checker reads each mic value in the unit Blastware printed.** - The peak is read in its own ``, and a sample table by its cells (a dB value is never under 60, psi never over 1). Blastware's event `Units` line does not hold for the mic on every report. - New carve-out `mic-units-mixed`, with evidence: a report that mixes dB and psi in one mic column, or prints one unit in both mic columns of a histogram row, is accepted when every differing cell is SFM's own value in the other unit. 40 DL2 fields; a cell matching neither stays a mismatch. - **Decode checker:** **80 of 88 fields now match on every DL2 event**, 72 before (run `20261109-144544`, 0 regressions). What is left is 16 values in two causes, left as they are by decision (Brian, 2026-11-11): - the vector sum's last digit on 4 waveform/histogram twins: Blastware's is about 1.5 ppm lower, cause unknown, and no fitted factor is applied; - 4 accelerations: O117I1NK ×3 and S353I5PZ Vert. - ⚠ **Operational:** codec change. - It rides the next release's `TOOL_VERSION` bump and backfill. - No schema change. - The over-range flags are on the decoded event only: not stored in the DB, sidecar or `.h5` yet. ### Fixed - **The mic's own range: a range-1 mic reads an eighth.** - The mic's channel block has a range byte at the geophones' offset (label + 29). At `1` each count is 0.25 / 8 Pa. - It is set on 7 DL2 events, and SFM read their mic 8× high, e.g. K557J1XQ.GF0W: 79.4 dB(L), not 97.5. - It is independent of the geophone range. - New `Event.mic_range`. - ⚠ **Operational:** after the next release's backfill those events' DB `mic_ppv`, and their `.h5` mic samples, drop 8×. Report-paired events keep the report's value. - **The mic dB offset is 81.938216**, not 81.9384. - Every count Blastware printed in DL2 (1,704 in sample tables, 520 in histogram intervals, 494 histogram peaks) leaves [81.9382058, 81.9382266]. - It fixes mic values one digit off at a rounding edge (count 463: 135.2, not 135.3). - Operational: dB is not stored. SFM's own reports change in the last digit at most. - **The test suite runs green, with 0 failures.** The 16 long-standing "known failures" were two stale tests: - 15 ASCII-report tests read from a removed `decode-re/` folder; - 1 expected 0.0 where the decoder deliberately leaves peaks unknown. A report-pairing test that the same stale path had been skipping now runs. - **A unit without a mic keeps its sensor-check traces.** The trace decoder required all four records `0x3c`–`0x3f`, so BE16352 (no `0x3f`) had none in its `.h5`: all 8 of its DL2 events. Its three geophone traces are now decoded. - ⚠ Operational: they appear after the next release's backfill. - **The decode checker reads the mic's above-range ZC flag under its real name** (`mic_zc_above_range`). A mic ">100" could never match before. ### Protocol / Documentation - **Reference D.6.12 (new):** - the unit's event summary: its layout, and what Blastware prints from it - why recomputing failed - the two odd 2019 files - group D part 1 (time of peak, acceleration with the fitted g), documented there too - **Reference §7.8.9:** its "constant, meaning ❓" bytes amended in place. They are the vector-sum peak's sample, then the next record's lead. - **Reference D.6.11 and CLAUDE.md:** the 59 / 88 status. Leads for E: records `0x3c` / `0x3d`, probably the sensor check. Leads for F: a waveform's monitor log may be its event record's start and stop. - **Reference D.2 and D.4.2, corrected in place:** an `.MLG` stores its dates little-endian, and its record flags are the event footer's flag word and trigger source, little-endian. Measured on the 4 bench `.MLG` files; a BE9441 session lines up 20 / 20 with its event files. `write_mlg()` writes dates big-endian; nothing calls it. - **Reference D.6.14 (new):** the monitor log. **D.3.3:** footer `[18:24]` identified: flags, trigger source and zero. - **Reference D.6.13 (new):** - the record chain to the footer - the sensor-check header and what Blastware prints from it - **Reference D.3.3:** the footer is the chain's last record (`00 1a`, id `0e`). - **Reference D.6.12:** its "`0x3c` / `0x3d`, before and after" retracted in place. It is one record per channel. - **Reference D.6.15 (new):** over range. - **Reference D.6.6, corrected in place:** the mic's range byte; the dB offset (the old window was too high); Blastware's mic unit labels and the mixed columns. - **Reference D.3.3:** the footer's last two bytes are a CRC-16/AUG-CCITT (init `0x1D0F`), big-endian, over the footer record from its length prefix `00 1a` through footer `[0:22]`. It holds on 70,041 / 70,041 DL2 files. Found by the `.MLG` session; it retracts 2026-11-08's "no common CRC-16 fits". - **Reference D.6.11 and CLAUDE.md:** the 80 / 88 status, and the two causes left by decision. - **Reference D.6, "Reading a mismatch":** 256, 4,096 and 65,536 mean a number outgrew its 8-, 12- or 16-bit box. Every case so far is listed (Brian's observation, 2026-11-05). ## v0.34.0 — 2026-11-04 **SFM reaches Series-4 parity, and reads most of Blastware's report from the event file alone.** Two lines of work ship together. **Series-4 parity** (`feat/series4-sfm-parity`). One device door, by serial, for both series. Each change is audited, identity-checked, sent once and read back. Benched on BE9441 and UM20147. - reads and downloads - start / stop monitoring - call-home on / off - settings changes (preview → send → read back) It also fixes MiniMate request framing (#46) and the 5A walk across a 64 KB page. **The file-only decode, groups A–D.** 47 of Blastware's 88 report fields now match on every DL2 event, about 6 before v0.33.0. Eight more match on all but one or two of 6,524 waveforms. - **Fixed:** - Sensitive-range events no longer read 8× high - histograms the waveform codec had claimed, and short histograms with a loud interval, now decode - histograms are no longer a day late - every histogram's start and stop are Blastware's own (#51), not a second early - interval frequencies follow the sample rate (#50) - **New from the file:** - the job number - the unit's serial, version, calibration date and battery - the trigger source and levels - each interval's frequencies, vector sum and time - the peak dates and times - a waveform's time of peak and peak acceleration - **Events are identified by unit + time + type:** a waveform and its histogram may share a second. Prod still overlays a paired ASCII report onto the decode. That overlay is the plan's step 3 and is not part of this release. ⚠ **This release migrates the events table and owes a backfill that moves every Series-3 histogram's stored time by one second.** See *Migration*. ### Fixed - ✅ **MiniMate requests and config writes are framed as Blastware frames them (#46; `feat/series4-sfm-parity`).** - Every request escapes 02 / 03 / 04 / 10. - A config write is an ordinary escaped request carrying a whole block (as read, plus two bytes). All four blocks are checked before the first frame. - SFM's frames equal Blastware's in the 2026-04-20 and 2026-10-26 captures. Benched on BE9441 2026-11-04. - ✅ **The 5A walk crosses a unit's 64 KB page.** The walk is 32-bit linear (the CLAUDE.md "KNOWN BUG"); BE9441's page-crossing events rebuild Blastware's own files byte for byte. - A one-event download is whole or an error. - A non-first event's stream has no metadata pages. - **A MiniMate settings read is assembled as content** (measured at the bench 2026-11-04). - Unescape each 1A frame and drop the one non-content byte that starts every frame but the last: 2,090 bytes headed by N = 2090. - The read takes exactly the length it asked for. When a reply's checksum byte is itself escaped (about 1 frame in 85), the parser leaves its 0x10 in the data. It hit the first live read; the recordings never had it. The waveform-data read now trims it too. - **A live download is held to its record type (#51):** a same-second waveform / histogram twin is no longer skipped as "already stored". An untyped row at that second still counts as stored. - Smaller wire fixes from the parity benches: - SUB 0x15's serial is cut at its first NUL. - 0x1C reads a histogram run as monitoring. - A MiniMate that boots on connect is waited for. - A start's read-back waits out the sensor check and wakes the unit. - A built call-home image is framed once. - ✅ **#51: events are identified by unit + time + type, and histograms take Blastware's times.** - **The new key.** The events table was `UNIQUE(serial, timestamp)`, one event per unit per second. A waveform and its histogram share a second legitimately: 209 times in prod's 2026-09-30 store. The key is now `UNIQUE(serial, timestamp, record_type)` (agreed with Brian 2026-11-03). - **Migration 3** rebuilds the table from its own definition with only the key swapped, in one transaction. Every column, row and id is kept, and the indexes are recreated. - **Lookups:** the upsert, the estimate guard and the restamp match on type. The restamp also re-types a file's own row in place. An untyped event still dedups against an untyped row. - **Histogram times.** A histogram's start and stop now come from its own event record (lead `00 28 05 00`, source `04 00`, marker `fe f5`). That is Blastware's Histogram Start and Stop on 63,490 / 63,490 DL2 histograms; the footer's start was a second early on 97%. Without a validated record, the footer stands and the decoder logs a decode problem. - **Interval times and peak times follow:** - each interval's printed time is its end, start + (i + 1) × interval, capped at the stop (2,308,524 / 2,308,524 rows; `interval_times`) - each peak's date and time is its interval's - **Decode checker:** 760,410 comparisons fixed, 0 regressions, **47 of 88** fields fully match (was 34). Histogram start and stop times, interval times and the ten peak date/time fields match every DL2 histogram. - **Rehearsed on a copy of prod's 2026-09-30 snapshot (15,432 events):** - The migration kept every row identical, rebuilt the indexes and passed the integrity check, in 0.27 s. - `backfill_sidecars.py`: 11,944 files, 0 errors. 9,852 Series-3 histograms moved +1 s in place, with no id lost and review state untouched. The 209 same-second pairs coexist, and 0 collisions were refused. (It also created 341 rows for store files that never had one: the known one-time behaviour, not duplicates.) - `backfill_event_shape.py`: exit 0, `cleared_stale` 0. - ⚠ **Schema migration + codec change.** SFM migrates the events table by itself on first start: back up `seismo_relay.db` first. The release backfill (`backfill_sidecars.py` then `backfill_event_shape.py`) moves every Series-3 histogram's stored time by one second, in place. - Terra-View pairs twins by peak values and reads rows by id: no change needed there. - Note for Terra-View's changelog: Series-3 histograms move forward one second, so an event can cross a deployment-window edge. - Three tests that pinned the old footer start now pin the record's. The estimate-guard test's neighbour is now the same type. - **A Blastware file's geophone range comes from its setup, so Sensitive events no longer read 8× high.** - **Where it is:** in the setup's channel blocks, the byte 29 after each geophone label. `0x00` is Normal (10 in/s full scale), `0x01` is Sensitive (1.25 in/s). SFM's live 1A read has the same byte at label+33. - **Measured:** it matches Blastware's GeoRange on 70,042 / 70,042 DL2 events, all three channels agreeing on every one (35 Sensitive). - **Before:** SFM assumed Normal, so every Sensitive event's peaks, vector sum and `.h5` samples read 8× high. - **`Event.geo_range`** is new: 0 or 1, or None when it isn't read (the channels disagree, an unknown value, or a missing block). None comes with a `decode_problems` entry, and peaks then assume Normal as before. - **`decode_blastware_bytes`** scales peaks and the histogram vector sum by the range. - **`event_hdf5.write_event_hdf5`:** `geo_range` now defaults to None, meaning the event's own range, else Normal. An explicit argument still wins. - **`waveform_store.save_imported_bw` and `scripts/backfill_sidecars.py`** no longer force `"normal"`. The `waveform_store` line was agreed with the parity session, which owns that file. - **Decode checker:** GeoRange 70,042 / 70,042, and geophone samples exact on **6,524 / 6,524** waveforms (was 6,491). PPV mismatches about halved, and 10 of 88 fields fully match (was 6). 70,287 comparisons fixed, 0 regressions. - ⚠ **Codec change: bump `TOOL_VERSION` at the next release.** The backfill (`backfill_sidecars.py` then `backfill_event_shape.py`) rewrites stored Sensitive events' peaks and `.h5` files. No schema change. - **Histograms go to the histogram codec, and a loud interval no longer hides a short one.** These were the histograms the decode checker found decoding wrongly. - **The codec now follows the record type.** The file decoder used to try the waveform codec first, whatever `STRT[18]` said. That codec accepted BE9440, BE9557 and BE17354's 2018 5 s histograms and returned about 5× too many "samples" (K440HDXX.XH0H: 44,504 against Blastware's 6,976). Only an unknown type still falls back to trying both, and a chosen codec that fails is now a decode problem rather than a silent switch. - **A loud interval no longer breaks the sub-minute layout check.** The check required each record's "zero word" to be `0000`. That word is the high word of the interval's PVS², which is non-zero above 1.28 in/s, so a one-block histogram with a loud interval decoded to nothing (T193KR5M.X90H, K440HA3C.JM0H, R352HFZ7.530H). - The check is now the measured relation peak ≤ PVS ≤ √3·peak. It holds on 34,502,955 / 34,502,955 DL2 sub-minute intervals. - The trim for a stream with no terminal tail uses the same test. - **New decode-checker carve-out, `interval-count-is-duration`.** Blastware's "Number of Intervals" is (stop − start) / interval. When the unit never wrote the last minute, Blastware's own interval table lists one block fewer, and SFM matches the table. It covers 8 events. - **Decode checker:** 462 comparisons fixed, 0 regressions, 16 of 88 fields fully match (was 11). - Every DL2 histogram's Tran / Vert / Long interval peaks now match Blastware (bar the clipped intervals the saturation carve-out covers). - Channels 70,042 / 70,042. - Histogram start dates a day off: 26 → 9. - Peak vector sum mismatches: 45 → 18. - ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and backfill (`backfill_sidecars.py` then `backfill_event_shape.py`). Those files are stored wrongly on prod today, and the backfill rewrites them. No schema change. - **A Blastware file's footer is its last 26 bytes: no more day-late histograms.** - **Measured:** every DL2 file ends in a valid footer (`0e 08` and two valid times), 70,041 / 70,041. - **The bug:** the decoder took the first "`0e 08` + plausible year". On 14 files there is an earlier record, about 1.1 KB before the end, holding the stop time followed by zeros. - A histogram then started at its own stop: a day late on BE9558's daily histograms (K558L9XP.FK0H read 2025-10-08 19:10:01 for Blastware's 2025-10-07 19:14:08). - T003LCYV.JD0H got no time at all. - A waveform lost its stop, so its trigger was never computed and the stop was stamped instead (K440I4LG.JK0W: 11:14:12 for 11:14:08). - **The fix:** the last 26 bytes are now taken when they are a footer, and the old search remains only as the fallback. - **Decode checker:** event times 6,524 / 6,524 and histogram start dates 63,518 / 63,518. 13 comparisons fixed, 0 regressions, 18 of 88 fields fully match (was 16). - **Also:** the protocol reference records where the 1995 default-clock events come from (units back from calibration with the battery unplugged; 17 in DL2). - ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and backfill. It moves the stored time of those ~14 events on prod. No schema change. ### Added - **Series-4 parity in SFM: everything by serial, for both series** (`feat/series4-sfm-parity`, merged 2026-11-04; spec `docs/superpowers/specs/2026-10-20-sfm-series4-parity-design.md`). - **One door, `DeviceAccess`.** - A unit is addressed by its serial: UM is Series 4, BE / BA is Series 3. The unit's own answer is checked before anything is sent. - A Micromate's line is held between requests and released when idle or on RADIO RING. - One connection per unit; 423 while busy. - **Reads, both series:** `GET /device/info`, `/device/monitor/status`, `/device/settings`, `/device/events` and `POST /device/events/download`. - A download is stored as the watcher stores it, through the Blastware / IDF import path, typed. - It never overwrites a stored event. - SFM's MiniMate files carry Blastware's W/H type letter. - **Changes, both series, each audited** (a `device_commands` row per attempt), identity-checked, sent once, never retried, read back: - start / stop monitoring; - call-home on / off: `GET /device/call_home/state`, `POST /device/call_home/{enable,disable}`; - **settings**, `POST /device/settings/change`. - **Settings, in detail:** - A preview (dry run) shows old → new and returns a revision; a live change must carry it, covering the unit's block and the changes asked for. - Fields: record mode, sample rate, histogram interval, record time, geophone trigger, the four notes, job number and its report flag, and (MiniMate) range and alarm. - Limits are the units' own, from Instantel's manuals, checked on the block that would result. - Refused before anything is sent: a monitoring unit, a stale preview, a Micromate on its factory setup, or one whose schedule would load another setup. SFM reads `schedule.dat`, read-only. - **One settings codec for both series** (`micromate/setup_fields.py`): a MiniMate's settings block is Series IV's `0x1A` layout. All 11 Blastware compliance writes reproduce from the block before them. - **The page:** - units by serial, with the series badge from the unit's own answer; - the events list and download, start / stop, the Call Home tab; - the Config tab's Preview → Send → "the unit now holds"; - page JavaScript in `sfm/static/`, tested through Node (no inline JS). - **Benched on BE9441 and UM20147:** phase 4 on 2026-11-03, phase 5 on 2026-11-04. Every change was acknowledged, read back and confirmed on the unit's screen; both units were restored byte for byte. - ⚠ A MiniMate's open setup menu loses a remote change when the operator presses Cancel or Save (the menu writes its whole-block copy back). The preview warns. - ⚠ The Micromate scheduler switch is in no block SFM reads, so a leftover schedule blocks a change even with the scheduler Off. - ⚠ **Operational:** additive schema only. SFM creates `device_commands`, or adds `sent` / `states` to an older one, on first start; this branch does not touch `events`. No `TOOL_VERSION` bump and no backfill from this branch: event decoding is unchanged. Production ingest (the watchers) is untouched; the new device routes are used only from SFM's page and API. - **A waveform's time of peak, vector-sum time and peak acceleration** (group D, part 1 of the file-only decode). Measured on DL2 2026-11-04. - **Time of peak** = (first peak sample − pre-trigger samples) / sample rate, per channel including the mic. - **The vector sum's time**: the same, on √(T² + V² + L²). - **Peak acceleration** = the largest |v[i+1] − v[i]| × sample rate / g, which the manuals describe as "subtracts two velocity readings and divides the result by the elapsed time between them". - Blastware's g is fitted: every printed acceleration in DL2 bounds it, and together they leave [386.2236, 386.2240] in/s². - That is 9.81 m/s² (386.2205) plus an offset not explained, as with the mic's fitted dB offset. The standard 9.80665 m/s² fits 17,806 of 19,479 values; the fitted value fits 19,475. - **`PeakValues` gains** `*_time_of_peak`, `pvs_time` and `*_peak_accel_g`, filled for waveforms only. - **Decode checker:** 52,177 comparisons fixed, 0 regressions. Times of peak are 6,523 / 6,524 on every channel, peak acceleration 6,522–6,523 / 6,524. Every miss is in two 2019 files (O117I1NK.R70W on all channels, S353I5PZ on Vert), not yet explained. - **Not shipped yet:** peak displacement and ZC frequency. They follow the manuals' methods (half the largest half-cycle integral; the half-cycle at the peak), but match only 84% and 46%, so Blastware does something more. - ⚠ **Codec change:** it rides this release's `TOOL_VERSION` bump and backfill. No schema change; the new values are not stored in the DB or the `.h5` yet. - **A histogram's interval detail: frequencies, vector sums, interval size and stop** (group B of the file-only decode). Measured on DL2 2026-11-03. - **Frequency** = (sample rate / 2) / half-period: 527,915 / 527,915 cells at 1024 sps and 1,725 / 1,725 at 2048. - ✅ **Fixes #50.** `half_period_to_hz` used a fixed 512 and halved every 2048-sps frequency. It now takes the rate (default 1024). - Blastware prints "N/A" for a half-period of 0, ">100" (">200" at 2048) at 5 samples or fewer, and "<1.0" below 1 Hz. - **Each interval's vector sum**, √PVS² at the event's range. - **Interval size:** uint16 seconds at `k − 40` (Series IV `[8:10]`). - **Stop time:** the footer's. - **`Event` gains** `histogram_interval_sec`, `interval_half_periods`, `interval_pvs` and `stop_time`. - **The `.h5` gains** `/intervals/half_period/` and `/intervals/pvs_ips`, plus a `histogram_interval_sec` attribute. - **Decoder:** a histogram is now walked once (`histogram_codec.channels_from_records`). - **Decode checker:** 508,080 comparisons fixed, 0 regressions, 34 of 88 fields fully match (was 28). - Frequencies on all four channels, interval size and stop date match every DL2 histogram. - Interval vector sum: 63,497 match, plus 17 clipped intervals now under the saturation carve-out. Blastware prints OORANGE when the sum exceeds the range in an interval where it clamped a channel (17 / 17). - 4 cells sit 4e-6 past a rounding boundary and stay mismatches. - 58 stop times are Blastware a second earlier, part of #51. - ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and backfill. The `.h5` additions are additive. No schema change. - **A Blastware file's identity, battery and trigger settings** (group A of the file-only decode). Every field is matched against every DL2 report (2026-11-03). - **Identity block** before the setup name: what the live read gets from SUB FE. - serial `k − 202`, firmware `k − 147`, DSP version `k − 138`, firmware minor `k − 193` - calibration date `k − 132` and "by" `k − 128` - manufacturer `k − 94`, model `k − 72` - Filled into `Event.device_info`; `DeviceInfo` gains `calibration_date` / `calibrated_by`. - Serial, Version and Calibration match 70,042 / 70,042. - **Battery:** uint16 hundredths of a volt at `k − 190` (`Event.battery_volts`), 70,042 / 70,042. Blastware rounds half up (6.25 → "6.3 Volts"). - **Trigger source:** the two bytes between the embedded event record's lead and `fe 80`, a bitmask (`0x01` Tran, `0x02` Vert, `0x04` Long, `0x08` MicL, `0x200` Manual). 6,524 / 6,524 (`Event.triggered_by`). - **Trigger settings,** in Series IV's `0x1A` layout: - the sources bitmask at `k − 19` - the stop mode at `k − 31` (0 = Fixed) - each channel's float32 level at label + 30 (geo in/s, mic psi) - the mic type code at MicL + 4 (2 = Linear Weighting) Blastware prints a level when its channel is a trigger source and the event wasn't Manual. Geo level 6,484 / 6,484, mic level 4,412 / 4,412 (its dB uses 6895 Pa/psi). - **`.h5`:** all of them as attributes (additive). - **Decode checker:** 444,188 comparisons fixed, 0 regressions, 28 of 88 fields fully match (was 18). - A mic level is now compared in the unit it is printed in: K441LA17.IN0W prints dB under psi Units. - New carve-out `units-is-a-display-preference` (3,532 events). dB or psi in a Blastware report is that PC's Blastware preference when it wrote the report (Blastware manual §4, Preferences → Units and Channel), not the unit's Microphone Units setting (MiniMate Plus manual §3.9.7). DL2's reports switch fleet-wide in 61 clean runs by write time, and no byte of the file separates them. - Single-value fields are proven for that value only: Version `10.72-8.17`, stop mode Fixed, mic type Linear. - ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and backfill. No schema change. - **A Blastware file's job number, and whether Blastware shows it.** - **Where it is:** the setup block has Series IV's `0x1A` layout here too. The report flags sit at 9 bytes before the setup name, with bit `0x02` meaning the job number is shown. The number is a uint16 BE at 8 bytes before the name, and it is kept while switched off. - **Measured:** the flag matches Blastware's JobNumber on 2,997 / 2,997 DL2 events that print one, and 66,986 / 66,986 that don't. - Every printed value is 1, so the value is only proven for 1. - Hidden ones hold real numbers (802, 1012, 1013, 622). - **`ProjectInfo.job_number_enabled` / `job_number`**, named as in `micromate.setup_block`. - **`write_event_hdf5`** stores both as `.h5` attributes when they were read. - **Decode checker:** JobNumber 2,997 / 2,997, and 11 of 88 fields fully match (was 10). 0 regressions. A job number only SFM shows now counts as a mismatch. - **Not in the database, the API or the PDF report yet.** That needs a column. - ⚠ **Codec change:** it rides the next release's `TOOL_VERSION` bump and backfill (`backfill_sidecars.py` then `backfill_event_shape.py`). The new `.h5` attributes are additive. No schema change, no migration. ### Removed - **`POST /device/config` and `POST /device/config/project` answer 410**, pointing at `POST /device/settings/change`. Terra-View does not call them. Removed with them, because they wrote a live unit through the encoder #46 found wrong: - `MiniMateClient.apply_config`, `set_project_info` and `_encode_compliance_config`; - `poc_set_project.py`, and `experiments.py`'s EXP6. ### Protocol / Documentation - **The parity benches in both protocol references:** - Series III: the settings write measured end to end, the escaped-checksum stray byte, the keypad menu writing its whole-block copy back, the alarm at channel +38, and `[26:28]` re-set while monitoring. - Series IV: the first setup push, with the unit's CRC equal to SFM's; the schedule read on a real unit; the scheduler switch in none of the blocks. - Spec and plan: `docs/superpowers/specs/2026-11-03-sfm-phase5-settings-design.md`, `docs/superpowers/plans/2026-11-03-sfm-phase5-settings.md`. - **Histogram timing in the protocol reference (D.6.10):** - the histogram's own event record - the interval-time and peak-time rules - "histograms stay on ts1" retracted in place - CLAUDE.md records the unit + time + type key - Docs only. - **Group B in the protocol reference (D.6.9):** - interval size, the stop, and per-interval frequency, with Blastware's words (`N/A`, `>100` / `>200`, `<1.0`) - each interval's vector sum, with its OORANGE rule - #50's fixed-512 formula is retracted in place - CLAUDE.md and the README roadmap follow - Docs only. - **Group A in the protocol reference, and the three meanings of mic "units".** - **D.6.8:** the identity block, the trigger-source bitmask and the trigger settings. - **D.6.6:** recorded data vs report units vs unit peaks, with the MiniMate Plus and Blastware manual sections. CLAUDE.md carries the same glossary. - 🔶 Inferred: the histogram "terminal tail" `9c 06 00 42` is `9c 06 00` plus the serial's `B`. - Docs only: no code change, no migration. - **Where file-only decoding stands, and that prod's ASCII overlay is scaffolding.** - **CLAUDE.md "Where things stand"** now says plainly that a paired Blastware ASCII report overwrites SFM's decode on import, and that only report-less events run on the decoder alone. The overlay is to be retired at step 3 of the plan. - The checker status is brought up to `dev`: 18 of 88 fields match on every DL2 event, with the remaining groups A–F in the proposed order. The README roadmap is updated to match. - **The protocol reference** records: - the footer as the file's last 26 bytes (D.3.3, with `[18:24]` retracted as "fixed") - the codec chosen by STRT[18] - the job number - the PVS² high word and the peak / PVS consistency check (retracting "reads 0000") - Blastware's interval count - a refreshed "not read yet" list - Docs only: no code change, no migration. - **`docs/instantel_protocol_reference.md` gains Appendix D.6:** the bytes and DL2 verification for every field SFM reads from a Blastware event file. - the record type, `STRT[18]` - the recording-setup block: sample rate, pre-trigger, record time and the four notes - the geophone range - each histogram interval's PVS² - the mic scale - **Retracted in place:** - `STRT[20]` as the record time: it is `00` on every DL2 file. - The 2026-08-26 reading of sub-minute histogram records as little-endian: they are big-endian from byte 5 (#47/#49), and the "2-word tail" is the PVS². This is corrected in CLAUDE.md too. - **#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 unit's setting: it varies on the same unit on the same day, and Blastware reports it per event. So the files say little about whether the live 1A read loses its anchor. (Corrected the same day; the first version read the file's value as the setting.) - **CLAUDE.md "Where things stand"** now reflects the range fix. - Docs only: no code change, no migration. ### Migration ⚠ **Schema migration and backfill.** Rehearsed twice on a copy of prod's 2026-09-30 snapshot (15,432 events), before and after the parity merge, with identical results. **Before you start:** - `TOOL_VERSION` is bumped to **0.34.0**, which gates the regeneration, so no `--force` is needed. - **Back up `seismo_relay.db` first.** **Then:** 1. **Deploy.** On first start SFM migrates the database by itself. - The events table is re-keyed `UNIQUE(serial, timestamp, record_type)` (Migration 3): every row and id is kept and the indexes are rebuilt. Rehearsal: 0.27 s, every row identical, integrity ok. - `device_commands` is created. 2. **In the `sfm` container, `python scripts/backfill_sidecars.py`** re-decodes every event file. ⚠ **Plan an overnight run:** the store holds about 64,000 events after the 2200-day watcher forward, at about 1.5 files/s on the NAS, so roughly 12 hours. - **Every Series-3 histogram's time moves forward one second, in place**, with id and review state kept. Rehearsal: 9,852 moved, 0 refused, no id lost. - **The same-second waveform/histogram pairs coexist** (209 in the snapshot). - It also creates a row for any store file that never had one (341 in the snapshot): the known one-time behaviour, not duplicates. - **Report-less events** pick up every new field. **Report-paired events** keep the report's overlaid peaks, notes, sample rate and record time. 3. **`python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db --store-root bridges/captures/waveforms`** recomputes shape and offset metrics. Rehearsal: exit 0, `cleared_stale` 0. **Terra-View** needs no change: it pairs twins by peak values and reads rows by id. Moving a histogram forward one second can carry an event across a deployment-window edge. **Series-4** event times do not move. ## v0.33.0 — 2026-11-01 **SFM reads Series-3 events from the file alone, and proves it against Blastware.** **What was broken.** A Blastware event that reached SFM without its ASCII report used to come in half-decoded: - no sample rate - a "70 s" record time, which was really the record-type byte - blank notes - every histogram typed as a waveform - a histogram vector sum built from channel peaks taken at different moments - a mic reading about 95× low in psi That matters more now: every DL2 event from before 2025 arrives with no report, and SFM's own download and call-in paths never have one. **What this release does.** It reads all of those from the event file itself, and adds the decode checker that proves it. The checker compares SFM's file-only decode, field by field and sample by sample, with Blastware's own `_XML.XML` event reports for the 70,042 DL2 events that have one (2016–2026). **Where that stands now:** - sample rate, record time, pre-trigger, notes and event type match on every event - geophone samples are exact on 6,491 / 6,524 waveforms (the 33 others are on the 1.250 in/s range, which SFM cannot read from the file yet) - the histogram vector sum matches on 69,919 - the mic matches on all but a few dozen Events imported with an ASCII report are unchanged on prod; the report still overlays. ⚠ **This release owes prod a backfill.** It does not move stored event times; see *Migration* below. ### Fixed - **The mic in psi was ~95× low: one MicL count is 0.25 Pa.** - SFM converted mic counts with a "~0.5 psi full-scale" guess (0.0125 / 32768 psi per count). The decoded count was always right: count 16 on `K441LTON.900` is Blastware's 106.0 dB. - Measured against 1,729,253 DL2 histogram intervals' "MicL Peak" columns: count × 0.25 Pa matches Blastware's psi(L) on every one. - `event_file_io._MIC_FS_PSI` is now `_MIC_PSI_PER_COUNT` = 0.25 / 6894.757 (3.626e-5 psi per count). - The event's mic peak comes right on events with no report, and so does the `.h5` mic trace (`event_hdf5` derives its scale from that peak). - **dB offset:** `waveform_codec.mic_count_to_db` now uses 81.9384, not 81.94. Blastware's dB sits in a measured window, [81.9383, 81.9385], a hair above the exact 81.93820. Any value in the window matches on 1,729,252 / 1,729,253 intervals. - The checker's first run of this fix flagged 280 regressions, every one count 129, which exact 0.25 Pa rounds to 124.1 against Blastware's 124.2. - The old 81.94 misses counts 119 and 132. - Decode checker, against the pre-fix baseline: 45,035 fixed, 0 regressions. | Field | Mismatches before | After | |---|---|---| | interval psi | 42,783 | 26 | | interval dB | 974 | 20 | | mic peak | 345 | 40 | | waveform mic samples | 1,056 | 37 | - ⚠ **Codec change, covered by the same release bump.** The backfill rewrites stored mic values on report-less events; report-paired events keep the report's. No schema change. - **A histogram's peak vector sum is now the one the unit stores.** SFM computed it from each channel's interval peak, and those can come from different moments. So on 86% of DL2's histograms with no report it read high: `T004JTRF.ME0H` gave 1.782 against Blastware's 1.358. - Every interval carries its peak vector sum SQUARED, a uint32 BE in 0.005 in/s units: - bytes [21:25] of a standard block, long documented as "constant `00 00`" plus "purpose unknown" - the last 4 bytes of a sub-minute record (the undecoded `meta_var`) - √stored × 0.005 is the "Geo PVS" Blastware prints. It matches on 1,668,073 / 1,668,074 standard and 34.5 million sub-minute DL2 intervals. - The event's value is the largest interval's. `histogram_codec.interval_pvs` returns the per-interval series, and records gain `pvs_sq`. Waveforms are unchanged. - Decode checker: `PeakVectorSum` matches on 69,919 events (was 15,097): 54,822 fixed, 0 regressions. The 80 left are three things: - the 35 Sensitive-range events (8×, SFM's Normal-range assumption) - 27 of the 5-second histograms that decode wrongly - about a dozen waveforms Blastware prints `OORANGE` for when the vector sum alone exceeds 10 in/s — a likely carve-out, still to be shown - The per-interval series is not stored yet, so the checker still scores `intervals.Geo PVS` as SFM blank. - ⚠ **Codec change, covered by the same release bump as #44/#45 and #41.** The backfill rewrites stored histogram PVS, but only where no ASCII report overlays it. Report-paired events keep the report's value. No schema change. - **A Blastware event's record type comes from its bytes, not its filename (#41).** - STRT[18] is the record-type byte: `0x46` on every one of DL2's 6,577 waveform files and `0x0A` on every one of its 63,535 histograms. - The decoder used to read the type from the filename's last letter. So an event with no Blastware name came out "Waveform" whatever it was: SFM's own downloads, the call-in path, and a manual download (`.QZ0`). - The filename is now only a cross-check that logs a disagreement. - An unknown byte gives `record_type` None and a `decode_problems` entry, not a guess. Manual, Event and Combo types never occur in DL2, so their bytes are unknown. - Decode checker: `EventType` matches on 70,042 / 70,042 events (was 6,524), 0 regressions. - ⚠ **Codec change, covered by the same release bump as #44/#45.** The backfill rewrites stored `record_type`. Files named `…W` / `…H` keep their type. A histogram stored from a 3-character manual-download name flips from Waveform to Histogram, which also changes how it pairs with its waveform twin. No schema change. - **A Blastware event imported without its ASCII report now carries its setup and notes (#44, #45).** Until now such an event stored no sample rate, a record time of "70 s" (the STRT record-type byte, 0x46), a pre-trigger and sample count read from STRT bytes that are neither, and blank project / client / operator / location (the reader stopped at the NUL after each label). All of DL2's 2016–2024 events arrive this way. - The recording-setup block is found by structure (`1c 08`, the setup name, NUL), not by the name "Standard Recording Setup", which 37% of DL2's files do not use. - Sample rate, pre-trigger and record time come from that block; a waveform's sample count is the decoded count. A histogram gets a sample rate only: Blastware reports no record time or pre-trigger for one. - The setup name and the four notes are read by position, as the ASCII parser does: their labels are operator-editable. - Verified against Blastware's own `_XML.XML` reports for the 70,042 DL2 events that have one (2016–2026): sample rate 70,042/70,042, record time 6,524/6,524, pre-trigger 6,484/6,484, notes 70,042/70,042, sample count 6,523/6,524. The one miss is the harness's, not the decoder's: `T438HGTZ.B30W`'s Tran, Vert and MicL end 3 samples before Long, in Blastware's own sample table too, and the harness compared Tran's length with the table's row count. - Events imported with an ASCII report are unchanged: the report still overlays. Not yet read: the job number (2,997 archive events carry one). The waveform-time estimate still finds the record time by the name, pending a measurement. The Micromate half of #44/#45 (SFM's own downloads, no report) stays with the parity branch. - ⚠ **Codec change: bump `TOOL_VERSION` at release** and run `backfill_sidecars.py` then `backfill_event_shape.py` on prod (~2 h on the NAS) so stored report-less events pick the fields up. No schema change, no migration. ### Added - **The Series 3 decode checker.** It proves SFM can produce everything Blastware reports from the event file alone, the first of four pieces toward retiring Blastware's reports. - `scratch/check_s3_decode.py ` decodes each event the way ingest does, from its bytes alone (no filename, no report). - It compares every field, waveform sample and histogram interval with Blastware's `_XML.XML` report of the same event. DL2's `Sent/` holds those reports, every sample included, for 70,042 events back to 2016; its ASCII reports start in 2025. - Each comparison gets one verdict: match, mismatch, SFM blank, accepted (a written carve-out with evidence), no reference, or error. - **Any disagreement counts as SFM's bug** unless a carve-out covers it. The only carve-out so far is saturation: Blastware clamps a clipped channel and prints `OORANGE`. - **Output** goes to `~/dl2-archive/checker-runs/