20 Commits
Author SHA1 Message Date
serversdown ab3bab764a Merge pull request 'Release v0.36.0 — Micromate events from the file alone, and three loose ends tied' (#61) from dev into main
Reviewed-on: #61
2026-12-03 16:07:22 -05:00
serversdownandClaude Opus 5.5 0d9eb518d2 chore(release): renumber to v0.36.0
Every release since v0.23.0 has been a minor bump, and this one takes the
bench tools and four scripts out of the image: v0.36.0, not v0.35.1.
Version strings only (CHANGELOG, README, CLAUDE.md, pyproject,
TOOL_VERSION); the content and the deploy steps are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-12-03 15:40:51 -05:00
serversdownandClaude Opus 5.5 a818f6a291 chore(release): v0.35.1 — Micromate events from the file alone, and three loose ends tied
CHANGELOG: Unreleased -> v0.35.1 (2026-12-03), with its theme and a
Migration: a Thor-only backfill (scripts/backfill_thor_events.py); do NOT
run backfill_sidecars.py (the Series-3 decode did not change).
pyproject, README, CLAUDE.md -> 0.35.1.  TOOL_VERSION -> 0.35.1: the Thor
codec changed (#44, #45), which gates backfill_thor_events' regeneration.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-12-03 15:29:44 -05:00
serversdownandClaude Opus 5.5 77fbeb5fe3 docs(changelog): Unreleased -- a MiniMate's settings read by position (#48)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-12-02 19:44:25 -05:00
serversdownandClaude Opus 5.5 e6b5dc4d7d merge: read a MiniMate's settings by position, not the 'anchor' (#48)
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-12-02 19:43:08 -05:00
serversdownandClaude Opus 5.5 71bd14156d fix(minimateplus): read a MiniMate's settings by position, not the 'anchor' (#48)
The legacy SUB 1A decode found the record mode, sample rate, histogram
interval and record time by searching for be 80 00 00 00 00, believed a
stable anchor.  It is the block's [12:18]: the pre-trigger (-0.25 s) and
the stop mode (Fixed).  A unit in Auto stop mode, or with another
pre-trigger, has no such bytes, and all four read None -- in connect()'s
legacy routes (/device/info without a serial, the legacy event download's
sample rate).  The serial-routed settings path already read by position.

The block is now found by its own length field N = 2090 (08 2a, at
unescaped[12] on every recorded reply) and read by position, Series IV's
0x1A layout.

It never struck: every DL2 event file's setup copy has stop mode Fixed,
70,041 / 70,041, and Blastware's reports agree (7,631 / 7,631).
Tested on recorded replies patched to Auto stop and to a -0.5 s
pre-trigger (8 new tests; the 7 existing ones unchanged); not yet on a
unit in Auto stop mode.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R9LdWawLzUxwewZGA1
2026-12-01 01:08:36 -05:00
serversdown eec88a62b8 Merge pull request 'Release v0.35.0 — 80 of 88 report fields from the file, and monitor logs (.MLG)' (#60) from dev into main
Reviewed-on: #60
2026-11-16 15:49:03 -05:00
serversdown 30bfdd6eff Merge pull request 'Release v0.34.0 — Series-4 parity, and most of Blastware's report from the event file alone' (#59) from dev into main
Reviewed-on: #59
2026-11-04 18:19:22 -05:00
serversdown fb14a8f7bb Merge pull request 'Release v0.33.0 — SFM reads Series-3 events from the file alone' (#56) from dev into main
Reviewed-on: #56
2026-11-01 14:33:00 -05:00
serversdown e9c01ce8d4 Merge pull request 'Release v0.32.0 — event times you can trust, and Series 4 mapped' (#54) from dev into main
Reviewed-on: #54
2026-10-27 11:00:59 -04:00
serversdown d2258dad4e Merge pull request 'Release v0.31.0 — report parity + the inverted rescue (0.29.0 → 0.31.0)' (#40) from dev into main
Reviewed-on: #40
2026-09-18 16:46:41 -04:00
serversdown e050e602c2 Merge pull request 'Release v0.29.0 — offset detector + false_trigger_reason + BlastMate serials (0.27.0→0.29.0)' (#36) from dev into main
Reviewed-on: #36
2026-09-07 15:57:37 -04:00
serversdown fc1c7c7936 Merge pull request 'Docs/claude.md corrections' (#35) from dev into main
Reviewed-on: #35
2026-08-29 15:48:33 -04:00
serversdown 7d0d12079b Merge pull request 'v0.27.0 Decoder fixes, offset exploration and testing.' (#34) from dev into main
Reviewed-on: #34
2026-08-28 22:40:34 -04:00
serversdown 5203aab849 Merge pull request 'update to 0.26.0. Big chonking update including 0.23, 0.24, and 0.25 as well.' (#33) from dev into main
Reviewed-on: #33
2026-08-27 13:43:00 -04:00
serversdown 5b65718b72 Merge pull request 'v0.23.0 - ZC freq in events store' (#31) from dev into main
Reviewed-on: #31
2026-08-06 12:12:19 -04:00
serversdown 483762607e Merge pull request 'Update to v0.22.0' (#30) from dev into main
Reviewed-on: #30
2026-07-03 15:35:20 -04:00
serversdown d0b66368d5 Merge pull request 'update to v0.21.1, thor data import successful' (#29) from dev into main
Reviewed-on: #29
2026-06-01 16:54:23 -04:00
serversdown 2eb1d25028 Merge pull request 'v0.20.0 -- Full s3 event parse and PDF creation.' (#28) from dev into main
Reviewed-on: #28
2026-05-28 17:54:31 -04:00
claude cc821f9ee3 hotfix: fix dockerfile on main to fix import bug on prod 2026-05-21 20:42:15 +00:00
8 changed files with 181 additions and 41 deletions

No files matched your search

+78 -1
View File
@@ -4,7 +4,26 @@ All notable changes to seismo-relay are documented here.
---
## Unreleased
## v0.36.0 — 2026-12-03
**Micromate events read from the file alone, and three loose ends tied.**
- **Micromate files (#44, #45).** SFM reads a Thor file's own settings, notes
and event time.
- Its own Micromate downloads no longer store a sample rate, pre-trigger and
record time of 0, blank notes, or a 1970 date.
- Every Micromate `.h5` now carries its pre-trigger. It had been 0, report or
not.
- **MiniMate settings (#48).** The legacy settings decode reads by position,
not by a "stable anchor" that was really two settings. It never struck: every
DL2 event was recorded in Fixed stop mode.
- **Housekeeping.**
- A fresh checkout passes the whole test suite on its own.
- The `bridges/` bench tools leave the production image.
⚠ **This release owes a Thor-only backfill (`scripts/backfill_thor_events.py`)
and no schema change.** Series-3 data is unchanged, so do **not** run
`backfill_sidecars.py`. See *Migration*.
### Changed
- **A fresh checkout passes the whole test suite on its own**
@@ -96,11 +115,69 @@ All notable changes to seismo-relay are documented here.
other fields are unchanged.
- No schema change, no migration. Prod's Micromate events all arrive with
a report, so only the `.h5` pre-trigger changes there.
- **A MiniMate's settings are read by position, not by the "stable anchor"
(#48; `fix/s3-settings-by-position`, merged 2026-12-02).**
- **The bug:** the legacy SUB 1A decode found the record mode, sample rate,
histogram interval and record time by searching for `be 80 00 00 00 00`.
Those bytes are the block's `[12:18]`, the pre-trigger (−0.25 s) and the
stop mode (Fixed), not a marker. A unit in Auto stop mode, or with another
pre-trigger, has no such bytes, and all four would read None.
- **Where that mattered:** `connect()`'s legacy routes, `/device/info`
without a serial and the legacy event download, which takes the event's
sample rate from it. The serial-routed settings read already read by
position.
- **Now:** the reply is unescaped and the block found by its own length field
N = 2090 (`08 2a`, at unescaped[12] on every recorded reply). The four are
read by position, Series IV's `0x1A` layout.
- **It never struck:** every DL2 event file's setup copy has stop mode Fixed,
70,041 / 70,041, and Blastware's reports agree (7,631 / 7,631).
- **Tests:** recorded replies patched to Auto stop and to a −0.5 s
pre-trigger now decode (8 new tests; the 7 existing ones are unchanged).
Not yet checked on a unit in Auto stop mode.
- Operational: none. It is a live-read fix, with no stored data, schema,
`TOOL_VERSION` or backfill involved.
### Protocol / Documentation
- **IDF reference, Signature A:** the event's settings record, time and notes,
measured; the `be 80…` search retracted. Thor writes `.MLG` files too (seen,
not examined).
- **Instantel reference and CLAUDE.md:** #48 resolved. The "stable anchor" notes
are retracted in place, and DL2's stop modes are counted.
### Migration
⚠ **A Thor-only backfill, no schema migration.** Not rehearsed on a prod
snapshot.
**Before you start:**
- `TOOL_VERSION` is bumped to **0.36.0**, which gates the Thor regeneration, so
no `--force` is needed.
- **Back up `seismo_relay.db` first.**
**Then:**
1. **Deploy.** No table changes.
- The image no longer holds the `bridges/` code.
- The database volume is mounted at `/app/bridges/captures` as before. SFM
and the scripts find it there by default.
2. **In the `sfm` container, run `python scripts/backfill_thor_events.py
--dry-run`**, then the same without `--dry-run`.
- The dry run shows how many Thor events will be refreshed.
- The real run rewrites each Thor event's sidecar and `.h5`. Each `.h5`
gains its pre-trigger in samples (it was 0). Report-paired events take it
from the report's value, rounded to 0.01 s.
- Their samples, peaks and times do not change.
3. ⚠ **Do not run `backfill_sidecars.py` or `backfill_event_shape.py`.**
- The Series-3 decode did not change.
- The `TOOL_VERSION` bump would make `backfill_sidecars.py` regenerate every
Series-3 event (about 8 hours) for nothing.
- The Thor samples, which the shape metrics come from, are unchanged.
**Terra-View** needs no change. One thing it shows moves: a Micromate
waveform chart's time axis.
- SFM's plot data starts the axis at minus the pre-trigger
(`event_hdf5.plot_json_from_hdf5`, `t0_ms = -pretrig_samples × dt`).
- With the stored 0, time 0 was the first sample. After the backfill, time 0 is
the trigger, as on MiniMate charts.
## v0.35.0 — 2026-11-16
+12 -3
View File
@@ -2,7 +2,7 @@
Ground-up Python replacement for **Blastware**, Instantel's Windows-only software for
managing MiniMate Plus seismographs. Connects over direct RS-232 or cellular modem
(Sierra Wireless RV50 / RV55). Current version: **v0.35.0**.
(Sierra Wireless RV50 / RV55). Current version: **v0.36.0**.
Stack-level context — which repo owns what, and how the three project versions
pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
@@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
---
## Where things stand (updated 2026-11-16)
## Where things stand (updated 2026-12-03)
Read this first when picking the project back up.
@@ -225,6 +225,9 @@ Read this first when picking the project back up.
are re-rendered by keypad saves and are not identifiers.
⚠ **`0x1A` reads the keypad's edit buffer live** — unsaved values show while
someone is in the menu; a discard reverts them.
✅ **Fixed 2026-12-01 (#48):** the legacy decode now finds the block by its
length field N = 2090 and reads by position; no DL2 event was ever recorded in
Auto stop mode (70,041 / 70,041 Fixed). Kept below as history:
🔶 **Possible Series III bug, inferred only:** S3's 6-byte "stable anchor"
`be 80 00 00 00 00` sits exactly where Series IV keeps pre-trigger (−0.25 s)
+ stop mode (Fixed). An S3 unit in Auto stop mode would then lose the
@@ -1660,6 +1663,12 @@ frame D's channel block (trigger_level_geo, alarm_level_geo, max_range_geo) unre
producing only ~1071 bytes instead of ~2126.
### SUB 1A — anchor search range
> ⚠ **RETRACTED 2026-12-01 (#48):** there is no stable anchor. `be 80 00 00 00 00`
> is the block's `[12:18]`: the pre-trigger (−0.25 s) and the stop mode (Fixed).
> `_decode_compliance_config_into()` now unescapes the reply, finds the block by
> its length field N = 2090 (`08 2a`, at unescaped[12]) and reads mode `[5]`,
> rate `[6:8]`, interval `[8:10]` and record time `[18:22]` by position. The text
> below is history.
`_decode_compliance_config_into()` locates fields via the **6-byte stable anchor**
`b'\xbe\x80\x00\x00\x00\x00'`. Search range is `cfg[0:150]`.
@@ -1731,7 +1740,7 @@ Do NOT use fixed absolute offsets for sample_rate or record_time.
| setup_name | ASCII, null-padded, in cfg body |
| project / client / operator / sensor_location | ASCII, label-value pairs |
**True stable anchor: `b'\xbe\x80\x00\x00\x00\x00'` (6-byte suffix), search `cfg[0:150]`.**
**True stable anchor: `b'\xbe\x80\x00\x00\x00\x00'` (6-byte suffix), search `cfg[0:150]`.** (⚠ Retracted 2026-12-01, #48: not a constant; see "SUB 1A — anchor search range".)
The old "10-byte anchor" `b'\x01\x2c\x00\x00\xbe\x80\x00\x00\x00\x00'` is partially variable:
bytes `\x01\x2c` = 300 (5-minute default histogram interval); changes when interval changes.
+9 -1
View File
@@ -1,4 +1,4 @@
# seismo-relay `v0.35.0`
# seismo-relay `v0.36.0`
A ground-up replacement for **Blastware** — Instantel's aging Windows-only
software for managing seismographs. Supports both the **MiniMate Plus
@@ -127,6 +127,14 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55).
>
> ⚠ The deploy owes a backfill (about 8 hours on the NAS) and creates two
> empty tables. See the changelog's *Migration*.
>
> **v0.36.0 (2026-12-03)** reads Micromate events from the file alone (#44,
> #45): their settings, notes, time and pre-trigger. It also reads a MiniMate's
> settings by position (#48), lets a fresh checkout pass the whole test suite,
> and takes the `bridges/` bench tools out of the production image.
>
> ⚠ The deploy owes a Thor-only backfill (`scripts/backfill_thor_events.py`).
> Do not run `backfill_sidecars.py` this time. See the changelog's *Migration*.
> See [CHANGELOG.md](CHANGELOG.md) for full version history.
---
+1
View File
@@ -11,6 +11,7 @@
| Date | Section | Change |
|---|---|---|
| 2026-12-01 | §7.6.1, SUB 1A (legacy decode) | ✅ **#48 fixed: the settings are read by position, not by the "stable anchor".** `_decode_compliance_config_into` unescapes the 1A reply, finds the block by its own length field N = 2090 (`08 2a`, at unescaped[12] on all 4 recorded replies), and reads mode `[5]`, sample rate `[6:8]`, histogram interval `[8:10]` and record time `[18:22]` by position: Series IV's `0x1A` layout, as the 2026-11-03 (5) row measured. The anchor `be 80 00 00 00 00` was `[12:18]`, the pre-trigger and the stop mode, so a unit in Auto stop mode would have read all four as None. **How often it could strike (measured 2026-12-01):** every DL2 event file's setup copy has stop mode Fixed, 70,041 / 70,041 (63,500 histograms, 6,541 waveforms), and Blastware's reports agree (7,631 / 7,631 `RecordStopMode` Fixed). Tested on recorded replies patched to Auto stop and to a −0.5 s pre-trigger (`tests/test_s3_compliance_anchor_fields.py`); not yet on a unit in Auto stop. Resolves the 2026-10-17 row below. |
| 2026-11-13 | Appendix D.4 (rewritten), D.4.1–D.4.4 | ✅ **The `.MLG` format, measured.** An 18-byte prefix, then 292-byte records `[length 290 LE][id 0e a0 header / 0e 80 log][…][00 00][CRC]`. The CRC is **CRC-16/AUG-CCITT over `[0:288]`, little-endian** (3,329 / 3,329 records, 1,282 files). Fields: times with the year LE, the monitor-log flag word and trigger source LE, the serial, Blastware's text. Also: one file per call-in, how sessions appear, and a Modem Exit that is not a file's last record was a call that left no file. Cross-checked against DL2 event footers: 785 / 785 for BE8081. The old D.4.1–D.4.3 (308-byte header, CRC at the start) are kept, marked retracted. Reader/writer `minimateplus/mlg_file.py`. |
| 2026-11-11 | Appendix D.3.3 | ✅ **The footer's last two bytes are a CRC-16/AUG-CCITT** (init `0x1D0F`), big-endian, over the footer record from its length prefix `00 1a` through footer `[0:22]`: 70,041 / 70,041 DL2 files. Found by the `.MLG` session, verified here. Retracts 2026-11-08's "no common CRC-16 fits": every attempt had started at the footer itself. Same CRC family as the Series IV `0x1A` block's and the `.MLG` record's. |
| 2026-11-09 | Appendix D.6.15 (NEW), D.6.6, D.6.11 | ✅ **Over range and the mic.** **D.6.15:** a peak past full scale (2,000 units = 32,000 counts; the mic in counts) is Blastware's `OORANGE`, per channel and per histogram interval, from the unit's own summary peaks. The vector sum is `OORANGE` exactly when a geophone is (43 / 43); never on its own (38 / 38 numeric), which retracts D.6.11's open "vector sum alone" case. The `<OORANGE>` line marks the mic over (18 / 18). **D.6.6:** the mic has its own range byte (label + 29): at 1 a count is an eighth, 7 DL2 events SFM read 8× high. The dB offset is **81.938216**: [81.9383, 81.9385] was too high, and every count Blastware printed leaves [81.9382058, 81.9382266]. Blastware's mic unit labels do not hold on every report; some mix dB and psi in one column. **80 of 88 report fields now match on every DL2 event.** |
+43 -34
View File
@@ -55,6 +55,7 @@ from .protocol import (
SUB_WRITE_CONFIRM_C,
SUB_TRIGGER_CONFIRM,
SUB_MONITOR_STATUS,
COMPLIANCE_CONTENT_LEN,
)
from .transport import SerialTransport, BaseTransport
@@ -2012,6 +2013,9 @@ def _extract_project_strings(data: bytes) -> Optional[ProjectInfo]:
)
# The settings block starts with its own length N = 2090, uint16 BE (#48).
_SETTINGS_BLOCK_HEAD = COMPLIANCE_CONTENT_LEN.to_bytes(2, "big") # 08 2a
_SETTINGS_BLOCK_SEARCH = 40 # found at unescaped[12] on every recorded reply
def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
@@ -2023,20 +2027,20 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
Confirmed field locations (BE11529 with 3-step read, duplicate detection):
- cfg[89] = setup_name: first long ASCII string in cfg[40:250] ✅
- ANCHOR = b'\\xbe\\x80\\x00\\x00\\x00\\x00' in cfg[0:150] ✅ (revised 2026-04-07)
- anchor - 6 = sample_rate uint16_BE (1024 normal / 2048 fast / 4096 faster)
- anchor + 6 = record_time float32_BE
- the settings block, found by its length field N = 2090 (`08 2a`) after
unescaping, read by position (#48, 2026-12-01; see the comment in the body):
mode [5], sample rate [6:8], histogram interval [8:10], record time [18:22]
- "Project:" needle → project string
- "Client:" needle → client string
- "User Name:" needle → operator string
- "Seis Loc:" needle → sensor_location string
- "Extended Notes" needle → notes string
Anchor approach is required because a DLE byte in the sample_rate field
(4096 = 0x1000 → stored as 10 10 00 in raw S3 frame → unstuffed to 10 00,
1 byte shorter than 04 00 or 08 00) causes frame C to be 1 byte shorter
for "faster" mode, shifting all subsequent offsets by 1. The 10-byte
anchor is stable across all modes.
⚠ Retracted 2026-12-01 (#48): the mode, rate, interval and record time were
found by the "anchor" `be 80 00 00 00 00`, thought stable across all modes.
It is the pre-trigger and the stop mode, so it is absent in Auto stop mode.
Escapes are removed first (unescape_reply), so an escaped byte no longer
shifts the positions.
Channel block layout (✅ confirmed 2026-04-02 from 3-11-26 E5 frame 78
and 1-2-26 A5 frame 77):
@@ -2076,47 +2080,52 @@ def _decode_compliance_config_into(data: bytes, info: DeviceInfo) -> None:
# mode, sample rate or interval moves every field after it by one. BE9441 at
# Histogram / 4096 sps / 2 s read 0 sps and a 4098 s interval (2026-10-29).
#
# Layout after unescaping, measured on every recorded reply (four settings,
# two of them Blastware's own writes -- tests/test_s3_compliance_anchor_fields.py):
# _anchor - 7 : recording_mode (uint8)
# _anchor - 6 : sample_rate (uint16 BE)
# _anchor - 4 : histogram_interval_sec (uint16 BE, seconds)
# _anchor - 2 : 0x00 0x00 (padding)
# _anchor : \xbe\x80\x00\x00\x00\x00
# _anchor + 6 : record_time (float32 BE)
# The block is the settings block Series 4's 0x1A shares (reference D.6.2,
# micromate/setup_block.py), found by its own length field N = 2090 (`08 2a`)
# and read by position -- at unescaped[12] on every recorded reply:
# [5] recording_mode (uint8)
# [6:8] sample_rate (uint16 BE)
# [8:10] histogram_interval_sec (uint16 BE, seconds)
# [12:16] pre-trigger (float32 BE, negative seconds)
# [17] stop mode (0 Fixed)
# [18:22] record_time (float32 BE)
# ⚠ RETRACTED 2026-12-01 (#48): these were found by the "stable anchor"
# `be 80 00 00 00 00`, which is [12:18] -- the pre-trigger (-0.25 s) and the
# stop mode (Fixed), not a marker. A unit in Auto stop mode, or with another
# pre-trigger, has no such bytes, and all four fields read None. No DL2 event
# was recorded in Auto (70,041 / 70,041 Fixed), so it never struck.
# ⚠ The old raw layout's "anchor - 7 = constant 0x10" was the escape in front
# of `04` at 1024 sps (0x0400); it read right only at that rate.
# Everything below this block (channel block, strings) still reads the RAW
# bytes: its label-relative offsets were measured on them and are wrong
# unescaped. A reply with no anchor (BE9441 answered 1A with its device-info
# block while monitoring, 2026-10-29) leaves all four fields None.
_ANCHOR = b'\xbe\x80\x00\x00\x00\x00'
# unescaped. A reply with no settings block (BE9441 answered 1A with its
# device-info block while monitoring, 2026-10-29) leaves all four fields None.
logical = unescape_reply(data)
_anchor = logical.find(_ANCHOR, 0, 150)
_block = logical.find(_SETTINGS_BLOCK_HEAD, 0, _SETTINGS_BLOCK_SEARCH)
if _anchor < 0:
if _block < 0:
log.warning(
"compliance_config: anchor %s not found in cfg[0:150] (len=%d) "
"compliance_config: no settings block (N = 2090) in cfg[0:%d] (len=%d) "
"— sample_rate, record_time and recording_mode will be None",
_ANCHOR.hex(), len(data),
_SETTINGS_BLOCK_SEARCH, len(data),
)
elif _anchor >= 7 and _anchor + 10 <= len(logical):
log.info("_decode_compliance_config_into: anchor at unescaped[%d] data_len=%d",
_anchor, len(data))
config.recording_mode = logical[_anchor - 7]
config.sample_rate = struct.unpack_from(">H", logical, _anchor - 6)[0]
config.histogram_interval_sec = struct.unpack_from(">H", logical, _anchor - 4)[0]
config.record_time = struct.unpack_from(">f", logical, _anchor + 6)[0]
elif _block + 22 <= len(logical):
log.info("_decode_compliance_config_into: settings block at unescaped[%d] data_len=%d",
_block, len(data))
config.recording_mode = logical[_block + 5]
config.sample_rate = struct.unpack_from(">H", logical, _block + 6)[0]
config.histogram_interval_sec = struct.unpack_from(">H", logical, _block + 8)[0]
config.record_time = struct.unpack_from(">f", logical, _block + 18)[0]
log.debug(
"compliance_config: recording_mode=0x%02X sample_rate=%d histogram_interval=%d s "
"record_time=%.3f s (anchor@%d unescaped)",
"record_time=%.3f s (block@%d unescaped)",
config.recording_mode, config.sample_rate, config.histogram_interval_sec,
config.record_time, _anchor,
config.record_time, _block,
)
else:
log.warning("compliance_config: anchor at unescaped[%d] is too close to an end "
log.warning("compliance_config: settings block at unescaped[%d] is too close to the end "
"(len=%d) — mode, rate, interval and record time left None",
_anchor, len(logical))
_block, len(logical))
# ── Project strings ───────────────────────────────────────────────────────
try:
+1 -1
View File
@@ -54,7 +54,7 @@ SIDECAR_KIND = "sfm.event"
# bumped without a `pip install` re-run — leading to confusing stale
# version stamps in sidecars. Bump this constant and CHANGELOG.md
# together at release time.
TOOL_VERSION = "0.35.0" # file-only decode groups D2, E, F, over range, mic range; gates the backfill regen
TOOL_VERSION = "0.36.0" # Thor file settings, notes, time and pretrig_samples (#44, #45); gates the backfill regen
try:
# Best-effort: prefer the installed metadata when it's NEWER than the
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "seismo-relay"
version = "0.35.0"
version = "0.36.0"
description = "Python client and REST server for MiniMate Plus seismographs"
requires-python = ">=3.10"
dependencies = [
+36
View File
@@ -98,3 +98,39 @@ def test_a_reply_without_the_settings_block_reads_as_unknown():
# The write side moved to the shared settings codec in phase 5 (2026-11-03):
# tests/test_setup_fields.py reproduces every Blastware write byte for byte.
# ── #48: the "anchor" is two settings, not a marker ───────────────────────────
# `be 80 00 00 00 00` is the block's [12:18]: the pre-trigger (-0.25 s, f32 BE)
# then [16] and the stop mode [17] (0 = Fixed). A unit in Auto stop mode, or
# with another pre-trigger, has no such bytes. The block is found instead by its
# own length field N = 2090 (`08 2a`), and its fields read by position: the layout
# Series 4's 0x1A shares (reference D.6.2; setup_block.py). No DL2 event was
# recorded in Auto stop mode (70,041 / 70,041 Fixed, measured 2026-12-01), so this
# tests a reply patched from a real one.
import struct # noqa: E402
def _patched(i, at, new):
"""Reply i with the anchor's bytes [at:at+len(new)] replaced. The anchor holds
no 02/03/04, so the raw bytes can be patched in place."""
d = bytearray(_settings_replies()[i])
a = bytes(d).find(ANCHOR)
assert a >= 0
d[a + at:a + at + len(new)] = new
return bytes(d)
@pytest.mark.parametrize("i", range(4))
def test_auto_stop_mode_still_reads_the_settings(i):
cc = _decode(_patched(i, 5, b"\x01")) # [17] stop mode = Auto
got = (cc.recording_mode, cc.sample_rate, cc.histogram_interval_sec, round(cc.record_time, 2))
assert got == EXPECT[i]
@pytest.mark.parametrize("i", range(4))
def test_another_pretrigger_still_reads_the_settings(i):
cc = _decode(_patched(i, 0, struct.pack(">f", -0.5))) # [12:16] pre-trigger
got = (cc.recording_mode, cc.sample_rate, cc.histogram_interval_sec, round(cc.record_time, 2))
assert got == EXPECT[i]