Commit Graph
98 Commits
Author SHA1 Message Date
serversdownandClaude Opus 5.5 35bac40dd5 docs: the .MLG format measured (reference D.4), and the new /db routes
Reference D.4 rewritten from the measurements: the 18-byte prefix,
length-led 292-byte records, the CRC-16/AUG-CCITT (3,329 / 3,329), the
fields, how Blastware writes the files and how a session appears, and
the cross-check against DL2's event files.  The old D.4.1-D.4.3 stay,
marked retracted.  CLAUDE.md gains the five routes and a Where things
stand entry; the spec's footer-CRC note points at dev's 8544e9c.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-11-13 13:56:10 -05:00
serversdownandClaude Opus 5.5 5dff54b292 chore: store source and docs with LF line endings (.gitattributes)
The protocol reference, seismo_lab.py and one scratch CSV were CRLF, so a
rewrite outside the Edit tool turned them into whole-file diffs, and merges
into them had to be resolved byte by byte.  They are converted once (line
endings only: the diff ignoring CR at EOL is empty), and .gitattributes keeps
every source and doc type LF from now on, whatever writes it.

tests/fixtures/** is -text: Blastware's own reports and exports, captures and
event files stay byte for byte (38 CRLF fixtures, unchanged).

A branch that edits one of the three files merges with -X renormalize.
Suite: 1,693 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-12 15:29:36 -05:00
serversdownandClaude Opus 5.5 ff705ebf87 merge: an escaped checksum is the checksum, not data (#58)
S3FrameParser kept the 10 of a checksum sent as `10 02/03/04` as the reply's
last data byte.  It now takes the pair: 7,747 / 7,747 recorded replies check,
272 of them with an escaped checksum.  Fixes the 1C battery/memory misread
(419.84 V on 12 of 760 recorded status replies) and the 2C call-home read; the
5A file builder's own compensation is removed with it, and pre-fix .a5.pkl
frames are converted on load (A5_PICKLE_VERSION 2).  checksum_valid now sums
the unescaped payload.

Conflict: the reference's changelog table (dev's own 2026-11-06 row); #58's
row kept as 2026-11-06 (2).  Suite on the merge: 1,693 passed, 0 failed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-12 15:27:00 -05:00
serversdownandClaude Opus 5.5 c87e677294 docs: the last 16 values are left as they are, by decision
The vector sum's last digit on 4 waveform/histogram twins (no fitted
factor on a compliance number) and the 4 accelerations (O117I1NK's fit
rests on one clipped file): left and documented, Brian 2026-11-11.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-11 15:22:49 -05:00
serversdownandClaude Opus 5.5 8544e9c7e2 docs(reference): the event footer ends in a CRC-16/AUG-CCITT
Footer [24:26] is CRC-16/AUG-CCITT (poly 0x1021, init 0x1D0F), stored
big-endian, over the footer record from its length prefix 00 1a through
footer [0:22] -- 24 bytes; the zero word [22:24] is not covered.
70,041 / 70,041 DL2 files.  Found by the .MLG session, verified here.
Retracts 2026-11-08's 'no common CRC-16 fits' (D.3.3, in place, and the
footer comment in event_file_io): every attempt had started at the
footer itself and missed the length prefix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-11 14:55:50 -05:00
serversdownandClaude Opus 5.5 e2c0f26b69 docs: over range, the mic's range and dB offset, and Blastware's mic unit labels
- Reference D.6.15 (new): over range -- a peak past 2,000 units (the mic
  in counts) is OORANGE, per channel and per histogram interval; the
  vector sum is OORANGE exactly when a geophone is (43 / 43), never on
  its own (38 / 38); the <OORANGE> line marks the mic over (18 / 18).
- D.6.6: the mic's own range byte (an eighth at 1; 7 events read 8x
  high); the dB offset corrected in place to 81.938216 (every printed
  count leaves [81.9382058, 81.9382266]); the unit labels that do not
  hold, and the mixed columns.
- D.6.11, CLAUDE.md: 80 of 88 report fields match on every DL2 event
  (run 20261109-144544, 0 regressions); the two causes left (the vector
  sum's last digit on 4 twins, 4 accelerations); the 'vector sum alone'
  case retracted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-09 15:11:43 -05:00
serversdownandClaude Opus 5.5 e542e61b68 docs(reference): an .MLG is little-endian, and its flags are the footer's flag word
D.2 and D.4.2 said MLG timestamps are big-endian; §7.5 already had the
year little-endian.  Measured on the 4 bench .MLG files: every date's
year is little-endian, and a record's [22:26] is the event footer's
flag word and trigger source (D.6.14), little-endian.  BE9441's 10-25
session lines up 20 / 20 with its event files.  write_mlg() writes
big-endian dates; nothing calls it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-09 12:37:37 -05:00
serversdownandClaude Opus 5.5 ed8712ac8e docs: the monitor log is in the footer (reference D.6.14)
- Reference D.6.14 (new): the Monitor Log line is the footer's ts1 - ts2
  plus words for its flag word [18:20]; 69,983 / 69,983 DL2 lines,
  character for character; the flag table and how common each is.
- D.3.3: footer [18:20] flags, [20:22] trigger source, [22:24] zero;
  [24:26] still unknown (no common CRC-16 or sum fits).
- D.6.11, CLAUDE.md: 72 of 88 report fields match on every DL2 event
  (run 20261108-034313, 0 regressions) and what is still open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-08 04:08:23 -05:00
serversdownandClaude Opus 5.5 7b45647b23 docs: #58 in the reference and CLAUDE.md; unescape_reply's 748 were replies
Reference row 2026-11-06: an escaped checksum is the checksum, measured on
7,747 / 7,747 recorded replies, with what the stray byte misread.  CLAUDE.md's
phase-5 warning marked fixed, and the reply rule widened.

Corrects 89c5234's unescape_reply docstring: the 2026-10-26 recording's
748/748 was measured on its replies (it also has 748 requests); I had called
them Blastware's requests.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-06 14:57:39 -05:00
serversdownandClaude Opus 5.5 a80ea759e4 docs: the record chain to the footer and the sensor check (reference D.6.13)
- Reference D.6.13 (new): the tail of an event file is one record chain
  ending exactly at the file's end (70,041 / 70,041 DL2 files); the
  sensor-check header layout and what Blastware prints from it.
- D.3.3: the footer is the chain's last record (length 00 1a, id 0e).
- D.6.12: 'before and after' retracted in place -- one record per channel.
- D.6.11, CLAUDE.md: 71 of 88 report fields match on every DL2 event
  (run 20261106-125854, 0 regressions; 59 before group E).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-06 13:23:39 -05:00
serversdownandClaude Opus 5.5 d2fe675650 docs(reference): 256, 4,096 and 65,536 mean a number outgrew its box
A note at the head of Appendix D.6 listing every case so far: the
O117I1NK sample wrap, the unit's 16.16 fixed-point step, the histogram
PVS2 high word above 1.28 in/s, the old 1.275 in/s byte clip, and the
64 KB 5A page.  Brian's observation, 2026-11-05.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-06 12:35:56 -05:00
serversdownandClaude Opus 5.5 f5feb0eabc docs: the unit stores its own largest sample step; Blastware's acceleration is still its own
The summary's unidentified [15:21] is the stored samples' largest step
plus 0 to 1 unit, x 65,536, on 19,479 geophone channels: probably the
unit's own step at full resolution (inferred).  Blastware does not print
it -- its acceleration matches the samples on 19,475 / 19,479 and this
field on 879.  Corrects 'acceleration is not stored'.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-05 17:46:28 -05:00
serversdownandClaude Opus 5.5 8d5c16b03b docs: the unit's own event summary (reference D.6.12), and group D in CLAUDE.md
- Reference D.6.12 (new): the record chain after the embedded event
  record, the per-channel summary layout, what Blastware prints from it,
  why recomputing failed, and the two odd 2019 files.  Group D part 1
  (time of peak, acceleration with the fitted g) is documented there too.
- Reference §7.8.9: its "constant, meaning unknown" bytes amended in
  place (the vector-sum peak sample, then the next record's lead).
- Reference D.6.11 and CLAUDE.md: 59 of 88 report fields match on every
  DL2 event (run 20261105-140021, 0 regressions; 47 before group D).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-05 14:25:31 -05:00
serversdownandClaude Opus 5.5 3564c4a744 docs: phase 5 benched on both series (2026-11-04)
Both protocol references, the spec's bench section and CLAUDE.md record
the bench: every settings change acknowledged, read back and confirmed on
the unit's screen, both units restored byte for byte; the escaped-
checksum stray byte (fixed); a MiniMate's open setup menu writes its
whole-block copy back on Cancel or Save, losing a remote change; the
alarm write at channel +38; [26:28] re-set by the unit while monitoring;
the first Micromate setup push with the unit's CRC equal to SFM's; the
Micromate scheduler switch in none of the blocks SFM reads.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-04 16:16:40 -05:00
serversdownandClaude Opus 5.5 f24913189b merge: dev 9b458b5 into the parity branch (group A/B, #51 histogram timing)
Brings the checker's file-only decode work onto the parity branch so the
phase-5 bench runs on the code that will ship.  One conflict, the CRLF
Series-III reference changelog: both kept, phase 5's row numbered
'2026-11-03 (5)' above dev's (4)/(3)/(2).  test_event_ingest's live-
histogram dedup test asserted the stored row sits a second off the 0C
time -- the #51 bug, fixed on dev -- so its premise now reads the event's
own second; the dedup it tests still holds.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-04 12:31:21 -05:00
serversdownandClaude Opus 5.5 d4cfb07fce docs: histogram timing from its own event record (D.6.10), and the unit + time + type key
The reference gains D.6.10: the histogram's embedded event record (lead
00 28 05 00, source 04 00, marker fe f5, start, stop) and the interval
and peak-time rules, with 'histograms stay on ts1' retracted in place.
CLAUDE.md 'Where things stand' records the new events key -- any lookup
by event needs the type -- and 47 of 88; the README roadmap follows.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-04 12:19:38 -05:00
serversdownandClaude Opus 5.5 5ba72740dd feat(codec): one settings codec for both series, on the shared layout
micromate/setup_fields.py: the fields an operator can change (record
mode, sample rate, interval, record time, geophone trigger, Series 3's
range and -- read-only until benched -- alarm, job number and its report
flag, the four notes by slot), the units' own limits from Instantel's
manuals, field-only byte patching (bit fields bit by bit; Series 3's
[26:28] as Blastware writes it; Series 4's CRC recomputed), the
read-back verdict compared by bytes, and the preview revision.

All 11 Blastware compliance writes reproduce from the block before them
(BE11529's first also shows Blastware re-rendering two mic levels
through its dB value; SFM echoes the unit's bytes); Series 4 keypad
fixtures reproduce pairwise.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 21:33:01 -05:00
serversdownandClaude Opus 5.5 1bb15573fc feat(s3): assemble a settings read into the 2,090-byte block
Unescape each 1A data frame, take data[11:], drop the one non-content
byte that starts every frame but the last: 2,090 bytes headed by
N = 2090, Series IV's 0x1A layout.  Measured on BE9441's 10-26
recording (12 reads, both frame patterns); the read after each
Blastware write equals the image written.  read_compliance_content is
strict (a missing frame raises) and unjudged (a monitoring unit's
device-info answer comes back for the caller to recognise).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 21:28:04 -05:00
serversdownandClaude Opus 5.5 2c4ae8c4ef docs: group B in the protocol reference (D.6.9), #50 retracted
Interval size (k - 40), the stop (footer ts2), frequency = (sample rate
/ 2) / half-period with Blastware's words for N/A, >100 / >200 and
<1.0, and each interval's vector sum with its OORANGE rule.  The old
fixed-512 frequency formula is retracted in place.  CLAUDE.md and the
README roadmap follow: 34 of 88.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 18:29:53 -05:00
serversdownandClaude Opus 5.5 8f75be5f72 docs: group A in the protocol reference, and the three meanings of mic 'units'
Protocol reference:
- D.6.8 (new): the identity block (SUB FE's: serial, firmware, DSP version,
  calibration date and 'by', model; battery), the trigger-source bitmask
  in the embedded event record, and the trigger settings (sources, stop
  mode, per-channel levels, mic type) with their DL2 counts.  The
  histogram 'terminal tail' 9c 06 00 42 looks like 9c 06 00 + the
  serial's B (inferred).
- D.6.6: recorded data vs report units vs unit peaks, with the
  MiniMate Plus (s3.9.7) and Blastware (s4) manual sections.  Where the
  unit stores its own Microphone Units is unmeasured; a keypad test is
  proposed.
- D.6.9 (was D.6.7): refreshed, 28 of 88.

CLAUDE.md 'Where things stand' and the README roadmap follow.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 17:24:21 -05:00
serversdownandClaude Opus 5.5 cbce00f8e1 merge: dev into feat/series4-sfm-parity -- the decode checker's file-only fields (job number, codec by STRT[18], last-26-byte footer)
Brings be5bab4 and its history from the decode checker's branch: a Blastware
file's job number; decode_blastware_bytes choosing the codec by STRT[18] and the
histogram layout check by peak <= PVS <= sqrt(3) peak; the footer as the file's
last 26 bytes (no day-late histograms); docs (reference Appendix D.6, the
file-only status).

Conflicts, both kept whole:
- CLAUDE.md: this branch's 'Narrowed 2026-10-26' 5A block stays, followed by
  dev's 'Open, not blocking' line (the 8x sensitive-range item struck out --
  resolved by the file's range).
- docs/instantel_protocol_reference.md (CRLF, byte-safe): the change-log rows in
  date order -- dev's 2026-11-03 and 2026-11-02, this branch's 2026-11-03
  (call home), 2026-10-29 and 2026-10-27 (#46, this branch only).

Suite on the merged tree: 1399 passed, the 16 known failures.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:34:59 -05:00
serversdownandClaude Opus 5.5 2e1c2ba21f docs: phase 4 bench -- call-home on/off on both series, idle and monitoring
Benched 2026-11-03 on UM20147 and BE9441 (each on its own modem, one send per
go): idle, a no-op, off and on all acked, read back and confirmed on each unit's
menu; UM20147 accepts 0x00 at [5].  Monitoring, neither series takes a change: a
MiniMate answers 0x2C with its device-info block, a Micromate acks and ignores
('Feature disabled while monitoring').  Series 4 [118:120] is a function of the
block's content -- XOR 0x6D7D per bit-0 flip on two units, not a nonce.  A stop's
call-in reached THOR when the ring followed the ack.  UM20147's clock is an hour
ahead (DST).  Spec, both protocol references (Series III: a CRLF row), CLAUDE.md.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-11-03 15:32:51 -05:00
serversdownandClaude Opus 5.5 5a089671e8 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
2026-11-03 13:05:58 -05:00
serversdownandClaude Opus 5.5 e1e8a851c8 docs: where the 1995 default-clock events come from
Brian's account: units come back from calibration with the internal
battery unplugged, so a comms-test trigger before the date is set
carries the default.  DL2 holds 17 such events on 6 units, all within
1995-09-01 12:02 .. 09-03 11:24.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-03 12:12:02 -05:00
serversdownandClaude Opus 5.5 5bed7d6c6f docs: the file's pre-trigger is the event's, not the setting -- corrects today's #48 note
The pre-trigger float in an event file's setup block varies from event
to event on the same unit, often on the same day (BE18193: -0.25 and
-0.248 on 2026-08-21; 253-256 samples at 1024 sps, -0.002 to -0.249 s
at 4096 sps), and Blastware reports the same per-event value as
Pre-triggerLength.  So it is the event's own pre-trigger, and the note
written earlier today overstated what the files say about #48: the live
1A holds the setting, so a missing anchor in a file says little about
whether the live read loses its anchor.  #48 stays open.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:23:32 -05:00
serversdownandClaude Opus 5.5 b6e726f850 docs: the event-file fields SFM reads from the file alone (reference Appendix D.6)
New Appendix D.6 records the bytes and DL2 verification for every field
SFM reads from a Blastware event file: record type STRT[18], the
recording-setup block (sample rate k-42, pre-trigger k-36, record time
k-30, the four notes), the geophone range (label+29), each histogram
interval's PVS^2, and the mic scale (0.25 Pa per count, dB offset
81.9384).  None of these were written down outside code and issues.

Retracted in place:
- D.3.1's STRT[20] = record time: it is 00 on 70,041 / 70,041 DL2 files.
- the 2026-08-26 reading of sub-minute histogram records as little-
  endian: big-endian from byte 5 since v0.32.0 (#47/#49), and the
  '2-word tail' is the PVS^2.  Also in CLAUDE.md.

Measured for #48 (files only): the 1A 'stable anchor' be 80 00 00 00 00
is the setup's pre-trigger -0.25 s plus 00 00.  It is present only on
the 3,886 / 6,541 DL2 waveforms recorded at exactly -0.25 s, and on no
histogram.  The live 1A read is still unmeasured.

CLAUDE.md: Where things stand reflects the range fix on dev (6,524 /
6,524 waveforms exact); the 8x sensitive-range item and the MicL dB
item are marked resolved in place.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-11-02 14:03:47 -05:00
serversdownandClaude Opus 5.5 1cce2fcf63 docs: Batch 1 final-review fixes -- reconnect wake, dedup by name, the write encoder's refusal
- Spec: #1, #8, #9 carry their review follow-ups (a72d3a9, 3a1d34a, dbd8a91);
  new open finding 17 (a monitoring MiniMate's 1A has no range, so a download
  then stores Normal-scaled samples; ':S338.17' setup name; no .a5.pkl kept).
- Series-III reference (CRLF kept): the 2026-10-29 row records that the write
  encoder was not moved and now refuses a patch that would not read back.
- CLAUDE.md: the three fixes.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-29 23:57:13 -04:00
serversdownandClaude Opus 5.5 1626e521ae docs: 1c bench Batch 1 -- #1, #8, #9 fixed; #15 retracted; the 1A layout after unescaping
- Spec (Left open by the 1c bench): #1 b320a53, #8 9492e49, #9 ce441a0, #2 via the
  dev merge 342c696; #15 retracted in place (sent NULL = unknown, by design).
- Series-III reference: a 2026-10-29 row -- the SUB 1A settings fields read after
  unescaping (mode -7, rate -6, interval -4, record time +6), the old
  'anchor-7 constant 0x10' was the escape before 04 at 1024 sps, the channel
  block stays on raw bytes (open: a float containing an escapable byte), and a
  monitoring BE9441 answers 1A with its device-info block.  CRLF kept.
- CLAUDE.md: Batch 1 status.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-29 23:28:39 -04:00
serversdownandClaude Opus 5.5 342c69602d merge: dev into feat/series4-sfm-parity -- v0.32.0, #42, #47/#49, #44/#45, the S3 decode checker
Brings the branch up to dev (41 commits) before the 1c bench fixes, which
touch code dev changed: the histogram reader (#47/#49, bench finding #2), the
v0.32.0 event-time rules, the Blastware file's setup-block fields (#44/#45),
and the decode checker for verifying stored S3 downloads.

One conflict: the top of the Series-III reference's change table -- both sides
added rows; kept all, in date order, CRLF preserved.  CLAUDE.md, README,
blastware_file.py, models.py and database.py merged cleanly.  Suite: the known
16 failures only (15 test_bw_ascii_report, test_save_imported_bw_without_report_
works_unchanged, which also fails on dev); 1237 passed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-29 22:51:42 -04:00
serversdownandClaude Opus 5.5 e9d352ad99 docs: the decode checker's first full run; correct the #53 note
First full run over DL2's 70,042 report-paired events (22 min, --jobs 4):
every expectation the spec set holds.  Setup and notes match everywhere;
geophone samples are exact on 6,491/6,524 waveforms across 2016-2026,
the other 33 being the 1.250 in/s range read 8x on SFM's Normal
assumption; every histogram is typed as a waveform without its filename
(#41); the three #53 files are the only waveform time mismatches.  New
findings: histogram PVS, mic psi, mic dB on ~1,000 events, ~37
sub-minute histograms, 26 histogram start dates.

The #53 note is corrected in place: those files decode as waveforms with
Blastware's full sample count; only their time falls back to the footer
start.  scratch/verify_bw_fields_against_xml.py is retired -- the
checker replaces it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
2026-10-29 19:55:07 -04:00
serversdownandClaude Opus 5.5 329f7f2abb docs: retract the MiniMate write-frame model in place (#46)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-27 02:54:56 -04:00
serversdownandClaude Opus 5.5 7100d8344a docs(reference): point §7.8.9's open items at the Series-III audit, #53
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-27 00:17:15 -04:00
serversdownandClaude Opus 5.5 f91949be89 fix(decode): a Series-3 waveform's time comes from the instrument's embedded event record
Brian's requirements: the instrument's data is the only time source; a filename
is a cross-check, never a fallback (an event SFM receives itself has none).

The record (found by reading a seismo_lab Inspector dump; Series-III reference
§7.8.9): 00 28 05 00 ?? ?? | fe 80 | trigger | stop, times dd mm yyyy(BE) 00 hh
mm ss.  Measured on 7,935 waveforms (DL2 + prod store): exactly one candidate
validates in every file; trigger = Blastware's report 1,320/1,320, = filename
7,935/7,935, = the unit's 0C record 10/10.

Provenance (requirement 6, measured): in Blastware's download of 8 BE9441
events the record -- with 24 B before and 22 after -- occurs exactly once in the
unit's own A5 reply payloads; SFM-only downloads (no Blastware) carry it too.
It is instrument data, not Blastware's.

- _embedded_event_record(): every fe 80 before the footer is a candidate; it
  counts only with the lead bytes, two well-formed times (zero byte zero),
  footer ts1 <= trigger <= stop, stop = footer ts2 or a second before, and a
  length matching the record time.  Exactly one must count; none or several is
  a decode problem, never a guess.
- Without one: the footer estimate, timestamp_source 'estimate', a
  decode_problems entry, a WARNING.  No filename fallback.
- A filename that disagrees is logged; the decoded time is kept.  A paired
  report fills in only without a validated record (apply_report_to_event, the
  sidecar dict overlay, event_to_sidecar_dict) and is logged when it disagrees.
- decode_blastware_bytes(raw, name=None): no file or name needed;
  save_imported_bw uses it (no temp file).  Event gains timestamp_source and
  decode_problems; the sidecar records both.
- Histograms unchanged (#51): their record (fe f5) is noted, not used.

Tests: raw bytes with no name (ZI0, 7 BE12844 oracles), a disagreeing name, each
validation rule alone, two valid candidates, no filename fallback, report
precedence, sidecar.  7 mutants, each caught.  Real data, decoded with no name:
7,961/7,961 waveforms on the record, 0 disagreements with filename or report;
10,433/10,433 prod histograms unchanged.  Suite: only the 16 known failures.

Open (reported, not changed): 3 DL2 files named as waveforms whose body the
waveform codec does not recognise keep the footer start, 4 s off, as on dev.
None in prod.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01MUHR251NLznsFvPSrfegqL
2026-10-26 23:59:22 -04:00
serversdownandClaude Opus 5.5 8acb9512a9 fix(minimateplus): size the 5A chunk cap from STRT, refuse a misread STRT, TERM only a tail
Follow-ups from the review of 887e75d (verdict: keep, with fixes; no critical).

- The cap: a caller's max_chunks (client.py passes 128) now bounds only a walk
  whose end is unknown.  With STRT it cut every event past ~66 KB short --
  2,545 of 63,500 archived histograms are bigger (the review's count, DL2).
  Strict raised; legacy sent a TERM for most of the event, or a bare ValueError.
- A STRT claiming less than one 0x200 chunk, or more than 4 MiB (a sanity bound,
  not a measured limit), is refused as a misread, in both modes -- once a bare
  ValueError and a 500.
- TERM is sent only for a true tail (< 0x200).  After an early end the legacy
  walk returns what arrived and sends none.
- build_5a_request wraps build_bw_frame; the old 5A helpers are marked
  superseded (kept for tests/test_5a_protocol.py) and their imports dropped.

Tests: all 8 recorded events (were 4) walk exactly as Blastware and rebuild its
own files; an end key holding escaped bytes; a 300 KB event past a 128 cap; both
misread-STRT refusals; the 1A frames BE9441 answered post-fix; the checksum
vectors retargeted.  Mutants the review saw survive (no STRT un-escape; a
standard-request escape revert) and 3 new ones are each caught.

Measured on the way: a reply's checksum is SUM8 of its unescaped payload,
748/748.  The 'S3 checksums frequently fail' note was the parser summing its
own kept escape bytes; noted, parser unchanged.

Docs: the crossing count corrected to four (events 1, 3, 5, 7); the remaining
stale 5A sections in CLAUDE.md annotated; the write-frame suspicion recorded as
inferred only.  No codec, store or DB change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 15:16:10 -04:00
serversdownandClaude Opus 5.5 6f31eca366 docs: the 64 KB page bug is fixed; the 5A 'non-standard frame' model retracted in place
CLAUDE.md: the KNOWN BUG entry marked fixed (887e75d) with what settled it, and
retraction notes under the 5A sections that described the misreading (partial
stuffing, offset_hi 0x10 raw, 11-byte params, metadata pages 0x1002/0x1004).
Series-III reference: a 2026-10-26 (3) row.  Spec: the MiniMate check updated.
Code comments that called the page bug open, updated; the adapter's struct.error
mapping kept as a defence, its message and test no longer naming the old bug.

Verified live on BE9441 the same day: all 8 events downloaded by serial, the 4
that cross a 64 KB page included, each whole and matching the unit's own peaks.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 14:44:11 -04:00
serversdownandClaude Opus 5.5 465bc704dd test+docs: SFM's MiniMate downloads are byte-identical to Blastware's; the 64 KB bug narrowed
Brian's Blastware downloads of BE9441's 20 events give ground truth.  SFM's
re-run downloads of events 0, 1, 3, 4 and 10 are byte-identical to Blastware's
own files; imported first through the watcher route, the same events download
as already_stored (no duplicate rows -- the unit's 0C and Blastware's file agree
on serial + timestamp).  Fixtures: Blastware's P00/Q10 (now asserted equal to
SFM's builds) and QZ0/T80, the two page-crossing events, as byte-exact targets.

The 64 KB page bug, narrowed by a read-only test walk: carrying the page byte
addresses the first chunk in page 0x12 (answered), but the next request carries
a raw 0x03 inside its params (counter 0x032c) and gets no reply.  Pages after
0x11 have such counters; 0x11 does not (event 1 skips 0x0000-0x05FF).  Needs a
Blastware wire capture of event 2 or 19 (recorded in CLAUDE.md, the Series-III
reference and the spec).  No code change.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 12:15:50 -04:00
serversdownandClaude Opus 5.5 1ded70fcd9 docs: the MiniMate re-run -- every in-page event verifies; the 'reboot' was our bare 0x02 checksum
Series-III reference: a 2026-10-26 row (5A checksum escape, measured), and the
2026-10-25 row's guessed cause of the mid-download reboot (battery, firmware)
retracted in place -- it was our request.  CRLF kept.  Spec: the re-run, item
by item, and what is still owed.  CLAUDE.md: the phase-1b bullet brought up to
date.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-26 01:19:46 -04:00
serversdownandClaude Opus 5.5 151782365b docs: restore the Series-III reference's CRLF line endings; the pre-trigger is 0.25 s
3898d03 rewrote docs/instantel_protocol_reference.md with LF endings (a 7,327-line
diff for 3 added lines).  CRLF restored; the file's real change is the 3 lines.
Also: BE9441's 21,504 samples are 5 s record + 0.25 s pre-trigger at 4096 sps,
not '+ 1 s' (reference row, fixture README, test comment).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-25 18:41:53 -04:00
serversdownandClaude Opus 5.5 3898d03236 docs: the first MiniMate bench run -- four bugs found, what remains of the check
Series-III reference: the 0x15 serial is a C string (BE9441's "BE9441\x00?"),
A5 replies echo their address at data[2:6] (metadata pages only on the
event-1 walk), the unit boots on serial-port open (banner ~3 s, answered 8.8 s
after a reboot's banner), one mid-download reboot, and 24 index entries vs 20
listed events (inferred: monitor-log entries).  Spec: the MiniMate check's
first run, item by item, and what is still owed.  CLAUDE.md: the phase-1b
"unproven" line retracted in place, with the four bugs and the re-run owed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-25 18:19:14 -04:00
serversdownandClaude Opus 5.5 56b8aac4cb docs(series4): the 0x1A field map from a keypad pass -- a CRC, an edit buffer, and three mic blocks that are not channels
47 snapshots of UM20147 while settings were changed on its own keypad, one
at a time.  Every byte that moved is accounted for; nothing outside 0x1A
moved.

MEASURED (operator named setting + values): record mode [5] (01 Waveform,
02 Manual, 03 Histogram, 04 Combo -- S3's encoding, one byte later than the
S3 analogy put it), sample rate [6:8], histogram interval [8:10] s,
pre-trigger [12:16] f32 negative s (all four values), stop mode [17], record
time [18:22] f32, auto-stop [23], active-sensor and trigger-source bitmasks
[25]/[29], trigger level at channel +30 (geo in/s, mic psi).

MEASURED: the trailer is CRC-16/AUG-CCITT over content[0:2088] -- 47/47 and
a second unit.  Thor's write omits it, so it is read-side integrity, not a
write obligation.

MEASURED: blocks 1-3 are geophones, block 4 is the ACTIVE mic (a byte copy
of 5 or 6), 5 and 6 are the stored linear / SLM mic setups.  No separate
mic-type byte; block 4's +4:8 code is the type.  Promotes the 10-15 "+4
channel type" guess; retracts "+46:48 is a trigger-source flag" in place.

MEASURED: 0x1A reads the keypad's edit buffer live; discard reverts;
commit timing differs by widget (list / spinner / sub-window).

INFERRED, Series III: the 6-byte "stable anchor" sits exactly where Series
IV keeps pre-trigger (-0.25 s) + stop mode (Fixed).  An S3 unit in Auto
stop mode would lose it and decode no mode/rate/interval/record time.  Not
measured on S3; noted in instantel_protocol_reference.md, code untouched.

No codec, store or DB change; no backfill.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
2026-10-17 02:22:00 -04:00
serversdownandClaude Opus 5 5f1ee5ba91 docs: offset investigation journal; strip NUL corruption from CLAUDE.md
Adds docs/offset_investigation.md — a dated journal of the "offset" hardware
fault, in the style of the codec status docs: findings with provenance, dead
ends kept with the reason they died, and per-unit case files.

Contents:
  - base rate 5-6 of 45 units (11-13%) over the DL2 archive, 2018-2026,
    confirming rather than overturning the earlier 2-of-21 estimate
  - the detector, with the rationale for each term and its known blind spot
    (event traces carry real motion, so only trace-dominating offsets show)
  - the bimodality result: relaxing the amplitude floor 11x adds no new units
  - Instantel's own procedure and thresholds from their FAQs 13-0-21 / 12-0-10:
    A/D-mode ">5 counts", the autozero key sequence, and the 2027-2069 X1/X8
    acceptance window that explains the ~10% field success rate of a re-zero
  - four ruled-out hypotheses, each with the evidence that killed it:
    condensation, clipping, the sensor check as a predictor (102 offset events,
    zero failures — a grossly offset unit passes its own self-check), and the
    calibration-timing correlation (confounded, one unit per time bucket)
  - open questions, chiefly whether SUB 0x0E carries the autozero numbers

Cross-referenced from CLAUDE.md and Appendix E of the protocol reference
(whose CRLF line endings are preserved).

Separately: CLAUDE.md had 793 NUL bytes appended after its last line. They
predate this work (present at least as far back as e42956a / v0.21.0) and made
grep treat the file as binary, silently skipping it. Stripped.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-28 20:19:30 +00:00
serversdownandClaude Opus 5 306104354b feat(histogram): decode multi-interval blocks — recovers 415 files
Sub-minute histogram intervals are packed several to a block so that
every block still covers exactly one minute of data:

    interval   intervals/block   stride
    1 minute   1                 32     <- the standard big-endian block
    15 s       4                 92
    2 s        30                612

    stride = 12 + n * 20

Block = [00][segment][ctr uint16 LE][0a][00], then n x 20-byte records of
8 x uint16 LITTLE-endian values (T_peak, T_halfp, V_peak, V_halfp,
L_peak, L_halfp, M_peak, M_halfp) plus a 2-word tail whose first word is
0000 on every real interval, then a 6-byte block trailer.

The standard 32-byte block is BIG-endian; this variant is LITTLE-endian.

The tail-word check matters: a session ending mid-block leaves buffer
garbage in the remaining interval slots, which decoded as peaks
thousands of times the real value.  Stride detection also requires at
least 2 records, since a 1-record block would have stride 32 and
collide with the standard block.

Recovers 415 files that decoded to nothing: 216 on BE18193 (2 s
intervals) and 199 on BE9440 (15 s).  Before decoding to nothing they
were being accepted by the WAVEFORM codec, which returned garbage
peaking up to 400x the device-reported PPV.

Ground truth BE9440/K440L3AQ.T70H (5,710 intervals) matches its
Blastware ASCII export exactly: 17,130/17,130 geo peaks, 22,840/22,840
frequencies, 5,710/5,710 mic dB(L).  Across all 455 affected files,
1,354/1,365 channel peaks (99.2%) match the device-reported PPV; the 11
that don't are under-reads on BE9440 where the walk stops early.

Fixture (binary + ASCII) saved under tests/fixtures/, which is
gitignored per repo practice — the ground-truth test skips when absent.

Tests: 258 passed, failure list unchanged from baseline.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-26 04:59:00 +00:00
serversdownandClaude Opus 5 4c58a532de fix(backfill): remove stale .h5 when nothing decodes; log the 415-file histogram variant
backfill_sidecars.py skipped the .h5 write when a file produced no
samples, with the stated intent of not replacing it with an empty
placeholder.  That silently preserved output from a superseded decoder.

After the record-chain fix, 415 histogram files stopped decoding (216 on
BE18193, 199 on BE9440) but kept .h5 files whose peaks ran up to 400x
the device-reported PPV.  Those were feeding charts and the
false-trigger detector with nothing marking them.  The .h5 is now
removed in that case and the run reports stale_h5_removed.

Store-wide effect, series-3, decoded peak vs device-reported PPV:
  waveform   1307/1307 (100%), mean abs ratio error 0.00000
  histogram  4434/4435 (100%)
Both were 99% with a tail of 18 and 25 wrong files respectively.

The 415 files are a genuine unmapped format variant, not a regression:
their bodies open `00 00 00 01 0a 00` (valid block header, marker 0a at
[4], block_ctr 256) but block[28:32] matches neither known tail, and no
stride from 8 to 64 bytes places a marker at [4] consistently.  Bodies
are very large (one is 360,573 bytes).  They were previously being
decoded by the WAVEFORM codec, which accepted them and returned garbage
- so the gap pre-dates today's work; the fix only exposed it.  Logged as
an open question in the protocol reference.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 22:23:10 +00:00
serversdownandClaude Opus 5 9bb95003e9 fix(codec): the waveform body is a record chain, not a tag stream
Supersedes the segment-header model entirely, including the fixes made
earlier today.  Found via multi-agent structural analysis of the 25 files
that stalled the walker, then verified independently.

Records are self-delimiting: off+2 is a uint16 BE length, next_record =
off + 2 + len, and the chain ends on a record whose chan_id is 0x06.
off+8 carries a 3-valued mode enum:
  02 00  14-byte header, 2 anchors, then CUMULATIVE delta blocks
  01 00  10-byte header, no anchors, blocks are ABSOLUTE values
  00 03  10-byte header, NO TAGS AT ALL - raw 12-bit packed absolute

`40 NN` is an ordinary int16 BE data block (2*NN + 2), never a header.
Reading it as a 2*NN + 16 header is what made walks drift — the
"variable-prefix segment descriptors" reported earlier today were not a
format feature, just walker drift of exactly
4 - (old_stop - true_record_start), on all 25 affected files.

Measured on the production snapshot:
  all four channels equal length   156/1388 -> 1388/1388
  ASCII sample-count exact           72/75  ->   75/75
  ASCII fully exact                  70/75  ->   73/75
  device PPV waveform (live)       1288/1306 -> 1306/1306  (mean err 0.00000)
  device PPV histogram (live)      4434/4459 -> 4458/4459

Also eliminates the walker-over-read class: 24 of those 35 files were
histograms that read_blastware_file fed to the waveform codec first; the
old walker accepted them and returned garbage (one yielded 98,923
"intervals"), while the record-chain decoder returns None so they fall
through to histogram_codec.

00 03 records are DECODED, not skipped.  Skipping them silently shifts
the time base of everything after them on that channel — BE9558/
K558LOF2.820W had MicL displaced by exactly 512 samples with nothing
marking the gap.

Footer detection now prefers the 0e 08 candidate whose body yields a
chain terminating on 0x06; the signature can occur inside a sample
stream.  Blast radius 1 file of 1388.

The superseded model survives as decode_waveform_legacy, pinned by
micromate/idf_file.py: its Thor IDFW body-offset search trial-decodes
candidates and keeps whichever yields the most samples, so the new
decoder returning None where the old returned garbage changes that
heuristic's winner.  Deferred until that search uses the record chain.

Tests: 253 passed (+11), failure list unchanged from baseline.  The 9
tests pinning the superseded model are retargeted at
decode_waveform_legacy, which still implements it.

NOTE: stored .h5 files need regenerating — nearly all get longer.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 22:13:29 +00:00
serversdownandClaude Opus 5 ef1e99b0a0 fix(histogram): block is big-endian + terminal block tail — 1/1196 to 1211/1211
Two errors in the series-3 histogram block model, both found by diffing
against the per-interval data table in the preserved Blastware ASCII
exports (1211 files in the prod snapshot — far stronger ground truth
than the header PPV used previously).

1. The block is uniformly BIG-ENDIAN.  Peaks and half-periods are uint16
   BE (T_peak [5:7], T_halfperiod [7:9], V_peak [9:11], V_halfperiod
   [11:13], L_peak [13:15], L_halfperiod [15:17], M_peak [17:19],
   M_halfperiod [19:21]); only block_ctr [2:4] is little-endian.

   The old uint8-peak model silently CLIPPED any peak above 1.275 in/s:
   the final interval of BE18193/T193LQ9K.OE0H reads 8.270 in/s in BW's
   export (1654 counts = 0x0676) and decoded as 0x76 = 118 = 0.590.

   The byte documented as a per-channel "annotation" was never an
   annotation — it is the half-period's high byte, which is exactly why
   it was non-zero on the sub-Hz intervals BW renders as "<1.0".

   The marker is block[4] alone.  Testing [4:6] as a uint16 LE marker
   forced block[5] == 0, which is what capped the peak at one byte.

2. The final block of each stream carries tail 9c 06 00 42 instead of
   1e 0a 00 00, and holds arbitrary bytes at [21:23].  Rejecting it
   dropped the last interval of nearly every histogram — frequently the
   interval holding the event peak, so the file's PPV read low.

Verified end to end through the production path: 1211/1211 histograms
decode exactly (interval count + every per-interval peak), plus 842,442
per-interval frequency comparisons with zero mismatches.  Previously
1 of 1196 files was fully correct.

decode_histogram_body_full records expose `is_terminal` in place of the
removed `annotations` tuple.  +6 tests.  No regressions: full-suite
failure list unchanged from baseline.

NOTE: stored histogram .h5 files need regenerating to pick this up.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 18:59:25 +00:00
serversdownandClaude Opus 5 e449ac04af docs: sharpen the series-3 histogram open item — dropped intervals, not wrong values
Re-measured properly.  The first pass compared h5 max against the ASCII
header PPV and reported "26% of channels miss the peak".  The histogram
ASCII actually carries a full per-interval data table (Tran/Vert/Long
peak + freq + PVS per interval), which is real ground truth, so the
comparison should have been per-interval from the start.

Per-interval result, n=1196 series-3 histograms:
  - decoded VALUES are right: 1031/1196 (86%) match within 1 LSB across
    the overlapping prefix
  - the interval COUNT is short in 1195 of 1196 files: median 1 missing,
    1088 short by 1-2, 65 by 3-10, 39 by 11-100, 3 by >100 (max 205)
  - decoded max falls below the device PPV in 169/1196 files (14%), not
    26% — that happens when a dropped interval held the peak

So it is a termination bug in histogram_codec.decode_histogram_body,
the same family as the waveform-walker truncation fixed earlier today,
rather than mis-decoded interval values.  Series-3 only; there is no
preserved series-4 ASCII in the snapshot to compare against.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 16:23:51 +00:00
serversdownandClaude Opus 5 4f8224a751 docs(appendix-e): offset fault is geophone-side — operator swap test + MicL evidence
Operator report: attaching a different geophone to an affected unit
makes the offset go away.  That rules out the unit's analog front-end
and any stored per-channel zero constant (a constant lives in the unit
and would survive a sensor swap).

The stored data agrees — MicL, a separate transducer on its own cable,
shows no offset during either episode (|mean|/peak 0.17 and 0.02) while
the geo channels on the same unit at the same moment are pinned.

Two distinct sensor-side patterns recorded:
  BE18438  Vert 0.97, Tran 0.16, Long 0.18  -> one conductor pair
  BE9558   Long 0.99, Tran 0.90, Vert 0.81  -> shared return / ground

Candidate mechanisms narrowed to three, since a geophone coil is passive
and cannot generate sustained DC: galvanic corrosion at a connector or
splice (matches the ~46 mV referred to the ADC input), a leakage path to
shield, or changed coil DC resistance interacting with the amplifier's
input bias current.

Also records the confound: swapping a sensor requires a monitoring
restart, and these units run Sensor Check "Before monitoring", so the
restart re-zeros too.  The swap does not cleanly separate "new sensor"
from "the restart re-zeroed it".  Controls and the single best
measurement (open-circuit DC across the suspect connector) documented.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 15:06:34 +00:00
serversdownandClaude Opus 5 5d3963b545 docs: record the 2026-08-25 body-codec and geo-scale findings
Brings the protocol reference, CLAUDE.md and the codec RE status doc up
to date with everything confirmed in this pass.

instantel_protocol_reference.md
  - Changelog row for the five findings.
  - S7.6.1: scope table showing the 32000 scale correction applies to
    series-3 waveform, series-3 histogram and series-4 Thor alike, with
    the measured before/after ratios for each.
  - S15: closed "Full channel ID mapping in SUB 5A stream" — resolved by
    the segment-header channel id ([channel][00][00][segment], 0x46=Tran
    0x47=Vert 0x48=Long 0x49=MicL, 1697/1697 verified).  Four new open
    questions: variable-prefix segment descriptors, the histogram codec
    missing peak intervals (26% of channels), UM-series IDF decoding
    ~1000x low, and the Thor per-count LSB residual.
  - NEW Appendix E — Known Device Faults.  Documents the field-observed
    "offset" fault: symptom, why it floods the ACH queue (pedestal
    exceeds the unit's own geo trigger level), the episode table, the
    detection rule that works, what the data rules out (not the
    geophone, not the battery, not environmental, not condensation),
    and the two remaining candidate mechanisms with the test that
    separates them.  Explicitly flags that it is NOT a decode artifact,
    since that mistake has already been made once.

CLAUDE.md
  - Body-codec section: the four framing cases and the channel-id
    finding, with the corpus result.
  - "What's NOT solved": replaced the stale walker-edge-cases bullet
    with the four genuinely open items.

waveform_codec_re_status.md
  - Scale scope table matching the protocol reference.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 14:25:26 +00:00
serversdownandClaude Opus 5 686ab6e7a6 fix(codec): geo full scale is 32000 counts; 4 walker framing cases; channel-id from header
Two independent bugs, both found by diffing 75 production events against
their preserved Blastware ASCII exports (<store>/<serial>/<file>_ASCII.TXT).

1. Geo full scale was wrong — every geophone reading was 2.34% low.
   The codec emits geo samples in 16-count units with a documented LSB of
   exactly 0.005 in/s, and decoded_to_adc_counts multiplies by 16, so one
   ADC count is 0.005/16 in/s and 10.000 in/s is 10.0/(0.005/16) = 32000
   counts.  sfm/event_hdf5.py and minimateplus/event_file_io.py both
   divided by 32768 (2^15), scaling every sample and derived peak down by
   1 - 32000/32768.  The error scales with amplitude, so it was invisible
   on quiet events and worst on the loud ones that matter for compliance.
   Mic is unaffected (it back-solves its scale from the device peak).

   216 per-channel comparisons: 32768 -> 151/216 exact, worst error 0.238
   in/s on a 10 in/s event; 32000 -> 216/216 exact, worst 0.005 = 1 LSB.

2. walk_body silently truncated channels on four unhandled framing cases.
   An unrecognised tag ends the walk and decode_waveform_v2 returns
   whatever it got, so this surfaced as short channels, never an error:
     - wide-NN RLE `0X NN` (runs longer than 252 samples)
     - `30 NN` with NN > 0x10 (the old cap was arbitrary)
     - variable-width `40 NN` headers: NN counts previous-channel
       continuation deltas, so the header is 2*NN + 16 bytes; `40 01`
       and `40 03` occur alongside `40 02`
     - tagless segment headers: no `40 NN` tag at all, just the 14-byte
       tail [field2:2][len:2][channel_id:4][marker:2][anchors:4]

Also: the header field documented as a "monotonic uint32 LE counter" is
really [channel_id][00][00][segment_index], with 0x46=Tran 0x47=Vert
0x48=Long 0x49=MicL — verified on 1697/1697 segment headers, zero
disagreements.  decode_waveform_v2 now takes the channel from that field
instead of rotation position, which was fragile: one missed header
desynced every channel after it.

parse_segment_header now returns n_prev_deltas/prev_deltas/marker/
anchors/channel/segment_index; the old fixed_pattern (02 00 00 01)
conflated the 2-byte marker with the first anchor.

Ground-truth corpus, end to end through the production path:
  exact 37 -> 72, truncated 23 -> 3, full-length value errors 15 -> 0.
Store-wide, 729 of 1388 series-3 waveform events decode differently and
728 gain samples; the scale fix changes float values on all of them, so
stored .h5 files need regenerating.

Still open: 3 events truncate at a header variant with a variable-width
prefix (2/4/6 bytes) before the channel id and an `01 00` marker.
Documented in docs/instantel_protocol_reference.md with byte offsets.

+20 tests.  No regressions: the byte-exact fixture suite still passes and
the full-suite failure list is unchanged from baseline (16 pre-existing
failures from gitignored fixtures).

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01HgTe8CamXAHcAmaQ6QNcog
2026-08-25 08:11:11 +00:00
serversdown beca5de06e docs: clean up and verify s3 protocol docs 2026-05-20 17:55:02 +00:00