# 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. - **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 - **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. ### Protocol / Documentation - **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. ## 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/