merge: histogram timing in the protocol reference (D.6.10), and the unit + time + type key

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-04 12:19:41 -05:00
commit 1f8494dbc4
3 files changed
+49 -13

No files matched your search

+16 -8
View File
@@ -45,16 +45,27 @@ 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**.
**Where the decoder stands on `dev`** (2026-11-03, run `20261103-180306`):
**34 of 88 fields match on every event**, up from about 6 before v0.33.0.
The six `dev` fixes below share one release and one backfill. Group B
(histogram interval detail, reference D.6.9) is done, which also fixed #50.
**Where the decoder stands on `dev`** (2026-11-03, run `20261103-213557`):
**47 of 88 fields match on every event**, up from about 6 before v0.33.0.
Everything below on `dev` shares one release and one backfill. Groups A, B
and C are done, which also fixed #50 and #51.
- 🔑 **Events are keyed unit + time + type:** `UNIQUE(serial, timestamp,
record_type)` (#51, Migration 3 in `sfm/database.py`, `dev`).
- A waveform and its histogram may share a second: 209 times in prod's
2026-09-30 store.
- Any lookup "by event" must include the type.
- An untyped event still dedups against an untyped row.
- Rehearsed on a copy of the prod snapshot: rows and ids kept, 9,852
histograms moved +1 s in place.
- ✅ **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`
- group A (`dev`, reference D.6.8): serial, version, calibration, battery,
trigger source, geo and mic trigger levels, stop mode, mic type
- group B (`dev`, D.6.9): interval frequencies, vector sums, size, stop
- group C (`dev`, D.6.10): histogram start and stop from the histogram's
own event record, interval times, and the peak dates and times
- 🔑 **"Units" means three different things — keep them apart** (reference
D.6.6):
- **Recorded data:** the mic samples and interval peaks in the file, as
@@ -81,9 +92,6 @@ Read this first when picking the project back up.
- ✅ **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; 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)
@@ -91,7 +99,7 @@ Read this first when picking the project back up.
- ~~**A. Setup fields**~~ ✅ done on `dev`.
- ~~**B. Histogram interval detail**~~ ✅ done on `dev`. Frequencies (#50),
per-interval PVS, interval size, stop.
- **C. #51 timing:** start time, per-interval times, peak times.
- ~~**C. #51 timing**~~ ✅ done on `dev`.
- **D. Blastware's waveform calculations:** ZC frequency, acceleration,
displacement, time of peak.
- **E. Sensor check results.**
+2 -2
View File
@@ -632,7 +632,7 @@ Implementation steps (concrete):
3. flip ingest so reports are kept only for checking (retire the overlay)
4. stop the watchers forwarding reports
**Done so far: 34 of 88 report fields match on every DL2 event.**
**Done so far: 47 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
@@ -641,10 +641,10 @@ Implementation steps (concrete):
- the footer: no more day-late histograms; every waveform time exact
- serial, version, calibration, battery, trigger source and levels, stop mode, mic type
- histogram interval detail: frequencies (#50 fixed), per-interval PVS, interval size, stop
- histogram start, stop, interval and peak times (#51 fixed); events keyed unit + time + type
- A Blastware report's dB/psi is its PC's preference, not anything in the event file: a carve-out.
**Next:**
- histogram start times (#51)
- the values Blastware computes itself: ZC frequency, acceleration, displacement, time of peak
- the sensor check results
- the monitor log
+31 -3
View File
@@ -11,6 +11,7 @@
| Date | Section | Change |
|---|---|---|
| 2026-11-03 (4) | Appendix D.6.10 (NEW), D.6.11 | ✅ **Histogram timing from its own event record (#51).** `00 28 05 00` `04 00` `fe f5` [start][stop]: Blastware's Histogram Start and Stop on 63,490 / 63,490 each; exactly one per histogram, start 0–1 s after the footer's ts1. Interval time = its end (start + (i + 1) × interval, capped at the stop), 2,308,524 / 2,308,524 rows; a peak's date/time = its interval's. Retracted: "histograms stay on ts1" (it held only while SFM's events were unique on serial + time; now unit + time + type). 47 of 88 report fields match on every DL2 event. |
| 2026-11-03 (3) | Appendix D.6.9 (NEW), D.6.10 | ✅ **Histogram interval detail.** Interval size = uint16 seconds at `k − 40`; stop = footer ts2. Frequency = (sample rate / 2) / half-period, 527,915 / 527,915 cells at 1024 sps and 1,725 / 1,725 at 2048 — **#50 retracted** (a fixed 512 halved 2048-sps frequencies). Blastware's words: `N/A` (half-period 0), `>100` / `>200` (≤ 5 samples), `<1.0`. Per-interval vector sum √PVS²: 63,497 histograms; `OORANGE` when over range with a clamped channel, 17 / 17. 34 of 88 report fields now match on every DL2 event. |
| 2026-11-03 (2) | Appendix D.6.6, D.6.8 (NEW), D.6.9 | ✅ **Identity, battery and trigger, from the file.** **D.6.8:** the identity block before the setup name is SUB FE's (serial `k − 202`, firmware `k − 147`, DSP `k − 138`, calibration `k − 132` + by `k − 128`, model `k − 72`; battery uint16 /100 at `k − 190`); all 70,042 / 70,042. The embedded event record's two unknown bytes are the **trigger source** bitmask (6,524 / 6,524). Trigger sources `k − 19`, stop mode `k − 31`, per-channel trigger level float32 at label + 30, mic type at MicL + 4 (Series IV's code). **D.6.6:** recorded data vs report units vs unit peaks, with the manual sections; a Blastware report's dB/psi is the PC's preference. 🔶 `9c 06 00 42` (the histogram "terminal tail") looks like `9c 06 00` + the serial's `B`. 28 of 88 report fields now match on every DL2 event. |
| 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. |
@@ -3893,16 +3894,42 @@ All four channels match every DL2 histogram.
- 4 cells sit about 4e-6 past a rounding boundary. Blastware's arithmetic is a hair lower; they
stay counted as mismatches.
#### D.6.10 Not read from the file yet
#### D.6.10 Histogram timing — the histogram's own event record ✅ 2026-11-03 (#51)
*Updated 2026-11-03. 34 of 88 report fields now match on every DL2 event.*
**A histogram carries an embedded event record like a waveform's** (§7.8.9):
00 28 05 00 04 00 fe f5 [start 8 B] [stop 8 B]
lead source marker dd mm yyyy 00 hh mm ss (as the footer)
- **Source `04 00`** sits where a waveform's trigger-source bitmask goes (D.6.8).
- **The start is Blastware's Histogram Start Time** on 63,490 / 63,490 DL2 histograms, and the
stop is its Stop Time on 63,490 / 63,490.
- On all 63,500 there is exactly one such record. Its start is 0 or 1 s after the footer's ts1
(1 s on 61,645), and its stop 0 or 1 s before the footer's ts2 (1 s on 57).
- That makes the footer's start a second early on 97%. #51 had read it as SFM's error; it is
the footer's own convention.
**What follows from the start:**
| Field | Blastware's rule | DL2 sample |
|---|---|---|
| Each interval's printed time | its end: start + (i + 1) × interval, capped at the stop | 2,308,524 / 2,308,524 rows |
| Each peak's date and time (Tran, Vert, Long, vector sum, mic) | those of the interval holding its first maximum | 2,000 / 2,000 each |
> ⚠ **RETRACTED 2026-11-03:** "histograms stay on ts1". That held only while SFM's events
> table was unique on (serial, timestamp). A waveform and its histogram share a second in
> Blastware's timing (209 times in prod's 2026-09-30 store). SFM's events are now keyed on
> unit + time + type.
#### D.6.11 Not read from the file yet
*Updated 2026-11-03. 47 of 88 report fields now match on every DL2 event.*
- **Fields not read yet:**
- 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), and so are 58 stop times
- about 20 one-minute histograms with a mic peak an interval or two off
- Blastware prints `OORANGE` when an event's vector sum alone exceeds the range, with no
clamped channel (a carve-out still to prove; the interval version is proven, D.6.9)
@@ -3914,6 +3941,7 @@ All four channels match every DL2 histogram.
- identity, battery, trigger source and trigger settings (D.6.8); Units is Blastware's
preference (D.6.6)
- histogram interval detail: frequencies (#50), vector sums, interval size, stop (D.6.9)
- histogram start, stop, interval and peak times (#51, D.6.10)
---