# Changelog All notable changes to seismo-relay are documented here. --- ## Unreleased ### Fixed - **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. ## 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/