13 Commits
Author SHA1 Message Date
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
30 changed files with 54 additions and 19814 deletions

No files matched your search

-133
View File
@@ -4,139 +4,6 @@ All notable changes to seismo-relay are documented here.
---
## Unreleased
### Added
- **ZC frequency, peak displacement and times of peak come from the unit's own
event summary** (group D, part 2 of the file-only decode;
`feat/waveform-zc-displacement`, merged 2026-11-06). Measured on DL2
2026-11-05.
- **Where they are:** every event file carries the unit's per-channel
summary right after its embedded event record. It is a chain of
`[length][id][payload]` records, ids `0x32`–`0x35`, each holding min, max,
peak sample, half-period and a displacement integral (reference D.6.12).
Blastware prints these values as they are.
- **ZC frequency** = (rate / 2) / half-period, on every record type. It
matches 25,966 / 25,966 waveform and 253,958 / 253,958 histogram channel
values, including the words (">100", "N/A", "<1.0"). Above range the value
is Blastware's threshold, flagged, as when it comes from a report.
- **Peak displacement** = half the integral (new
`PeakValues.*_peak_disp_in`): 19,479 / 19,479.
- **Times of peak and the vector-sum time** now come from the unit's peak
samples. They differ from the samples' own only on O117I1NK.R70W, whose
stored samples wrap at the trigger. Blastware's own sample table has the
same wrapped values.
- **Why recomputing failed:** from the samples, ZC frequency had matched 46%
and displacement 84%. The unit computes them at full resolution.
- **Peak acceleration** stays Blastware's own computation from the samples.
The unit stores its own largest step too (`[15:21]`, inferred), and
Blastware ignores it.
- **Decode checker:** 59 of 88 fields now match on every DL2 event, 47 before
group D (run `20261105-140021`, 0 regressions). Still open: O117I1NK's three
accelerations and S353I5PZ.EP0W's Vert acceleration.
- ⚠ **Operational:** codec change.
- The next release bumps `TOOL_VERSION`, then runs `backfill_sidecars.py`
and `backfill_event_shape.py`: about 8 h on the NAS (v0.34.0's took
13:13 → 21:16 on 2026-11-05).
- No schema change, no migration, and no stored time moves.
- **Report-less events gain a ZC frequency** in the existing `*_zc_freq` /
`*_zc_above_range` columns, so Terra-View shows a frequency where it
showed "—".
- Report-paired events keep the report's values, which are equal. A
report's "<1.0" still overlays as no value until the overlay is retired.
- Displacement and times of peak are not stored in the DB or `.h5` yet.
- **Sensor check results come from the unit's own records** (group E of the
file-only decode; `feat/sensor-check-results`, merged 2026-11-07). Measured
on DL2 2026-11-06.
- **Where they are:** the header of each sensor-check record (`0x3c` Tran ..
`0x3f` MicL), whose traces `minimateplus/sensor_check.py` already decoded
(reference D.6.13).
- **What it holds:** channel type, status, frequency × 10, ratio × 10 and
amplitude in mV.
- **Blastware prints them as they are:**
- 209,943 / 209,943 geophone frequencies and ratios
- 69,975 / 69,975 mic frequencies and amplitudes
- the result: "Passed" at status 0, "Check" at any other, "Disabled"
when the check is off
- **"Check" is the unit's own verdict.** K559L6N1's Tran is a Check at
8.1 Hz and 3.3, inside every passing range. SFM keeps the status code; its
bits are not decoded.
- New `Event.sensor_check_results`: channel → `SensorCheckResult`, with
`result`, `status`, `freq_hz`, `ratio` and `amplitude_mv`.
- **The tail of every event file is one record chain:** event record →
unit's summary → sensor checks → footer. It ends exactly at the file's end
on all 70,041 DL2 files.
- SFM now reads none of it unless it does.
- An unknown id inside an intact chain leaves only that record unread.
Before, it left everything after it unread too.
- **Decode checker:** 71 of 88 fields now match on every DL2 event, 59
before (run `20261106-125854`, 0 regressions). All 12 sensor-check fields
match on every event that has them.
- ⚠ **Operational:** codec change.
- Rides the next release's `TOOL_VERSION` bump and backfill with group D
part 2.
- No schema change and no migration.
- The results are on the decoded event only. They are not stored in the
DB, sidecar or `.h5` yet. Report-paired events keep the report's values
in the sidecar.
- **The Monitor Log line comes from the file's footer** (group F;
`feat/monitor-log`, merged 2026-11-09). Measured on DL2 2026-11-08.
- Blastware prints one line per event: the footer's start and stop, then
words for the footer's flag word `[18:20]` (reference D.6.14).
- The words: Event Recorded, then how the session ended — Keyboard, Remote
or Modem Exit, Timer Stop, Selfcheck Passed, Battery Low or Memory Full
Exit.
- Rebuilt that way it equals Blastware's line character for character on
69,983 / 69,983 DL2 lines.
- One line sets two session-end bits and prints the higher, so the order
of the others is inferred.
- Footer `[20:22]` is the trigger source again. `[24:26]` is still unknown.
- New `Event.monitor_log`: `MonitorLogLine(start, stop, flags,
description)`. It is read only when the record chain is whole, which
proves the footer.
- **Decode checker:** 72 of 88 fields now match on every DL2 event, 71
before (run `20261108-034313`, 0 regressions).
- ⚠ **Operational:** codec change. It rides the next release's
`TOOL_VERSION` bump and backfill. No schema change. The line is on the
decoded event only: not stored in the DB, sidecar or `.h5` yet.
### Fixed
- **A unit without a mic keeps its sensor-check traces.** The trace decoder
required all four records `0x3c`–`0x3f`, so BE16352 (no `0x3f`) had none in
its `.h5`: all 8 of its DL2 events. Its three geophone traces are now decoded.
- ⚠ Operational: they appear after the next release's backfill.
- **The decode checker reads the mic's above-range ZC flag under its real name**
(`mic_zc_above_range`). A mic ">100" could never match before.
### Protocol / Documentation
- **Reference D.6.12 (new):**
- the unit's event summary: its layout, and what Blastware prints from it
- why recomputing failed
- the two odd 2019 files
- group D part 1 (time of peak, acceleration with the fitted g),
documented there too
- **Reference §7.8.9:** its "constant, meaning ❓" bytes amended in place. They
are the vector-sum peak's sample, then the next record's lead.
- **Reference D.6.11 and CLAUDE.md:** the 59 / 88 status. Leads for E: records
`0x3c` / `0x3d`, probably the sensor check. Leads for F: a waveform's
monitor log may be its event record's start and stop.
- **Reference D.2 and D.4.2, corrected in place:** an `.MLG` stores its dates
little-endian, and its record flags are the event footer's flag word and
trigger source, little-endian. Measured on the 4 bench `.MLG` files; a
BE9441 session lines up 20 / 20 with its event files. `write_mlg()` writes
dates big-endian; nothing calls it.
- **Reference D.6.14 (new):** the monitor log. **D.3.3:** footer `[18:24]`
identified: flags, trigger source and zero.
- **Reference D.6.13 (new):**
- the record chain to the footer
- the sensor-check header and what Blastware prints from it
- **Reference D.3.3:** the footer is the chain's last record (`00 1a`, id `0e`).
- **Reference D.6.12:** its "`0x3c` / `0x3d`, before and after" retracted in
place. It is one record per channel.
- **Reference D.6, "Reading a mismatch":** 256, 4,096 and 65,536 mean a number
outgrew its 8-, 12- or 16-bit box. Every case so far is listed (Brian's
observation, 2026-11-05).
## v0.34.0 — 2026-11-04
**SFM reaches Series-4 parity, and reads most of Blastware's report from the
+9 -35
View File
@@ -10,7 +10,7 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
---
## Where things stand (updated 2026-11-05)
## Where things stand (updated 2026-11-03)
Read this first when picking the project back up.
@@ -45,14 +45,10 @@ 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-08, run `20261108-034313`):
**72 of 88 fields match on every event**, up from about 6 before v0.33.0,
47 before group D and 59 after it.
- Groups A, B, C and D part 1 shipped in v0.34.0 (#50, #51).
- D part 2 (the unit's own summary), E (the sensor check) and F (the
monitor log) are on `dev` and owe the next release a backfill.
- Still open: the mic stragglers, the `OORANGE` tag (18 events), the PPV /
vector-sum `OORANGE` carve-out, 4 accelerations.
**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
@@ -70,26 +66,6 @@ Read this first when picking the project back up.
- 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
- group D (D.6.12): ZC frequency on every record type, peak displacement,
times of peak and the vector-sum time.
- These are **the unit's own values**, stored in the file right after
the event record. Blastware prints them; recomputing from the samples
reached only 46% and 84%.
- Peak acceleration is Blastware's own computation from the samples
(fitted g 386.2238): 6,522–6,523 / 6,524. The unit stores its own
too, which Blastware ignores. The misses are O117I1NK.R70W, whose
samples wrap at the trigger, and S353I5PZ.EP0W Vert (open).
- group E (D.6.13): sensor check frequency, ratio, mic amplitude and
result, every record type. Also the unit's own, in each sensor-check
record's header. "Check" is the unit's status code, not a limit SFM can
recompute.
- group F (D.6.14): the Monitor Log line. It is the footer's start and
stop plus words from the footer's flag word (Modem Exit, Timer Stop,
Keyboard Exit…), character for character on 69,983 / 69,983.
- 🔑 **The tail of every event file is one record chain** (D.6.13):
event record → unit summary → sensor checks → footer, each
`[length][id][payload]`. It ends exactly at the file's end on all 70,041
DL2 files, and SFM reads none of it otherwise.
- 🔑 **"Units" means three different things — keep them apart** (reference
D.6.6):
- **Recorded data:** the mic samples and interval peaks in the file, as
@@ -124,12 +100,10 @@ Read this first when picking the project back up.
- ~~**B. Histogram interval detail**~~ ✅ done on `dev`. Frequencies (#50),
per-interval PVS, interval size, stop.
- ~~**C. #51 timing**~~ ✅ done on `dev`.
- ~~**D. Blastware's waveform calculations**~~ ✅ done. ZC frequency,
displacement and time of peak are the unit's own (D.6.12); acceleration
is Blastware's.
- ~~**E. Sensor check results**~~ ✅ done (D.6.13). Plus the traces of a
unit without a mic, which the trace decoder had been dropping.
- ~~**F. Monitor log**~~ ✅ done (D.6.14): in the footer after all.
- **D. Blastware's waveform calculations:** ZC frequency, acceleration,
displacement, time of peak.
- **E. Sensor check results.**
- **F. Monitor log:** probably not in the event file at all.
- 🔶 **#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 setting: 253–256 samples at
+6 -225
View File
@@ -11,9 +11,6 @@
| Date | Section | Change |
|---|---|---|
| 2026-11-08 | Appendix D.6.14 (NEW), D.3.3, D.6.11 | ✅ **The monitor log is in the footer.** Every DL2 report prints one Monitor Log line: the footer's ts1 and ts2, then words for the footer's flag word `[18:20]` (`0x0001` Event Recorded, `0x0002` Keyboard Exit, `0x0004` Remote Exit, `0x0008` Selfcheck Passed, `0x0010` Timer Stop, `0x0020` Modem Exit, `0x0200` Battery Low Exit, `0x0800` Memory Full Exit; the higher session-end bit wins, from one file). Rebuilt, it equals Blastware's character for character on 69,983 / 69,983. **D.3.3:** footer `[20:22]` is the trigger source again, `[22:24]` is zero; `[24:26]` still unknown, and no common CRC-16 or sum fits. **72 of 88 report fields now match on every DL2 event.** |
| 2026-11-06 | Appendix D.6.13 (NEW), D.3.3, D.6.11, D.6.12 | ✅ **The record chain to the footer, and the sensor check.** Walked from the event record, the chain (event `0x05` → unit's summary `0x32`–`0x35` → sensor checks `0x3c`–`0x3f` → footer `0x0e`) ends exactly at the file's end on all 70,041 DL2 files. The footer is its last record: `00 1a` is its length, `0e` its id. **Each sensor-check record's header holds the unit's results:** channel type `[2]`, status `[4]` (0 = passed), frequency × 10 `[5:7]`, ratio × 10 `[7:9]` and amplitude mV `[9:11]`. Blastware prints them as they are: 209,943 / 209,943 geophone frequencies and ratios, 69,975 / 69,975 mic frequencies and amplitudes. The result is Passed / Check / Disabled by status and type. The status is the unit's own verdict, its bits not decoded. D.6.12's "`0x3c` / `0x3d`, before and after" retracted in place: one record per channel. **71 of 88 report fields now match on every DL2 event.** |
| 2026-11-05 | Appendix D.6.12 (NEW), D.6.11, §7.8.9 | ✅ **The unit's own event summary, in every event file.** The embedded event record is the first of a `[length][id][payload]` chain. It holds the vector-sum peak's sample (6,492 / 6,493). Then one 22-byte record per channel, ids `0x32` Tran … `0x35` MicL: min, max, peak sample, **half-period** and a **displacement integral**. Blastware prints them as they are. **ZC frequency** = (rate / 2) / half-period, with the interval rule's words: 25,966 / 25,966 waveform and 253,958 / 253,958 histogram channel values. **Peak displacement** = half the integral: 19,479 / 19,479. Recomputing from the samples had reached 46% and 84%: the unit works at full resolution. **Times of peak** follow the unit's peak sample. That differs from the samples only on **O117I1NK.R70W**, whose stored samples wrap at the trigger by 65,536 counts (Blastware's own table has the same values). Peak acceleration is Blastware's own computation from the stored samples (group D part 1, documented here too). The unit stores its own largest step at `[15:21]` (inferred), which Blastware does not print. §7.8.9's "constant, meaning ❓" bytes amended in place. 59 of 88 report fields now match on every DL2 event (47 before group D). |
| 2026-11-04 | SUB 1A / 09 reads, SUB 68–74 settings write, the keypad | **SFM's settings write, benched on BE9441 (Brian at the unit; ~12 writes, each with his go).** **Every write** -- trigger 0.04 ↔ 0.05, a note, several fields at once (Project, job number + its report flag, trigger), the alarm 1.0 ↔ 1.5, and a full restore -- was acknowledged on all nine steps (`97 8C 8E×5 8D 7D 7C 96 8B 8D`), read back as sent, and **confirmed on the unit's own screen**; the unit ended byte for byte as found. Moved bytes were exactly the field's: trigger f32 at each geophone channel +30 (`+31..+33` moved), **alarm f32 at channel +38** (`+39` moved; the first Series-3 alarm write), job number `[40:42]`, its report bit `[39]` `0x02`, a note's value window. **`[26:28]`** went `01 7f` → `00 00` on SFM's first write (Blastware's value) and the unit **set `01 7f` again during the next monitoring session**. The **two bytes after the block** went out as `00 00` (Blastware sends a per-unit constant) and were taken. **🔑 Escaped-checksum artifact:** when a reply's checksum byte is itself escaped (02 / 03 / 04, ~1 frame in 85), `S3FrameParser` keeps the escape's `0x10` and strips only the byte after it, so the frame's data gains one trailing `0x10`. It hit the first live 1A read (frame B 1,026 bytes after the header); the 12 recorded reads never had. SFM's settings read and waveform read now take exactly the length they asked for. **🔑 The keypad menu wins:** a write sent while the setup menu was open was acknowledged and read back, then **lost when the operator pressed Cancel or Save** -- the menu writes its own copy of the **whole** block back (both times the block returned byte for byte to its state when the menu was opened). A keypad Cancel with nothing pending leaves the block unchanged. **While monitoring**, the 1A read returns the device-info block (SFM refuses, nothing sent), and the opening poll was answered only intermittently (2 of 3 attempts timed out). Code: `minimateplus.protocol.read_compliance_content` / `read_waveform_data_raw`, `micromate.setup_fields`; notes `~/bench-logs/2026-11-04-sfm-settings/`. |
| 2026-11-03 (5) | SUB 1A / 71 / 69 (settings read and write) | **The settings block, read and written as content (measured, BE9441's 10-26 recording and BE11529's 2026-04-20 captures).** **Read:** unescape each 1A data frame and take `data[11:]`; every frame but the last starts with one `00` that is not content; dropped, the frames join into **2,090 bytes headed by N = 2090: Series IV's `0x1A` content layout** (12 / 12 reads, Blastware's 4 × 512 + 42 and SFM's 1024 + 1024 + 42). The old "stable anchor" `be 80 00 00 00 00` is content `[12:18]` (pre-trigger −0.25 + stop mode Fixed). **Round trip:** the read after each of Blastware's two 10-26 writes equals the image it had just written, all 2,090 bytes (2 / 2). While monitoring, the read returns the device-info block (`0e 'BE9441' …`, 5 / 5). **`[26:28]`:** Blastware writes `00 00` on all 11 writes; the unit reads `01 7f` after a monitoring session (BE9441 10-26, BE11529 4-20 15:19) and sets it by itself; meaning unknown. **The two bytes after the block** (`[2090:2092]` of the 0x71 image) are Blastware's own per-unit constant -- `7c ea` on all nine of BE11529's writes, `0c e9` on both of BE9441's -- not the block's CRC-16/AUG, and in no reply of BE9441's three-hour session; SFM sends `00 00`. **`0x09` `[200:202]`:** Blastware echoed the unit's `8c 76` on all nine April writes; on 10-26 it read `17 17` and wrote `78 76` (read back so); meaning unknown. **Blastware re-renders the mic trigger level:** on BE11529's first write (4-20 15:19) the unit read 0.005 and 0.01 psi in its two `MicL` channel blocks (3 and 7; Series 3 carries 8 channel blocks of 48 bytes from `[1708]`, the second four prefixed `0x32`) and Blastware wrote 0.004983 and 0.010058 -- the same levels to its 0.1 dB; every other write left them alone. **Every one of the 11 Blastware writes reproduces** from the block before it with only the fields Blastware changed (plus that re-render and, on 10-26, the mic bit of `[25]`). Code: `minimateplus.protocol.assemble_compliance_content`, `read_compliance_content`, `micromate.setup_fields`; tests `tests/test_s3_settings_read.py`, `tests/test_setup_fields.py`. |
| 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. |
@@ -2280,13 +2277,6 @@ labels "unknown", after the notes and channel blocks.
| `[M+10:M+18]` | **stop**, same format | = the footer's `ts2` on 7,836; one second before it on 99 ✅ |
| `[M+18:M+40]` | `[+18]` `00` (7,933/7,935), `[+22:24]` `00 00`, `[+26:34]` eight `00`, `[+36]` `00`, `[+37:39]` `16 32`, `[+39]` `00` | constant; meaning ❓ |
> ⚠ **AMENDED 2026-11-05 (measured on DL2):** the record is the first of a chain of
> `[length uint16 BE][id][payload]` records. `00 28 05` is length 40 and id `0x05`, so the
> next record starts at `M + 36`. `[M+22:M+26]` is the vector-sum peak's sample, a uint32 BE
> (its high bytes are the `00 00` above). The bytes from `[+36]` are the next record's lead,
> `00 16 32`: the unit's per-channel summary. Layout and what Blastware prints from it:
> Appendix D.6.12.
**Relations** (7,935/7,935): footer `ts1` (session start) ≤ trigger ≤ stop; and
`(stop - trigger) - record time` lies in −3 … +6 s.
@@ -3401,11 +3391,6 @@ All waveform files share the same `00 12 03 00` type tag regardless of extension
All timestamps in N00 and MLG files use an **8-byte big-endian format**:
> ⚠ **CORRECTED 2026-11-09 (measured): MLG files store the year little-endian** (`ea 07` = 2026)
> in every timestamp of all 4 bench `.MLG` files (`example-events/`). §7.5 already recorded it.
> N00 / event files are big-endian, as below. The MLG is Blastware's own PC-side file; the
> event file is the unit's data. D.4.2 has the rest of the MLG's byte order.
| Byte | Field |
|---|---|
| 0 | day (uint8) |
@@ -3473,10 +3458,6 @@ The body is reconstructed from the raw A5 bulk waveform stream frames by strippi
The footer terminates the N00 file. Its bytes come directly from the terminator A5 frame's inner content — do NOT reconstruct from event metadata.
✅ **It is the file's last 26 bytes** (2026-11-03): `0e 08` and two valid times end every one of 70,041 DL2 files.
> 🔑 **2026-11-06 (measured):** it is the last record of the chain that starts with the event
> record (D.6.13). The two bytes before it, `00 1a`, are its length (26), and `0e` is its id.
> The chain lands exactly on it in all 70,041 DL2 files.
- ⚠ **Do not search for the first `0e 08` + plausible year.** 14 DL2 files also hold an earlier record of that shape, about 1.1 KB before the end, carrying the stop time followed by zeros.
- Taking it made a histogram start at its own stop (a day late on BE9558's daily histograms). It also cost a waveform its stop, and with it the trigger time.
@@ -3485,11 +3466,8 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
| 0 | 2 | `0e 08` | Fixed marker |
| 2 | 8 | ts1 | Start timestamp (8B big-endian) |
| 10 | 8 | ts2 | Stop timestamp (8B big-endian) |
| 18 | 6 | varies | ⚠ **Not fixed** (2026-11-03). `00 01 00 02 00 00` in M529LIY6.N00. Elsewhere: `00 21 04 00 00 00` (K558L9XP.FK0H, K439I2WY.RK0H, T1895KDW.6J0H), `00 01 02 00 00 00` (K5575KDW.5L0W), `00 01 00 01 00 00` (S3545KFL.S60W). Not identified. **Identified 2026-11-08, three rows below** |
| 18 | 2 | monitor-log flags | uint16 BE: the words of Blastware's Monitor Log line (D.6.14) ✅ 69,983 / 69,983 |
| 20 | 2 | trigger source | the event record's again: `00 01`–`00 08` a channel, `02 00` Manual, `04 00` a histogram ✅ 69,983 / 69,983 |
| 22 | 2 | `00 00` | 69,983 / 69,983 |
| 24 | 2 | CRC | 2-byte CRC — algorithm unconfirmed. ⚠ 2026-11-08: no common CRC-16 (XMODEM, CCITT-FALSE, AUG-CCITT, KERMIT, ARC, MODBUS, BUYPASS) nor a 16-bit sum, over the file, from STRT, after STRT or over the footer, fits 40 sampled files. That it is a checksum is not shown |
| 18 | 6 | varies | ⚠ **Not fixed** (2026-11-03). `00 01 00 02 00 00` in M529LIY6.N00. Elsewhere: `00 21 04 00 00 00` (K558L9XP.FK0H, K439I2WY.RK0H, T1895KDW.6J0H), `00 01 02 00 00 00` (K5575KDW.5L0W), `00 01 00 01 00 00` (S3545KFL.S60W). Not identified |
| 24 | 2 | CRC | 2-byte CRC — algorithm unconfirmed |
**CRC:** The 2-byte CRC at footer[24:26] has an unconfirmed algorithm. In M529LIY6.N00 it reads `fe da`. Attempts to match CRC-16/CCITT, CRC-16/IBM, CRC-32 (truncated), and 40+ polynomial/init combinations all failed. The writer copies it verbatim from the terminator frame.
@@ -3527,24 +3505,6 @@ The footer terminates the N00 file. Its bytes come directly from the terminator
| `01 00 02 00` | Triggered event (has ts1 + ts2) |
| `02 00 00 00` | Monitoring interval (has ts1 + ts2) |
> 🔑 **2026-11-09 (measured on the 4 bench `.MLG` files):** these flags are the event footer's
> flag word and trigger source (D.3.3, D.6.14), stored **little-endian**. The record's
> `[22:24]` is the monitor-log flag word, `[24:26]` the trigger source; ts1 and ts2 have the
> year little-endian too (D.2). So:
> - `01 00 02 00` = `0x0001` Event Recorded, triggered by `0x0002` Vert, not a fixed "event" code.
> - `02 00 00 00` = `0x0002` Keyboard Exit.
> - `04 00 00 00` = `0x0004` Remote Exit. SFM's own remote stops on BE11529 show up this way.
> - `03 00 00 04` / `05 00 00 04` = Event Recorded + Keyboard / Remote Exit, source `0x0400`, a
> histogram.
> - `01 08 02 00` = `0x0801` Event Recorded + Memory Full Exit, source Vert (BE9441, 10-26).
> - `ff ff` = monitoring started, no stop yet.
>
> BE9441's 10-25 session (44 records) lines up with that session's 20 event files: each Event
> Recorded record's stop equals the event footer's stop and its flag word, 20 / 20. Blastware's
> words for each bit are D.6.14's table.
> ⚠ `write_mlg()` (`blastware_file.py`) writes timestamps big-endian, unlike Blastware's own
> files; nothing calls it today.
**Text content for triggered events (`flags = 01 00 02 00`):**
| Byte | Field |
@@ -3682,22 +3642,6 @@ Each field was proven by the decode checker, `scratch/check_s3_decode.py`. It co
decode with Blastware's `_XML.XML` report for every DL2 event: 70,042 events, 2016–2026, local
copy in `~/dl2-archive`. Counts below are from that archive unless stated otherwise.
> 🔑 **Reading a mismatch: 256, 4,096 and 65,536 mean a number outgrew its box** (Brian,
> 2026-11-05). These are 2⁸, 2¹² and 2¹⁶: how many values an 8-, 12- or 16-bit field can hold.
> When a value is off by exactly one of them, or stops at one, suspect the storage, not the
> physics. Every case so far:
>
> | Seen as | Box | Cause |
> |---|---|---|
> | O117I1NK's samples off by 65,536 counts at the trigger, the mic's by 4,096 (D.6.12) | 16-bit sample (12-bit mic) | the unit wrote a value beyond the range; it rolled over |
> | the unit's largest step stored × 65,536 (D.6.12) | 16.16 fixed point | whole part in the top 16 bits, fraction in the bottom 16 |
> | histogram PVS² high word non-zero above 1.28 in/s (D.6.5) | 16-bit half of a uint32 | 1.28 in/s = 256 units, and 256² = 65,536 |
> | histogram peaks clipped at 1.275 in/s until 2026-08-25 | one byte read where the value is 16-bit | 255 units is the most a byte holds |
> | the 5A walk failing past 64 KB until 2026-10-26 (§7.8) | 16-bit address | addresses roll over every 65,536 bytes |
>
> The geophone's full scale is 32,000 counts, deliberately short of the 16-bit limit (32,767):
> that one is a design margin, not an overflow.
#### D.6.1 Record type — `STRT[18]` ✅
| `STRT[18]` | Type | DL2 |
@@ -3991,19 +3935,12 @@ All four channels match every DL2 histogram.
#### D.6.11 Not read from the file yet
*Updated 2026-11-08. 72 of 88 report fields now match on every DL2 event: 47 before group D,
59 after it, 71 with the sensor check, 72 with the monitor log (run `20261108-034313`,
0 regressions). Still open: the mic stragglers, the `OORANGE` tag (18 events), the
PPV / vector-sum `OORANGE` carve-out, and 4 accelerations (D.6.12).*
*Updated 2026-11-03. 47 of 88 report fields now match on every DL2 event.*
- **Fields not read yet:**
- extended notes
- ~~sensor check results~~ **read, 2026-11-06 (D.6.13)**: the unit's own, in the header of
each sensor-check record
- ~~monitor log~~ **read, 2026-11-08 (D.6.14)**: the footer's times and flag word
- ~~the values Blastware computes: ZC frequency, acceleration, displacement, time of peak~~
**Read, 2026-11-04 → 05 (D.6.12).** Blastware prints the unit's own ZC frequency,
displacement and time of peak, all stored in the file. Acceleration is the exception:
the unit stores its own, but Blastware prints its own computation from the samples.
- the values Blastware computes: ZC frequency, acceleration, displacement, time of peak
- sensor check results
- monitor log
- **Open cases:**
- 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
@@ -4018,162 +3955,6 @@ PPV / vector-sum `OORANGE` carve-out, and 4 accelerations (D.6.12).*
- histogram interval detail: frequencies (#50), vector sums, interval size, stop (D.6.9)
- histogram start, stop, interval and peak times (#51, D.6.10)
#### D.6.12 Peak detail — the unit's own event summary ✅ 2026-11-05
**The embedded event record (§7.8.9, D.6.10) is the first of a chain** of
`[length uint16 BE][id][payload]` records: the next one starts `length + 2` bytes after a
record's lead. `00 28 05` is length 40 and id `0x05`. Measured on the 6,493 DL2 waveforms and
63,500 histograms that have a Blastware report.
**The event record**, offsets from its marker `M` as in §7.8.9:
| bytes | content |
|---|---|
| `[M+22:M+26]` | the vector-sum peak's sample, uint32 BE: SFM's own vector-sum peak on 6,492 / 6,493 (the other is O117I1NK, below) |
| `[M+18:M+22]`, `[M+26:M+36]` | not identified ❓ |
**Then one record per channel**, length 22: ids `0x32` Tran, `0x33` Vert, `0x34` Long,
`0x35` MicL. A unit without a mic has no `0x35` (6 DL2 files).
| payload | content |
|---|---|
| `[0]` | `00` on all 25,966 waveform channels |
| `[1:3]` | min, int16 BE: geophones in decoder units of 16 counts (0.005 in/s at Normal), the mic in counts |
| `[3:5]` | max, the same |
| `[5:9]` | the peak's sample, uint32 BE |
| `[9:11]` | **half-period**, samples, uint16 BE |
| `[11:15]` | **displacement integral**, uint32 BE, in units × samples |
| `[15:21]` | 🔶 **the unit's own largest sample-to-sample step**, × 65,536 (16.16 fixed point, units), read as one 48-bit BE integer. It is the stored samples' largest step plus 0 to 1 unit (median +0.5) on 19,479 geophone channels, so probably the same step at full resolution (inferred). Blastware does not print it: see peak acceleration below |
On a waveform, min, max and peak sample are the decoded samples' own on 25,962 / 25,966
channels. The 4 others are O117I1NK (below).
**Then records `0x3c` (and on a histogram `0x3d`)**, length 202–212. Not read yet. Probably
the sensor check, before and after (inferred, not measured).
> ⚠ **RETRACTED 2026-11-06 (measured):** "before and after". They are the sensor check, but
> one record per channel: `0x3c` Tran, `0x3d` Vert, `0x3e` Long, `0x3f` MicL, on waveforms and
> histograms alike. My first walk stopped at the first id it did not know. The chain runs on
> to the footer: D.6.13.
**What Blastware prints from them.** It prints the unit's values; it does not recompute them:
| Field | Rule | DL2 |
|---|---|---|
| ZC frequency, every record type | (rate / 2) / half-period. "N/A" at 0; `>100` (`>200` at 2048 sps, `>400` at 4096) at 5 samples or fewer; `<1.0` when the half-period exceeds rate / 2. The histogram interval rule (D.6.9) | waveforms 25,966 / 25,966 channel values (15,844 numbers); histograms 253,958 / 253,958 (104,000 numbers) |
| Peak displacement (waveform) | half the integral: integral × 16 counts × in/s per count (the range's, D.6.4) ÷ rate ÷ 2, in inches | 19,479 / 19,479 |
| Time of peak (waveform) | (peak sample − pre-trigger samples) ÷ rate | as the samples' own, except O117I1NK, where Blastware prints the summary's |
| Vector-sum time (waveform) | the same, from the event record's sample | 6,492 / 6,493 from the samples; O117I1NK prints the record's |
| Peak acceleration (waveform) | **Blastware's own**, from the stored samples: the largest \|v[i+1] − v[i]\| × rate ÷ g, with its g fitted to [386.2236, 386.2240] in/s² by every DL2 value (9.81 m/s² is 386.2205; the standard 9.80665 fits 17,806). The unit's own step (`[15:21]`) would match only 879 | 19,475 / 19,479 |
**Why recomputing failed.** ZC frequency recomputed from the samples matched 46% (the
half-cycle at the peak), and 80% with each crossing interpolated at ±16 counts. Displacement
matched 84% (half the largest half-cycle integral, the manuals' method). The unit works at
full resolution: a stored sample of ±16 counts hides anything from 1 to 31.
**O117I1NK.R70W (2019): clipped, and its samples wrap.**
- **The wrap:** at the trigger (sample 254), every stored sample is off by exactly 65,536
counts (4,096 on the mic). Tran reads +26,832 where the summary's min is −38,704 (−12.1 in/s).
- **Blastware decodes the same:** its own sample table has the same wrapped values (Tran
8.385 in/s).
- **It prints the summary:** `OORANGE`, and time of peak 0.000 on all four channels and on
the vector sum.
- **Its accelerations** equal the summary's max − min in one sample step: 48.28, 46.93 and
49.12 g, all exact. One file. Inferred: Blastware's acceleration sees the summary's extreme
at its peak sample. SFM does not do this.
**S353I5PZ.EP0W Vert (open).** Blastware's acceleration (0.027 g) skips one 80-count step,
from sample 4,096 to 4,097, which its own sample table shows. Not explained. Skipping every
4,096-sample boundary fixes this file but breaks another.
#### D.6.13 The record chain to the footer, and the sensor check ✅ 2026-11-06
**The whole tail of an event file is one record chain.** Walked from the event record by its
length prefixes, it ends exactly at the file's last byte on **all 70,041 DL2 files**, in two
shapes:
| Files | Chain |
|---|---|
| 70,033 | `0x05` event record → `0x32`–`0x35` unit's summary (D.6.12) → `0x3c`–`0x3f` sensor checks → `0x0e` footer |
| 8 | the same without `0x35` and `0x3f`: BE16352, which records no mic |
The **footer** (D.3.3, "the file's last 26 bytes") is the chain's last record: its length
`00 1a` sits just before it, and its first byte, `0e`, is its id. SFM reads nothing in the
chain unless the walk ends exactly at the end of the file.
**Each sensor-check record** (`0x3c` Tran, `0x3d` Vert, `0x3e` Long, `0x3f` MicL) holds the
check the unit ran: a header with its results, then the trace Blastware draws in its "Sensor
Check" strip (`minimateplus/sensor_check.py`, since 2026-09-15). Payload after the id:
| bytes | content |
|---|---|
| `[0:2]` | `00 00` |
| `[2]` | channel type: `01` geophone, `02` mic, `00` the check disabled |
| `[3]` | `00` |
| `[4]` | **status**: `00` passed; 1–15 otherwise |
| `[5:7]` | **frequency × 10**, uint16 BE (Hz) |
| `[7:9]` | **ratio × 10**, uint16 BE (geophones; the mic's reads 10) |
| `[9:11]` | **amplitude, mV**, uint16 BE (the mic's; geophones carry a value too, ~260–700, not printed) |
| `[11:19]` | not identified ❓ |
| `[19:]` | the trace (`sensor_check.py`'s `_HEADER_LEN` = 20 counts the id byte) |
**What Blastware prints** (`TestFreq`, `TestRatio`, `TestAmplitude`, `TestResults`):
| Field | Rule | DL2 |
|---|---|---|
| geophone test frequency and ratio | as stored, ÷ 10 | 209,943 / 209,943 each |
| mic test frequency and amplitude | as stored (frequency ÷ 10) | 69,975 / 69,975 each |
| result | `Passed` at status 0, `Check` at any other, `Disabled` at channel type 0 (and nothing else printed) | every channel |
**The status code is the unit's verdict, not a limit SFM can recompute.** Geophones that pass
span 6.7–9.4 Hz and ratio 1.9–6.0, yet K559L6N1's Tran reads `Check` at 8.1 Hz and 3.3. Each
of the four bits occurs across the whole range of frequency, ratio and amplitude, so their
meanings are not decoded. Every mic `Check` in DL2 (691) is status 13 with frequency 0 and
amplitude 0: a mic that did not respond (inferred).
#### D.6.14 The monitor log — the footer ✅ 2026-11-08
**Every DL2 report prints exactly one Monitor Log line**, built from the footer (D.3.3) alone:
<footer ts1> - <footer ts2> "<words>"
- **Start and stop:** the footer's ts1 and ts2 on 69,983 / 69,983. For a waveform ts1 is the
monitoring session's start (§7.8.9). For a histogram both are the session's.
- **The words** come from the footer's flag word `[18:20]`, uint16 BE:
| bit | words |
|---|---|
| `0x0001` | `Event Recorded ` (set on every DL2 line) |
| `0x0002` | `Keyboard Exit` |
| `0x0004` | `Remote Exit` |
| `0x0008` | `Selfcheck Passed` |
| `0x0010` | `Timer Stop` |
| `0x0020` | `Modem Exit` |
| `0x0200` | `Battery Low Exit` |
| `0x0800` | `Memory Full Exit` |
**Rule:** "Event Recorded " plus, when a session-end bit is set, one space and its words.
Rebuilt that way, the line equals Blastware's **character for character on 69,983 / 69,983**.
- One line sets Modem and Timer (`0x0031`) and prints only "Modem Exit": the higher bit wins.
That is one file, so the order of the other bits is inferred.
- Bits not seen in DL2 have no known words.
**How common each is in DL2:**
| Words | Lines |
|---|---|
| Modem Exit | 58,941 (a modem connection ended the session; a call-home, inferred from the words) |
| no session end (continuous waveforms) | 6,480 |
| Timer Stop | 4,046 |
| Keyboard Exit | 245 |
| Remote Exit | 178 |
| Battery Low Exit | 65 |
| Selfcheck Passed | 20 |
| Memory Full Exit | 8 |
SFM reads the line only when the record chain is whole (D.6.13), which proves the last 26
bytes are the footer.
---
*All findings reverse-engineered from live RS-232 bridge captures.*
@@ -1,332 +0,0 @@
# Monitor logs (.MLG) and each unit's monitoring timeline — design
**Date:** 2026-11-09 · **Branch:** `feat/mlg-import` (worktree `~/seismo-relay-mlg`) ·
**Status:** design, for review
## Why this exists
Every Series-3 unit sends a Blastware monitor log, an `.MLG` file, at every call-in, whatever mode
it is recording in. It lists each time the unit started monitoring, each event, and each time it
stopped and why. Event files cannot replace it: a unit in continuous (waveform) mode sends an event
file only when something triggers, so a quiet day leaves no file at all.
Brian named two uses (2026-11-09):
1. **Shot reports.** Every event from every unit on a site goes in the report. A unit that did not
trigger (often the farthest one) is listed as "did not trigger", with its printed `.MLG`
attached as proof it was monitoring at the time of the blast. Example: BE6907 and BE12844
monitored the same job, June to November 2026, both in continuous mode. BE6907 is much farther
away and recorded 10 events to BE12844's 55.
2. **Outage history.** It is good to know when a unit was not recording, for how long, and why. A
unit on solar and battery can die for a weekend and nobody would notice. Most units keep
recording when they cannot call in; only losing the power and then the internal battery stops
them. So this is history seen once the unit calls in again, not a live alarm.
The `.MLG` is also what the watcher's heartbeat sniffs today to show that a unit is still calling
in. SFM holding the files would later let it answer that itself.
## Goals
1. Read a Blastware `.MLG` into its records, with every record's checksum verified.
2. Accept forwarded `.MLG`s through a new import route, storing each record once.
3. Keep each unit's monitoring timeline, derived from its records: when it was recording, how each
session ended, the events inside, and the call-ins. It must answer two questions:
- was unit X monitoring at time T, and with what trigger level?
- when was it not monitoring, for how long, and why?
4. Serve the records and the timeline through `/db/*`, for Terra-View to use later.
5. Bulk-import a directory of `.MLG`s (DL2 holds about 86,000), and cross-check the records against
the event files' footers.
## Non-goals
- **The watcher forwarding `.MLG`s.** That is a change in `../series3-watcher`, Brian's call, and a
separate piece. Until it lands, `.MLG`s reach SFM only through the import route and the bulk tool.
- **Anything in Terra-View:** the timeline view, the shot report, taking "last call-in" from SFM
instead of the heartbeat. Later pieces.
- **Live "missed its call-in" alerts.** A dead unit sends nothing; this timeline shows the gap
once it is back.
- **Series 4.** Thor writes no `.MLG`.
- **Editing the event decoders** (`event_file_io.py`, `decode_check.py`, `histogram_codec.py`,
`waveform_codec.py`). Another session owns them; this project imports from them only.
## Anti-goals (would make it a failure even if it works)
- **Claiming monitoring the data does not show.** A session still open at the last call-in is
"running at the last call-in", never "running now". Where a session's end is not recorded, the
timeline says so and gives the window it lies in.
- **Dropping a damaged file or record silently.** A record that fails its checksum is reported,
never half-read into the timeline.
- **Taking the serial from the file name when the file carries it.** Names are `<serial><counter>`
with nothing between, so `BE11010304` cannot be split by reading it.
- **Mixing clocks.** Record times are the unit's own local clock. File times are the PC's. They are
stored and labelled separately.
## What was measured
Grades: **measured** means checked on the files named; **inferred** means a reading of them that
has not been tested.
**Files examined:** 1,273 `.MLG`s from DL2's `C:\Blastware 10\Event\autocall home` (BE6907 369 and
BE12844 197, from 2026; BE8081 707, 2018–19), in `~/dl2-archive/mlg/`. Also the 9 bench files in
`example-events/`. Analysis scripts used for this section are in the session scratchpad and are
not part of the build.
### The file format (measured on all 1,282 files)
- **Layout:** an 18-byte prefix `10 00 01 80 00 00 "Instantel\0" 07 2c`, then whole 292-byte
records. The size is always `18 + 292·n`.
- **Every record** is `[length uint16 LE = 0x0122 (290)][id 2 bytes] … [CRC 2 bytes]`. Id `0e a0` is
the header record (one, first, carrying the serial). Id `0e 80` is a log record.
- **Checksum:** CRC-16/AUG-CCITT (poly 0x1021, init 0x1D0F, no reflection) over the record's bytes
`[0:288]`, stored little-endian at `[290:292]`. Bytes `[288:290]` are `00 00` and not covered.
This is the rule the Micromate setup blocks use (`micromate.setup_block`). It matches **3,329 of
3,329** records, with no failures.
- The reference (D.4.2) put a CRC at the *start* of each record. That was the previous record's
tail, which is also why every file had 2 unexplained bytes at its end.
- **A log record** (offsets from its length field):
| offset | field |
|---|---|
| `[4:12]` | start: day, month, year **LE**, 0, hour, min, sec |
| `[12:20]` | stop, same format; all zeros = no stop |
| `[20:22]` | monitor-log flag word, uint16 LE: the same word as the event footer's (D.6.14) |
| `[22:24]` | trigger source, uint16 LE: `0x0001`–`0x0008` a channel, `0x0400` a histogram |
| `[24:34]` | serial, null-padded ASCII |
| `[34:…]` | text, null-padded (below) |
- **Text:**
- a "monitoring started" record: `Trigger Level : Geo: 0.0500 in/s Mic: 125.0 dB(L)`, or
`Trigger Level : Histogram`
- an event record: `08`, then the event time in 8 bytes (LE year), then
`Geo: 0.0500 in/s Mic: 125.0 dB(L)`
- a closed session: `Geo: 0.0500 in/s Mic: 125.0 dB(L)`
- **Empty files:** some files are the 18-byte prefix alone, with no records and so no serial inside.
### How Blastware writes them (measured on the 3 DL2 units)
- **One file per call-in**, named `<serial><counter>.MLG`, the counter going up by one each time.
- **No record appears in two files.** Each holds what happened since the previous call-in.
- **A file is written 1–2 minutes after the unit stops for its call-in** ("Modem Exit"). The unit's
clock and DL2's agree to within those 2 minutes.
- ⚠ Dates of files that came through a Windows zip read an hour early from March to October.
Windows converts with the offset in force at zip time, not the one at the file's date. A
robocopy copy keeps the true time.
- **BE6907 writes two empty files 2–3 minutes after nearly every real one** (230 of its 369).
BE12844 and BE8081 never do. Inferred: the unit calls back in and has nothing new.
- **Some files hold more than one Modem Exit:** 38 files (BE8081 33, BE6907 3, BE12844 2). A
file is written just after its *last* Modem Exit. The earlier ones are calls that left no file.
Example: `BE8081321` holds Modem Exits on 2019-04-12 18:33, 04-13 07:00 and 04-15 17:15.
- Inferred: the call failed, or the PC did not take it.
- Either way, this is the "missed call-in" history Brian asked about.
- **The unit's clock steps back an hour at the first call-in after daylight saving ends.** On
2026-11-01 BE12844 ran `06:00:13 → 18:45:00` (unit still on EDT). It called in at 17:46 EST,
and its next session is `17:47:25 → 18:45:00`. BE6907 shows the same. So local times on that day
overlap. Inferred: Blastware sets the unit's clock at the call-in, and in spring the clock
steps forward the same way.
- **Blastware writes the text, not the unit.** The two bench copies of the same records
(`ach-vs-manual/BE11529.MLG`, `BE115292.MLG`) differ only in `Trigger Level: Histogram` vs
`Trigger Level : Histogram`. A record's identity must not include its text or its checksum.
- **Cable or direct downloads are cumulative.** The bench `4-3-26-multi/BE11529.MLG` repeats the
4-1 records. Only the call-in files hold "only what is new".
### How a session appears (measured on the 3 DL2 units)
- **A session with no events** is one closed record: start, stop and why it stopped. BE12844's day:
`06:00:13 → 18:45:00` "Modem Exit" (its call-in), then `18:47 → 20:00` "Timer Stop" (a
work-hours timer).
- **A session with events** is an open "monitoring started" record (flag word `ffff`, no stop),
then one record per event (`0x0001` + the channel). The unit calls in minutes after each event,
and monitoring resumes as a *new* session minutes later. Example, BE12844 on 9-8:
- `06:00:13` started, then an event `13:38:22 → 13:38:25` (Tran)
- a file written about a minute later
- next file: `13:41:16 → 18:45:00` "Modem Exit"
The first session's end is not written anywhere. It lies between the last event's stop and the
next session's start (inferred: the call-in after the event ended it).
- **A histogram session** is a "monitoring started" record at T, then a histogram record from T+1 s
to the stop, carrying the stop reason (`0x0021` = Event Recorded + Modem Exit, source `0x0400`).
- **A histogram + waveform session** also has waveform event records whose start falls inside the
histogram record's span (BE8081, 5 in 2018). Example: histogram `15:15:32 → 15:15:49`, with a
Vert event `15:15:47 → 15:15:49`. Its trigger-level text says only "Histogram". The geophone
level appears only on its event records.
### Cross-check against the event files (measured)
Each "Event Recorded" record was matched to DL2's event files by **stop time + flag word + trigger
source**:
- **BE8081:** 785 / 785 records match an event file, and all 785 of its DL2 event files in that
period have a record. 714 histogram footers start exactly at the session's "monitoring started"
record; the other 71 start where the record does.
- **BE6907 / BE12844:** 25 / 25 event files have a record. The 42 records with no file all stop
after 2026-08-25, where the DL2 copy ends.
- On 2026-08-27 both units triggered at 13:00:42 / 13:00:43, the same blast.
## Design
### 1. The reader (codec library: pure, no I/O beyond the file)
`read_mlg(path)` replaces the stub in `minimateplus/blastware_file.py` and returns a new model
(`MlgFile`, `MlgRecord` in `models.py`). It does not reuse `MonitorLogEntry`, which is the live
0x0A shape. Per record:
- start, stop (None when open), flag word, trigger source
- Blastware's words, from `event_file_io.monitor_log_description()` (imported, not copied)
- the text, plus the trigger level and the event time parsed from it
- whether the checksum passed
Per file: the serial (from the header record; None for an empty file), the records, whether the
file is whole. A file whose size is not `18 + 292·n`, or with a bad prefix, raises. A record that
fails its checksum is returned flagged; the caller decides.
### 2. `write_mlg()` (last, small)
Fix it to write what Blastware writes: little-endian times, the length-led framing and the CRC.
Test: rebuild bench and DL2 files byte for byte from what the reader returns. If the header
record's unread bytes stop that, say so and leave the writer as it is.
### 3. Storage (`sfm/database.py`)
- **The original file is kept, byte for byte,** in the waveform store beside the unit's event
files. Files are tiny (18 bytes to a few KB). It is the shot-report proof, and Blastware can
open and print it. Rows alone cannot rebuild it, because Blastware's text varies.
- **`mlg_files`:** one row per file received:
- serial, file name, size, SHA-256, record count, an empty flag
- received time, and the file's modified time (UTC, when the sender gives it)
- whether it is a call-in file (default yes; a cable download is not)
The same name with the same bytes is a re-send and is skipped. Empty files all share one
hash, so the name keeps them apart. Some names have no counter (`BE8081.MLG` was DL2's first),
so name alone is not enough. This table is the call-in history, and the only trace of an empty
file.
- **`mlg_records`:** one row per log record: serial, start, stop, flag word, trigger source, text,
and the file it first came in. Stored once:
- unique on `(serial, start, stop, flag word, trigger source)`
- ⚠ an open record's stop is NULL, and SQLite treats NULLs as distinct in a UNIQUE constraint.
The key must handle that, for example with an index on `COALESCE(stop, '')`.
- **The existing `monitor_log` table is left alone.** It holds live 0x0A rows from
`bridges/ach_server.py`, which is not in production. A future SFM call-in server would write
`.MLG`-shaped records into `mlg_records` instead.
### 4. The timeline (computed when asked, not stored)
From a unit's records in time order:
- **A closed record** with no event bit is a session `[start, stop]`, ended for its reason.
- **A histogram record** is a session from its "monitoring started" record (or its own start, when
there is none) to its stop, ended for its reason.
- **A "monitoring started" record followed by events** is a session from that start. Its end is
"between the last event's stop and the next session's start".
- **A "monitoring started" record with nothing after it yet** is "running at the last call-in".
Gaps between sessions take the reason the previous session ended with:
| previous session ended with | the gap means |
|---|---|
| Modem Exit | a call-in |
| Timer Stop | scheduled off |
| Battery Low Exit | lost power |
| Keyboard Exit / Remote Exit | stopped by a person |
| Memory Full Exit | memory full |
| none known | unknown |
- **Waveform events inside a histogram session** belong to that session. They are not sessions
of their own.
- **Trigger level is reported as logged:** the session's text, plus any geophone level its event
records carry. It is never borrowed from a neighbouring session. A histogram session with no
events says "Histogram", geophone level not logged.
- **Clock steps:** a session that starts before the previous one stopped is a clock step, not an
overlap. The timeline shows it as such, with no negative gap. Times are the unit's local clock,
as SFM's event times are; `at`, `from_dt` and `to_dt` are in that clock. If `at` falls in a
repeated hour and matches two sessions, `monitoring_at` returns both and says so. The spring
step forward will show as a gap an hour too long on that one day; that is accepted.
**Call-ins** are listed by the call each file came from:
- **Delivered:** a call-in file's last Modem Exit (unit clock), paired with the file (PC clock).
- **No file:** the earlier Modem Exits in the same file. Calls that left no file.
- **Nothing new:** an empty file, at its file time.
Cable-download files are not call-ins.
### 5. Routes (`sfm/server.py`)
- `POST /db/import/mlg_file`: one or more files, an optional serial hint, each file's modified
time when the sender has it, and `call_in` (default true).
- Mirrors `/db/import/blastware_file`: each file gets its own status, and good files are stored
even when another in the same request is not.
- Per file it returns the serial, records inserted and skipped, and whether it was empty.
- A file with any failed checksum, or that is not whole, stores nothing of itself. Its status
names the record.
- `GET /db/mlg_files/{id}`: the original file, for printing or opening in Blastware.
- `GET /db/units/{serial}/timeline?from_dt=&to_dt=`: sessions (start, end or end window, how it
ended, its events, its trigger level), gaps with their meaning, and call-ins.
- `GET /db/units/{serial}/monitoring_at?at=`: `monitoring` / `not_monitoring` / `unknown`, with the
session and records that say so, and the trigger level. This is the shot report's question.
- `GET /db/mlg_records?serial=&from_dt=&to_dt=`: the raw records.
### 6. Serial of an empty file
An empty file holds no serial. Take, in order:
1. the request's serial hint
2. the longest serial SFM already knows (units, events, `.MLG` headers) that the name starts with
3. otherwise store the file with no serial and report it as unresolved
### 7. Tools
- **`scripts/import_mlg_dir.py <dir>`:** imports a directory tree of `.MLG`s straight into the DB,
with a dry run that prints the counts. Same pattern as the backfill scripts. For DL2's ~86,000.
- Every file it reads is a call-in file (it is pointed at the ACH folder's copy).
- It records file times as found, but they matter only for empty files. A zipped copy's times
are an hour early from March to October.
- The full DL2 import should come from a robocopy copy, which keeps true times.
- **`scratch/check_mlg_vs_events.py <mlg dir> <event dir>`:** the cross-check above, in both
directions, for the whole archive.
### 8. Documentation
- Rewrite the reference's D.4 (`docs/instantel_protocol_reference.md`) with the measured framing,
checksum, fields and file behaviour, keeping the old text as a retraction. Mark D.4.3 solved.
The file is CRLF: edit it with the Edit tool.
- 🔑 **For Brian to pass to the decoder session, not edited here:** the event-file footer's
checksum (D.3.3, open since April) is the same rule. AUG-CCITT over the footer record from its
length `00 1a` through byte 24, stored big-endian. It matches **70,041 / 70,041** DL2 files.
Inferred: every record in the event file's tail chain (D.6.13) carries one.
## Testing
TDD. Fixtures go in a dated `tests/fixtures/` directory (force-added if ignored). A small set
covering each shape:
- a closed-records day (BE12844)
- a session with an event (BE12844 #3067–#3068)
- a histogram day (BE8081)
- a Battery Low Exit (BE8081)
- an empty 18-byte file (BE6907)
- a file with calls that left no file (`BE8081321`)
- the clock step back (BE12844 #3155–#3156)
- a histogram + waveform session (`BE8081.MLG`, 2018-02-16)
- the 4 bench files, including the `ach-vs-manual` pair whose text differs
Plus one file with a byte flipped, for the checksum.
The reader, the storage (including that an open record imported twice is stored once), the
timeline cases above and the routes each get tests. The full suite has 16 known failures; read the
failure list before committing.
## Left to the builder
- Model and helper names; the exact JSON shapes of the routes.
- Whether `read_mlg` moves into its own module later.
- What the header record's other bytes hold (all zero on the files seen).
- **Not in this project:** linking a session's events to SFM's stored event ids. Terra-View may
want that later. It needs a matcher, because the events table stores neither the stop time nor
the flag word, and its times moved in 0.32.0 and 0.34.0.
## Later pieces (not this project)
- **The watcher** forwards `.MLG`s with their modified time, and the heartbeat stops sniffing them.
- **Terra-View** shows each unit's timeline, puts "monitoring during the blast" on shot reports,
and takes "last call-in" from SFM.
- **BE6907's extra call-ins:** worth a look at its modem and call-home settings.
+2 -24
View File
@@ -145,30 +145,9 @@ def sfm_side(raw: bytes) -> SfmSide:
("PeakVectorSumTimeSum", pv.pvs_time),
("TranPeakAcceleration", pv.tran_peak_accel_g),
("VertPeakAcceleration", pv.vert_peak_accel_g),
("LongPeakAcceleration", pv.long_peak_accel_g),
("TranPeakDisplacement", pv.tran_peak_disp_in),
("VertPeakDisplacement", pv.vert_peak_disp_in),
("LongPeakDisplacement", pv.long_peak_disp_in)):
("LongPeakAcceleration", pv.long_peak_accel_g)):
if value is not None:
values[tag] = value
# The unit's ZC frequency, every record type. Above range it is judged
# by its flag (_compare_scalar); below 1 Hz Blastware prints a word.
for tag, hz in (("TranZCFreq", pv.tran_zc_freq), ("VertZCFreq", pv.vert_zc_freq),
("LongZCFreq", pv.long_zc_freq), ("MicLZCFreq", pv.mic_zc_freq)):
if hz is not None:
values[tag] = "<1.0" if hz < 1.0 else hz
# The event's Monitor Log line, from the footer (2026-11-08).
if ev.monitor_log is not None:
ml = ev.monitor_log
values["MonitorLog"] = (f'{ml.start:%Y-%m-%d %H:%M:%S} - {ml.stop:%Y-%m-%d %H:%M:%S} '
f'"{ml.description}"')
# The unit's sensor check (2026-11-06), every record type.
for ch, r in (ev.sensor_check_results or {}).items():
values[f"{ch}TestResults"] = r.result
for tag, value in (("TestFreq", r.freq_hz), ("TestRatio", r.ratio),
("TestAmplitude", r.amplitude_mv)):
if value is not None:
values[f"{ch}{tag}"] = value
if counts["MicL"]:
values["MicLPSPL dB(L)"] = mic_count_to_db(max(abs(c) for c in counts["MicL"]))
values["MicLPSPL psi(L)"] = pv.micl if pv is not None else None
@@ -285,8 +264,7 @@ def _compare_scalar(tag: str, printed: str, sfm: SfmSide, ref: XmlReport) -> Fie
return FieldResult(tag, "sfm_blank", printed, None)
if printed.startswith(">"):
# ZC frequency above range: SFM agrees only by setting its flag.
ch = tag[:-len("ZCFreq")].lower()
flag = getattr(sfm.event.peak_values, ("mic" if ch == "micl" else ch) + "_zc_above_range", False)
flag = getattr(sfm.event.peak_values, tag[:-len("ZCFreq")].lower() + "_zc_above_range", False)
return FieldResult(tag, "match" if flag else "mismatch", printed, str(value))
if printed == "OORANGE":
return FieldResult(tag, "mismatch", printed, str(value))
+24 -209
View File
@@ -26,14 +26,12 @@ import struct
from pathlib import Path
from typing import Optional, Union
from .models import (DeviceInfo, Event, MonitorLogLine, PeakValues, ProjectInfo, SensorCheckResult,
Timestamp)
from .models import DeviceInfo, Event, PeakValues, ProjectInfo, Timestamp
from . import blastware_file as _bw # avoid circular reference at module load
from .bw_ascii_report import BwAsciiReport
from . import waveform_codec as _wc
from .waveform_codec import decode_waveform_v2, decoded_to_adc_counts
from .histogram_codec import (channels_from_records, decode_histogram_body, decode_histogram_body_full,
half_period_to_hz)
from .histogram_codec import channels_from_records, decode_histogram_body, decode_histogram_body_full
# Reference pressure for dB(L) → psi conversion (20 µPa expressed in psi).
# Same constant as sfm/sfm_webapp.html so server-side and browser-side
@@ -835,47 +833,6 @@ def _waveform_peak_detail(pv: PeakValues, samples: dict[str, list[int]], geo_fs_
pv.pvs_time = (j - pretrig) / sample_rate
def _zc_from_half_period(halfp: int, sample_rate: int) -> tuple[Optional[float], bool]:
"""(ZC frequency, above range) as Blastware reports it: None for a
half-period of 0 ("N/A"); Blastware's threshold, flagged, at 5 samples or
fewer (">100", ">200" at 2048 sps); else (rate / 2) / half-period, which
Blastware prints as "<1.0" below 1 Hz."""
if halfp == 0:
return None, False
hz = half_period_to_hz(halfp, sample_rate)
if hz is None:
return 100.0 * sample_rate / 1024, True
return hz, False
def _apply_unit_summary(pv: PeakValues, summary: dict, geo_fs_ins: float, sample_rate: int,
pretrig: Optional[int]) -> None:
"""The unit's own values from its event summary, on `pv`. Blastware prints
them as they are (DL2, 2026-11-05):
* ZC frequency, every record type: 15,844 / 15,844 waveform and
104,000 / 104,000 histogram values, and every word
* a waveform's peak displacement = half its integral: 19,479 / 19,479
* a waveform's times of peak and vector-sum time, from the unit's peak
samples (`pretrig` given): they replace the samples' own, which differ
only where the stored samples wrap (O117I1NK.R70W)."""
# The summary's geophone values are decoder units, as a histogram's are.
unit_ins = _HIST_GEO_COUNTS_PER_UNIT * geo_fs_ins / _GEO_INT16_FS
for ch, attr in (("Tran", "tran"), ("Vert", "vert"), ("Long", "long"), ("MicL", "mic")):
c = summary.get(ch)
if c is None:
continue
hz, above = _zc_from_half_period(c["half_period"], sample_rate)
setattr(pv, f"{attr}_zc_freq", hz)
setattr(pv, f"{attr}_zc_above_range", above)
if pretrig is None:
continue
setattr(pv, f"{ch.lower()}_time_of_peak", (c["peak_sample"] - pretrig) / sample_rate)
if ch != "MicL":
setattr(pv, f"{attr}_peak_disp_in", c["disp_integral"] * unit_ins / sample_rate / 2)
if pretrig is not None and all(ch in summary for ch in ("Tran", "Vert", "Long")):
pv.pvs_time = (summary["pvs_sample"] - pretrig) / sample_rate
# STRT[18], the record-type byte (#41): 0x46 on every one of DL2's 6,577
# waveform files and 0x0A on every one of its 63,535 histograms (measured
# 2026-10-29). Manual / Event / Combo never occur there, so their bytes are
@@ -979,10 +936,9 @@ def _ts8(b: bytes) -> Optional[datetime.datetime]:
def _embedded_event_record(
raw: bytes, end: int, start: Optional[datetime.datetime],
stop: Optional[datetime.datetime], record_time: Optional[float],
) -> tuple[Optional[datetime.datetime], str, Optional[int], Optional[int]]:
"""The trigger time, the trigger source and the offset of the record's
`fe 80` from the instrument's embedded event record, or (None, why, None,
None).
) -> tuple[Optional[datetime.datetime], str, Optional[int]]:
"""The trigger time and trigger source from the instrument's embedded event
record, or (None, why, None).
Every `fe 80` before `end` (the footer) is a candidate. One counts only if
its lead bytes match, both its times are well formed, the footer's session
@@ -995,7 +951,7 @@ def _embedded_event_record(
Blastware's Trigger on 6,493 / 6,493 DL2 waveforms (2026-11-03).
"""
if start is None or stop is None:
return None, "the footer has no start and stop to check one against", None, None
return None, "the footer has no start and stop to check one against", None
found, rejected = [], 0
i = raw.find(_EVENT_RECORD_MARKER, 6)
while 0 <= i and i + 18 <= end:
@@ -1011,15 +967,15 @@ def _embedded_event_record(
<= _EVENT_RECORD_SLACK_S[1])
)
if valid:
found.append((trig, int.from_bytes(raw[i - 2:i], "big"), i))
found.append((trig, int.from_bytes(raw[i - 2:i], "big")))
else:
rejected += 1
i = raw.find(_EVENT_RECORD_MARKER, i + 1)
if len(found) == 1:
return found[0][0], "", found[0][1], found[0][2]
return found[0][0], "", found[0][1]
if found:
return None, f"{len(found)} candidates validate", None, None
return None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate"), None, None
return None, f"{len(found)} candidates validate", None
return None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate"), None
# A histogram's event record: the same lead, the source 0x0400, marker fe f5,
@@ -1045,12 +1001,11 @@ def interval_times(start: datetime.datetime, interval_sec: int,
def _histogram_event_record(
raw: bytes, end: int, start: Optional[datetime.datetime],
stop: Optional[datetime.datetime],
) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime], str, Optional[int]]:
"""(start, stop, "", offset of its `fe f5`) from a histogram's own event
record, or (None, None, why, None). Exactly one record may validate against
the footer's start and stop."""
) -> tuple[Optional[datetime.datetime], Optional[datetime.datetime], str]:
"""(start, stop) from a histogram's own event record, or (None, None, why).
Exactly one record may validate against the footer's start and stop."""
if start is None or stop is None:
return None, None, "the footer has no start and stop to check one against", None
return None, None, "the footer has no start and stop to check one against"
found, rejected = [], 0
i = raw.find(_HISTOGRAM_RECORD_MARKER, 6)
while 0 <= i and i + 18 <= end:
@@ -1059,142 +1014,15 @@ def _histogram_event_record(
and a is not None and b is not None and a <= b
and 0 <= (a - start).total_seconds() <= 1
and 0 <= (stop - b).total_seconds() <= 1):
found.append((a, b, i))
found.append((a, b))
elif raw[i - 6:i - 2] == _EVENT_RECORD_LEAD:
rejected += 1
i = raw.find(_HISTOGRAM_RECORD_MARKER, i + 1)
if len(found) == 1:
return found[0][0], found[0][1], "", found[0][2]
return found[0][0], found[0][1], ""
if found:
return None, None, f"{len(found)} candidates validate", None
return None, None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate"), None
# The event record is the first of a chain of [length uint16 BE][id][payload]
# records, the next starting `length` + 2 bytes after a record's lead (measured
# on all 70,041 DL2 files, 2026-11-06): the event record 0x05, the unit's
# summary 0x32-0x35, its sensor checks 0x3c-0x3f, then the footer 0x0e -- the
# file's last 26 bytes. A unit without a mic has no 0x35 or 0x3f (8 files).
# The walk ends exactly at the file's end on every one, so a chain that does
# not is not read at all.
_RECORD_LEAD_TO_MARKER = 6 # the lead `00 28 05 00` and the source sit before the marker
def _record_chain(raw: bytes, marker_at: int) -> Optional[dict[int, bytes]]:
"""Each record's payload by id (the first of each), for the chain that
starts with the validated event record whose marker is at `marker_at`; None
unless the chain ends exactly at the end of the file."""
off = marker_at - _RECORD_LEAD_TO_MARKER
out: dict[int, bytes] = {}
while off < len(raw):
ln = int.from_bytes(raw[off:off + 2], "big")
if off + 3 > len(raw) or ln < 1 or off + 2 + ln > len(raw):
return None
out.setdefault(raw[off + 2], raw[off + 3:off + 2 + ln])
off += 2 + ln
return out
# The unit's own event summary (measured on DL2, 2026-11-05). The event
# record's payload holds the vector-sum peak's sample at [25:29] (its marker
# + 22). Then one record per channel, 22 bytes (ids 0x32 Tran .. 0x35 MicL):
# [0] 0 [1:3] min [3:5] max (int16 BE; geophones in units of 16 counts)
# [5:9] peak sample [9:11] half-period, samples [11:15] displacement
# integral, units x samples [15:21] probably the unit's own largest sample step
# x 65,536 (inferred), which Blastware does not print: its acceleration is its own
# computation from the samples (_waveform_peak_detail)
# min, max and peak sample equal the samples' own on 25,962 / 25,966 DL2
# channels (the 4 others: O117I1NK.R70W, whose samples wrap at the trigger).
_EVENT_RECORD_ID = 0x05
_SUMMARY_PVS_SAMPLE = slice(25, 29)
_SUMMARY_CHANNELS = {0x32: "Tran", 0x33: "Vert", 0x34: "Long", 0x35: "MicL"}
_SUMMARY_CHANNEL_LEN = 21 # the payload; the record is 22 with its id
def _unit_summary(chain: dict[int, bytes]) -> Optional[dict]:
"""The unit's per-channel event summary from a record chain:
{"pvs_sample": int, "Tran": {...}, ...}, each channel {"min", "max",
"peak_sample", "half_period", "disp_integral"}. None when the chain has no
channel record."""
out: dict = {"pvs_sample": int.from_bytes(chain.get(_EVENT_RECORD_ID, b"")[_SUMMARY_PVS_SAMPLE], "big")}
for rid, ch in _SUMMARY_CHANNELS.items():
p = chain.get(rid)
if p is None or len(p) != _SUMMARY_CHANNEL_LEN:
continue
out[ch] = {
"min": struct.unpack(">h", p[1:3])[0],
"max": struct.unpack(">h", p[3:5])[0],
"peak_sample": int.from_bytes(p[5:9], "big"),
"half_period": int.from_bytes(p[9:11], "big"),
"disp_integral": int.from_bytes(p[11:15], "big"),
}
return out if len(out) > 1 else None
# The sensor check's results, in the header of each sensor-check record (ids
# 0x3c Tran .. 0x3f MicL, whose traces minimateplus.sensor_check decodes).
# Payload: [2] channel type (1 geophone, 2 mic, 0 the check disabled) [4] status,
# 0 = passed [5:7] frequency x 10 [7:9] ratio x 10 [9:11] amplitude, mV.
# Blastware prints them as they are (DL2, 2026-11-06): 209,943 / 209,943
# geophone frequencies and ratios, 69,975 / 69,975 mic frequencies and
# amplitudes; "Passed" on status 0 and "Check" on every other (1 .. 15: its bits
# are not decoded), "Disabled", with nothing else, on type 0.
_SENSOR_CHECK_CHANNELS = {0x3c: "Tran", 0x3d: "Vert", 0x3e: "Long", 0x3f: "MicL"}
_SENSOR_CHECK_HEADER_LEN = 11
def _sensor_check_results(chain: dict[int, bytes]) -> Optional[dict[str, SensorCheckResult]]:
out: dict[str, SensorCheckResult] = {}
for rid, ch in _SENSOR_CHECK_CHANNELS.items():
p = chain.get(rid)
if p is None or len(p) < _SENSOR_CHECK_HEADER_LEN:
continue
kind, status = p[2], p[4]
if kind == 0:
out[ch] = SensorCheckResult("Disabled", status)
continue
r = SensorCheckResult("Passed" if status == 0 else "Check", status,
freq_hz=int.from_bytes(p[5:7], "big") / 10)
if ch == "MicL":
r.amplitude_mv = int.from_bytes(p[9:11], "big")
else:
r.ratio = int.from_bytes(p[7:9], "big") / 10
out[ch] = r
return out or None
# The Monitor Log line Blastware prints for an event is the footer's start and
# stop, then words for the footer's flag word [18:20]: 69,983 / 69,983 DL2
# lines, character for character (2026-11-08). Every DL2 line has "Event
# Recorded"; a session that ended adds how. One line sets Modem and Timer and
# prints Modem, so the higher bit wins -- the order of the others is inferred.
_MONITOR_LOG_RECORDED = 0x0001
_MONITOR_LOG_ENDS = { # highest bit first
0x0800: "Memory Full Exit",
0x0200: "Battery Low Exit",
0x0020: "Modem Exit",
0x0010: "Timer Stop",
0x0008: "Selfcheck Passed",
0x0004: "Remote Exit",
0x0002: "Keyboard Exit",
}
_FOOTER_ID = 0x0E
_FOOTER_LEN = 26
def monitor_log_description(flags: int) -> str:
"""Blastware's Monitor Log words for a footer flag word."""
words = "Event Recorded " if flags & _MONITOR_LOG_RECORDED else ""
end = next((w for bit, w in _MONITOR_LOG_ENDS.items() if flags & bit), None)
return words + (" " + end if end else "")
def _monitor_log(footer: bytes) -> Optional[MonitorLogLine]:
start, stop = _bw._decode_ts_be(footer[2:10]), _bw._decode_ts_be(footer[10:18])
if start is None or stop is None:
return None
flags = int.from_bytes(footer[18:20], "big")
return MonitorLogLine(start, stop, flags, monitor_log_description(flags))
return None, None, f"{len(found)} candidates validate"
return None, None, (f"{rejected} candidate(s), none valid" if rejected else "no candidate")
def _parse_record_time_seconds(raw: bytes) -> Optional[float]:
@@ -1492,13 +1320,12 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
body = raw[body_start : footer_pos]
footer = raw[footer_pos : footer_pos + 26]
# Footer layout (the record chain's last record, id 0e: D.6.13):
# Footer layout:
# [0:2] 0e 08 marker
# [2:10] ts1 (start) BE 8B
# [10:18] ts2 (stop) BE 8B
# [18:20] the monitor log's flag word (_monitor_log)
# [20:22] the trigger source, as in the event record [22:24] 00 00
# [24:26] not identified (no common CRC-16 or 16-bit sum fits)
# [18:24] 00 01 00 02 00 00
# [24:26] crc
ts1 = _bw._decode_ts_be(footer[2:10])
ts2 = _bw._decode_ts_be(footer[10:18])
@@ -1623,15 +1450,13 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
# and its histogram may share a second.
# ⚠ RETRACTED 2026-11-03: "histograms stay on ts1" -- that held only while
# events were unique on (serial, timestamp).
_record_at = None # the validated event record, which the unit's summary follows
if is_waveform_body and ts2 is not None:
_stop = datetime.datetime(ts2.year, ts2.month, ts2.day,
ts2.hour, ts2.minute, ts2.second)
_rt = _parse_record_time_seconds(raw)
_start = (datetime.datetime(ts1.year, ts1.month, ts1.day, ts1.hour, ts1.minute, ts1.second)
if ts1 is not None else None)
_trig, _why, ev.triggered_by, _record_at = _embedded_event_record(
raw, footer_pos, _start, _stop, _rt)
_trig, _why, ev.triggered_by = _embedded_event_record(raw, footer_pos, _start, _stop, _rt)
if _trig is not None:
ev.timestamp_source = "event_record"
else:
@@ -1653,8 +1478,8 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
hour=_trig.hour, minute=_trig.minute, second=_trig.second,
)
elif ts1 is not None:
_start, _hstop, _why, _record_at = (_histogram_event_record(raw, footer_pos, ts1, ts2)
if record_type == "Histogram" else (None, None, "", None))
_start, _hstop, _why = (_histogram_event_record(raw, footer_pos, ts1, ts2)
if record_type == "Histogram" else (None, None, ""))
if _start is not None:
ev.timestamp_source = "event_record"
ev.stop_time = _hstop
@@ -1697,16 +1522,6 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
if (is_waveform_body and ev.peak_values is not None and ev.sample_rate
and ev.pretrig_samples is not None):
_waveform_peak_detail(ev.peak_values, samples, geo_fs, ev.sample_rate, ev.pretrig_samples)
_chain = _record_chain(raw, _record_at) if _record_at is not None else None
_summary = _unit_summary(_chain) if _chain is not None else None
ev.sensor_check_results = _sensor_check_results(_chain) if _chain is not None else None
# A whole chain ends at the file's last byte with the footer, so the last
# 26 bytes are proven to be it.
if _chain is not None and _FOOTER_ID in _chain:
ev.monitor_log = _monitor_log(raw[-_FOOTER_LEN:])
if _summary is not None and ev.peak_values is not None and ev.sample_rate:
_apply_unit_summary(ev.peak_values, _summary, geo_fs, ev.sample_rate,
ev.pretrig_samples if is_waveform_body else None)
if ev.stop_time is None: # a histogram's record stop, else the footer's
ev.stop_time = ts2
if hist_records:
+1 -37
View File
@@ -356,9 +356,6 @@ class PeakValues:
long: Optional[float] = None # Longitudinal PPV (in/s) ✅
micl: Optional[float] = None # Air overpressure (psi) 🔶 (units uncertain)
peak_vector_sum: Optional[float] = None # Scalar geo PVS (in/s) ✅
# ZC frequency (Hz), from the unit's own summary in the file (2026-11-05) or
# a report. Above range, the value is Blastware's threshold (100 Hz at
# 1024 sps) and the flag is set; None is Blastware's "N/A".
tran_zc_freq: Optional[float] = None
vert_zc_freq: Optional[float] = None
long_zc_freq: Optional[float] = None
@@ -367,8 +364,7 @@ class PeakValues:
vert_zc_above_range: bool = False
long_zc_above_range: bool = False
mic_zc_above_range: bool = False
# A waveform's peak detail (2026-11-04); None for a histogram. Times of peak
# are the unit's own peak samples, acceleration comes from the samples.
# A waveform's peak detail, from its samples (2026-11-04); None for a histogram.
tran_time_of_peak: Optional[float] = None # s from the trigger; negative = pre-trigger
vert_time_of_peak: Optional[float] = None
long_time_of_peak: Optional[float] = None
@@ -377,32 +373,6 @@ class PeakValues:
tran_peak_accel_g: Optional[float] = None
vert_peak_accel_g: Optional[float] = None
long_peak_accel_g: Optional[float] = None
# Peak displacement (in), from the unit's own summary (2026-11-05).
tran_peak_disp_in: Optional[float] = None
vert_peak_disp_in: Optional[float] = None
long_peak_disp_in: Optional[float] = None
@dataclass
class SensorCheckResult:
"""One channel's sensor check, as the unit stores it in the event file
(2026-11-06). `result` is Blastware's word for it."""
result: str # "Passed", "Check" or "Disabled"
status: int # the unit's code: 0 passed; its bits are not decoded
freq_hz: Optional[float] = None # geophone resonance / mic test frequency; None when Disabled
ratio: Optional[float] = None # geophones only
amplitude_mv: Optional[int] = None # the mic only
@dataclass
class MonitorLogLine:
"""The Monitor Log line Blastware prints for an event, from the file's
footer (2026-11-08): the monitoring session's start, the stop, and what
happened. Not the live 0x0A browse entries (MonitorLogEntry)."""
start: datetime.datetime
stop: datetime.datetime
flags: int # the footer's flag word
description: str # Blastware's words, e.g. "Event Recorded Modem Exit"
# ── Project / operator metadata ───────────────────────────────────────────────
@@ -614,12 +584,6 @@ class Event:
# Raw ADC counts; the source series' scale differs but the trace is a
# shape diagnostic (rendered fit-to-box). None when absent.
sensor_check: Optional[dict] = None # {"Tran": [...], ..., "MicL": [...]}
# And its results per channel, from the same records (2026-11-06): None
# when the file's record chain is not whole.
sensor_check_results: Optional[dict] = None # channel -> SensorCheckResult
# The event's Monitor Log line (2026-11-08): None unless the file's record
# chain is whole, which proves the footer.
monitor_log: Optional[MonitorLogLine] = None
# Where `timestamp` came from, when decoded from a Blastware binary
# (event_file_io): "event_record" -- the instrument's own event record in
+8 -8
View File
@@ -98,25 +98,25 @@ def _decode_delta_stream(buf: bytes) -> List[int]:
def _find_chain(body: bytes):
"""Locate the length-prefixed sensor-check records.
"""Locate the four length-prefixed sensor-check records.
Returns a list of ``(offset, id, length)`` or ``None``. The chain is
validated by walking the ids 0x3c → 0x3d → 0x3e (→ 0x3f) via their own
length prefixes, so a stray 0x3c byte in the waveform data cannot match.
A unit without a mic has no 0x3f (BE16352, all 8 of its DL2 events,
2026-11-06), so the three geophone records are enough.
validated by walking the ids 0x3c → 0x3d → 0x3e → 0x3f via their own length
prefixes, so a stray 0x3c byte in the waveform data cannot match.
"""
for p in range(len(body) - 6):
if body[p + 2] == 0x3C and body[p + 3] == 0 and body[p + 4] == 0:
q = p
recs = []
ok = True
for expect in _CHAIN_IDS:
if q + 3 > len(body) or body[q + 2] != expect:
ok = False
break
length = int.from_bytes(body[q:q + 2], "big")
recs.append((q, expect, length))
q = q + 2 + length
if len(recs) >= 3:
if ok and len(recs) == 4:
return recs
return None
@@ -124,8 +124,8 @@ def _find_chain(body: bytes):
def decode_sensor_check(raw: bytes) -> Dict[str, List[int]]:
"""Decode the four sensor self-check traces from a series-3 event binary.
Returns ``{"Tran": [...], "Vert": [...], "Long": [...], "MicL": [...]}`` (no
"MicL" on a unit without a mic) in raw decode units (same 16-count LSB as the main waveform), or ``{}`` if the
Returns ``{"Tran": [...], "Vert": [...], "Long": [...], "MicL": [...]}`` in
raw decode units (same 16-count LSB as the main waveform), or ``{}`` if the
binary carries no sensor-check block (a histogram event, a non-series-3
file, or a unit/firmware that doesn't store it).
"""
Binary file not shown.
@@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Event>
<FileVersion>8.0</FileVersion>
<EventType>Full Histogram</EventType>
<SerialNumber>BE9559</SerialNumber>
<Version>V 10.72-8.17 MiniMate Plus</Version>
<FileName>K559HCQ7.IU0H</FileName>
<HistogramStartTime>17:06:30</HistogramStartTime>
<HistogramStartDate>2018-04-02</HistogramStartDate>
<HistogramStopTime>17:07:47</HistogramStopTime>
<HistogramStopDate>2018-04-02</HistogramStopDate>
<Channels>
<Channel>Tran</Channel>
<Channel>Vert</Channel>
<Channel>Long</Channel>
<Channel>MicL</Channel>
</Channels>
<NumberofIntervals>1.00</NumberofIntervals>
<IntervalSize>1 minute</IntervalSize>
<SampleRate>1024 sps</SampleRate>
<BatteryLevel>6.8 Volts</BatteryLevel>
<Calibration>July 24, 2017 by Instantel</Calibration>
<Units>in/s and dB(L)</Units>
<Project>JV 254</Project>
<Client>Walsh Granite JV</Client>
<UserName>TMI- DB</UserName>
<Seis.Loc>Keim Chevrolet</Seis.Loc>
<GeoRange>
<Value>10.000</Value>
<Units>in/s</Units>
</GeoRange>
<TranPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</TranPPV>
<VertPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</VertPPV>
<LongPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</LongPPV>
<TranZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</TranZCFreq>
<VertZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</VertZCFreq>
<LongZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</LongZCFreq>
<TranPeakTime>17:07:30</TranPeakTime>
<TranPeakDate>2018-04-02</TranPeakDate>
<VertPeakTime>17:07:30</VertPeakTime>
<VertPeakDate>2018-04-02</VertPeakDate>
<LongPeakTime>17:07:30</LongPeakTime>
<LongPeakDate>2018-04-02</LongPeakDate>
<PeakVectorSum>
<Value>0.007</Value>
<Units>in/s</Units>
</PeakVectorSum>
<PeakVectorSumTime>17:07:30</PeakVectorSumTime>
<PeakVectorSumDate>2018-04-02</PeakVectorSumDate>
<Microphone>Linear Weighting</Microphone>
<MicLPSPL>
<Value>88.0</Value>
<Units>dB(L)</Units>
</MicLPSPL>
<MicLTime>17:07:30</MicLTime>
<MicLDate>2018-04-02</MicLDate>
<MicLZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</MicLZCFreq>
<TranTestFreq>7.7 Hz.</TranTestFreq>
<TranTestRatio>3.8</TranTestRatio>
<TranTestResults>Passed</TranTestResults>
<VertTestFreq>7.6 Hz.</VertTestFreq>
<VertTestRatio>3.5</VertTestRatio>
<VertTestResults>Passed</VertTestResults>
<LongTestFreq>7.5 Hz.</LongTestFreq>
<LongTestRatio>4.3</LongTestRatio>
<LongTestResults>Passed</LongTestResults>
<MicLTestFreq>20.1 Hz.</MicLTestFreq>
<MicLTestAmplitude>589 mv</MicLTestAmplitude>
<MicLTestResults>Passed</MicLTestResults>
<UsbSummaryChannels>
</UsbSummaryChannels>
<MonitorLog>2018-04-02 17:06:30 - 2018-04-02 17:07:47 &quot;Event Recorded Remote Exit&quot;</MonitorLog>
<HistogramData>
<HistogramDataColumnTitle>
<ColumnTitle> Tran Peak in/s </ColumnTitle>
<ColumnTitle> Tran Freq Hz </ColumnTitle>
<ColumnTitle> Vert Peak in/s </ColumnTitle>
<ColumnTitle> Vert Freq Hz </ColumnTitle>
<ColumnTitle> Long Peak in/s </ColumnTitle>
<ColumnTitle> Long Freq Hz </ColumnTitle>
<ColumnTitle> Geo PVS in/s </ColumnTitle>
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
<ColumnTitle> MicL Freq Hz </ColumnTitle>
</HistogramDataColumnTitle>
<HistogramDataIntervals>
<Time>2018-04-02 17:07:30</Time>
<Row>
<Cell>0.005</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>&gt;100</Cell><Cell>0.007</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>&gt;100</Cell></Row>
</HistogramDataIntervals>
</HistogramData>
<HistogramDataUsbChannels>
</HistogramDataUsbChannels>
</Event>
Binary file not shown.
@@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Event>
<FileVersion>8.0</FileVersion>
<EventType>Full Histogram</EventType>
<SerialNumber>BE18189</SerialNumber>
<Version>V 10.72-8.17 MiniMate Plus</Version>
<FileName>T189INWA.060H</FileName>
<HistogramStartTime>16:04:54</HistogramStartTime>
<HistogramStartDate>2020-10-05</HistogramStartDate>
<HistogramStopTime>16:06:09</HistogramStopTime>
<HistogramStopDate>2020-10-05</HistogramStopDate>
<Channels>
<Channel>Tran</Channel>
<Channel>Vert</Channel>
<Channel>Long</Channel>
<Channel>MicL</Channel>
</Channels>
<NumberofIntervals>1.00</NumberofIntervals>
<IntervalSize>1 minute</IntervalSize>
<SampleRate>1024 sps</SampleRate>
<BatteryLevel>6.8 Volts</BatteryLevel>
<Calibration>August 25, 2020 by Instantel</Calibration>
<Units>in/s and dB(L)</Units>
<Project>CMU-New Scaife Hall- Porter Hall</Project>
<Client>PJ Dick Inc.</Client>
<UserName>Terra-Mechanics, Inc. - D. Harrison</UserName>
<Seis.Loc.>Loc. 3 - Porter Hall</Seis.Loc.>
<GeoRange>
<Value>10.000</Value>
<Units>in/s</Units>
</GeoRange>
<TranPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</TranPPV>
<VertPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</VertPPV>
<LongPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</LongPPV>
<TranZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</TranZCFreq>
<VertZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</VertZCFreq>
<LongZCFreq>
<Value>N/A</Value>
<Units>Hz</Units>
</LongZCFreq>
<TranPeakTime>16:05:54</TranPeakTime>
<TranPeakDate>2020-10-05</TranPeakDate>
<VertPeakTime>16:05:54</VertPeakTime>
<VertPeakDate>2020-10-05</VertPeakDate>
<LongPeakTime>16:05:54</LongPeakTime>
<LongPeakDate>2020-10-05</LongPeakDate>
<PeakVectorSum>
<Value>0.009</Value>
<Units>in/s</Units>
</PeakVectorSum>
<PeakVectorSumTime>16:05:54</PeakVectorSumTime>
<PeakVectorSumDate>2020-10-05</PeakVectorSumDate>
<Microphone>Linear Weighting</Microphone>
<MicLPSPL>
<Value>106.5</Value>
<Units>dB(L)</Units>
</MicLPSPL>
<MicLTime>16:05:54</MicLTime>
<MicLDate>2020-10-05</MicLDate>
<MicLZCFreq>
<Value>73</Value>
<Units>Hz</Units>
</MicLZCFreq>
<TranTestFreq>7.6 Hz.</TranTestFreq>
<TranTestRatio>3.7</TranTestRatio>
<TranTestResults>Passed</TranTestResults>
<VertTestFreq>7.6 Hz.</VertTestFreq>
<VertTestRatio>3.5</VertTestRatio>
<VertTestResults>Passed</VertTestResults>
<LongTestFreq>7.4 Hz.</LongTestFreq>
<LongTestRatio>4.1</LongTestRatio>
<LongTestResults>Passed</LongTestResults>
<MicLTestFreq>0.0 Hz.</MicLTestFreq>
<MicLTestAmplitude>0 mv</MicLTestAmplitude>
<MicLTestResults>Check</MicLTestResults>
<UsbSummaryChannels>
</UsbSummaryChannels>
<MonitorLog>2020-10-05 16:04:53 - 2020-10-05 16:06:09 &quot;Event Recorded Keyboard Exit&quot;</MonitorLog>
<HistogramData>
<HistogramDataColumnTitle>
<ColumnTitle> Tran Peak in/s </ColumnTitle>
<ColumnTitle> Tran Freq Hz </ColumnTitle>
<ColumnTitle> Vert Peak in/s </ColumnTitle>
<ColumnTitle> Vert Freq Hz </ColumnTitle>
<ColumnTitle> Long Peak in/s </ColumnTitle>
<ColumnTitle> Long Freq Hz </ColumnTitle>
<ColumnTitle> Geo PVS in/s </ColumnTitle>
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
<ColumnTitle> MicL Freq Hz </ColumnTitle>
</HistogramDataColumnTitle>
<HistogramDataIntervals>
<Time>2020-10-05 16:05:54</Time>
<Row>
<Cell>0.005</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>N/A</Cell><Cell>0.009</Cell><Cell>0.001</Cell><Cell>106.5</Cell><Cell>73</Cell></Row>
</HistogramDataIntervals>
</HistogramData>
<HistogramDataUsbChannels>
</HistogramDataUsbChannels>
</Event>
Binary file not shown.
@@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Event>
<FileVersion>8.0</FileVersion>
<EventType>Full Histogram</EventType>
<SerialNumber>BE18189</SerialNumber>
<Version>V 10.72-8.17 MiniMate Plus</Version>
<FileName>T189JZY7.L60H</FileName>
<HistogramStartTime>20:00:42</HistogramStartTime>
<HistogramStartDate>2023-04-27</HistogramStartDate>
<HistogramStopTime>20:01:42</HistogramStopTime>
<HistogramStopDate>2023-04-27</HistogramStopDate>
<Channels>
<Channel>Tran</Channel>
<Channel>Vert</Channel>
<Channel>Long</Channel>
<Channel>MicL</Channel>
</Channels>
<NumberofIntervals>1.00</NumberofIntervals>
<IntervalSize>1 minute</IntervalSize>
<SampleRate>1024 sps</SampleRate>
<BatteryLevel>6.8 Volts</BatteryLevel>
<Calibration>February 21, 2023 by Instantel</Calibration>
<Units>in/s and dB(L)</Units>
<Project>I-70 at SR 51-75978 - Loc 1 - 4256 SR51</Project>
<Client>Golden Triangle</Client>
<UserName>Terra-Mechanics Inc. - B. Harrison</UserName>
<SeisLoc>Location #1 - 4256 SR 51 - Intec</SeisLoc>
<GeoRange>
<Value>10.000</Value>
<Units>in/s</Units>
</GeoRange>
<TranPPV>
<Value>0.015</Value>
<Units>in/s</Units>
</TranPPV>
<VertPPV>
<Value>0.020</Value>
<Units>in/s</Units>
</VertPPV>
<LongPPV>
<Value>0.015</Value>
<Units>in/s</Units>
</LongPPV>
<TranZCFreq>
<Value>N/A</Value>
<Units>Hz</Units>
</TranZCFreq>
<VertZCFreq>
<Value>14</Value>
<Units>Hz</Units>
</VertZCFreq>
<LongZCFreq>
<Value>N/A</Value>
<Units>Hz</Units>
</LongZCFreq>
<TranPeakTime>20:01:42</TranPeakTime>
<TranPeakDate>2023-04-27</TranPeakDate>
<VertPeakTime>20:01:42</VertPeakTime>
<VertPeakDate>2023-04-27</VertPeakDate>
<LongPeakTime>20:01:42</LongPeakTime>
<LongPeakDate>2023-04-27</LongPeakDate>
<PeakVectorSum>
<Value>0.027</Value>
<Units>in/s</Units>
</PeakVectorSum>
<PeakVectorSumTime>20:01:42</PeakVectorSumTime>
<PeakVectorSumDate>2023-04-27</PeakVectorSumDate>
<Microphone>Linear Weighting</Microphone>
<MicLPSPL>
<Value>91.5</Value>
<Units>dB(L)</Units>
</MicLPSPL>
<MicLTime>20:01:42</MicLTime>
<MicLDate>2023-04-27</MicLDate>
<MicLZCFreq>
<Value>N/A</Value>
<Units>Hz</Units>
</MicLZCFreq>
<TranTestFreq>7.6 Hz.</TranTestFreq>
<TranTestRatio>3.8</TranTestRatio>
<TranTestResults>Passed</TranTestResults>
<VertTestFreq>7.6 Hz.</VertTestFreq>
<VertTestRatio>3.5</VertTestRatio>
<VertTestResults>Passed</VertTestResults>
<LongTestFreq>7.5 Hz.</LongTestFreq>
<LongTestRatio>4.0</LongTestRatio>
<LongTestResults>Passed</LongTestResults>
<MicLTestFreq>19.7 Hz.</MicLTestFreq>
<MicLTestAmplitude>577 mv</MicLTestAmplitude>
<MicLTestResults>Passed</MicLTestResults>
<UsbSummaryChannels>
</UsbSummaryChannels>
<MonitorLog>2023-04-27 20:00:41 - 2023-04-27 20:01:42 &quot;Event Recorded Battery Low Exit&quot;</MonitorLog>
<HistogramData>
<HistogramDataColumnTitle>
<ColumnTitle> Tran Peak in/s </ColumnTitle>
<ColumnTitle> Tran Freq Hz </ColumnTitle>
<ColumnTitle> Vert Peak in/s </ColumnTitle>
<ColumnTitle> Vert Freq Hz </ColumnTitle>
<ColumnTitle> Long Peak in/s </ColumnTitle>
<ColumnTitle> Long Freq Hz </ColumnTitle>
<ColumnTitle> Geo PVS in/s </ColumnTitle>
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
<ColumnTitle> MicL Freq Hz </ColumnTitle>
</HistogramDataColumnTitle>
<HistogramDataIntervals>
<Time>2023-04-27 20:01:42</Time>
<Row>
<Cell>0.015</Cell><Cell>N/A</Cell><Cell>0.020</Cell><Cell>14</Cell><Cell>0.015</Cell><Cell>N/A</Cell><Cell>0.027</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>N/A</Cell></Row>
</HistogramDataIntervals>
</HistogramData>
<HistogramDataUsbChannels>
</HistogramDataUsbChannels>
</Event>
Binary file not shown.
@@ -1,116 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<Event>
<FileVersion>8.0</FileVersion>
<EventType>Full Histogram</EventType>
<SerialNumber>BE18192</SerialNumber>
<Version>V 10.72-8.17 MiniMate Plus</Version>
<FileName>T192JWEL.0Y0H</FileName>
<HistogramStartTime>21:58:10</HistogramStartTime>
<HistogramStartDate>2023-02-17</HistogramStartDate>
<HistogramStopTime>22:00:00</HistogramStopTime>
<HistogramStopDate>2023-02-17</HistogramStopDate>
<Channels>
<Channel>Tran</Channel>
<Channel>Vert</Channel>
<Channel>Long</Channel>
<Channel>MicL</Channel>
</Channels>
<NumberofIntervals>1.00</NumberofIntervals>
<IntervalSize>1 minute</IntervalSize>
<SampleRate>1024 sps</SampleRate>
<BatteryLevel>7.0 Volts</BatteryLevel>
<Calibration>September 15, 2022 by Instantel</Calibration>
<Units>in/s and dB(L)</Units>
<Project>Trumbull-Berkeley By.-Loc 2-85 Pennsyl</Project>
<Client>Trumbull Corporation</Client>
<UserName>Terra-Mechanics Inc - D Harrison</UserName>
<SeisLoc>Loc #2- 85 Pennsylvania Lane</SeisLoc>
<GeoRange>
<Value>10.000</Value>
<Units>in/s</Units>
</GeoRange>
<TranPPV>
<Value>0.010</Value>
<Units>in/s</Units>
</TranPPV>
<VertPPV>
<Value>0.010</Value>
<Units>in/s</Units>
</VertPPV>
<LongPPV>
<Value>0.010</Value>
<Units>in/s</Units>
</LongPPV>
<TranZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</TranZCFreq>
<VertZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</VertZCFreq>
<LongZCFreq>
<Value>&gt;100</Value>
<Units>Hz</Units>
</LongZCFreq>
<TranPeakTime>21:59:10</TranPeakTime>
<TranPeakDate>2023-02-17</TranPeakDate>
<VertPeakTime>21:59:10</VertPeakTime>
<VertPeakDate>2023-02-17</VertPeakDate>
<LongPeakTime>21:59:10</LongPeakTime>
<LongPeakDate>2023-02-17</LongPeakDate>
<PeakVectorSum>
<Value>0.014</Value>
<Units>in/s</Units>
</PeakVectorSum>
<PeakVectorSumTime>21:59:10</PeakVectorSumTime>
<PeakVectorSumDate>2023-02-17</PeakVectorSumDate>
<Microphone>Linear Weighting</Microphone>
<MicLPSPL>
<Value>120.0</Value>
<Units>dB(L)</Units>
</MicLPSPL>
<MicLTime>21:59:10</MicLTime>
<MicLDate>2023-02-17</MicLDate>
<MicLZCFreq>
<Value>8.8</Value>
<Units>Hz</Units>
</MicLZCFreq>
<TranTestFreq>7.4 Hz.</TranTestFreq>
<TranTestRatio>4.1</TranTestRatio>
<TranTestResults>Passed</TranTestResults>
<VertTestFreq>7.7 Hz.</VertTestFreq>
<VertTestRatio>3.6</VertTestRatio>
<VertTestResults>Passed</VertTestResults>
<LongTestFreq>7.4 Hz.</LongTestFreq>
<LongTestRatio>4.2</LongTestRatio>
<LongTestResults>Passed</LongTestResults>
<MicLTestFreq>19.7 Hz.</MicLTestFreq>
<MicLTestAmplitude>688 mv</MicLTestAmplitude>
<MicLTestResults>Passed</MicLTestResults>
<UsbSummaryChannels>
</UsbSummaryChannels>
<MonitorLog>2023-02-17 21:58:09 - 2023-02-17 22:00:00 &quot;Event Recorded Timer Stop&quot;</MonitorLog>
<HistogramData>
<HistogramDataColumnTitle>
<ColumnTitle> Tran Peak in/s </ColumnTitle>
<ColumnTitle> Tran Freq Hz </ColumnTitle>
<ColumnTitle> Vert Peak in/s </ColumnTitle>
<ColumnTitle> Vert Freq Hz </ColumnTitle>
<ColumnTitle> Long Peak in/s </ColumnTitle>
<ColumnTitle> Long Freq Hz </ColumnTitle>
<ColumnTitle> Geo PVS in/s </ColumnTitle>
<ColumnTitle> MicL Peak psi(L) </ColumnTitle>
<ColumnTitle> MicL Peak dB(L) </ColumnTitle>
<ColumnTitle> MicL Freq Hz </ColumnTitle>
</HistogramDataColumnTitle>
<HistogramDataIntervals>
<Time>2023-02-17 21:59:10</Time>
<Row>
<Cell>0.010</Cell><Cell>&gt;100</Cell><Cell>0.010</Cell><Cell>&gt;100</Cell><Cell>0.010</Cell><Cell>&gt;100</Cell><Cell>0.014</Cell><Cell>0.003</Cell><Cell>120.0</Cell><Cell>8.8</Cell></Row>
</HistogramDataIntervals>
</HistogramData>
<HistogramDataUsbChannels>
</HistogramDataUsbChannels>
</Event>
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
File diff suppressed because it is too large. Load diff
Binary file not shown.
Binary file not shown.
Binary file not shown.
-189
View File
@@ -522,192 +522,3 @@ def test_waveform_peak_detail_comes_from_the_samples(rel, times, pvs_time, accel
def test_a_histogram_has_no_waveform_peak_detail():
pv = read_blastware_file(_FIX / "decode-checker-10-29-26/T004JTRF.ME0H").peak_values
assert (pv.tran_time_of_peak, pv.pvs_time, pv.tran_peak_accel_g) == (None, None, None)
# ── Group D, part 2: the unit's own event summary ───────────────────────────
# After its embedded event record a file carries the unit's per-channel summary,
# one 24-byte record each (ids 0x32 Tran .. 0x35 MicL): min, max, peak sample,
# half-period and a displacement integral (measured on DL2, 2026-11-05):
# ZC frequency = (rate / 2) / half-period: 15,844 / 15,844 waveform values and
# 104,000 / 104,000 histogram values; every word too (">100" at <= 5 samples,
# "N/A" at 0, "<1.0" beyond rate / 2)
# displacement = integral x 16 counts x in/s per count / rate / 2: 19,479 / 19,479
# Every expected value below is Blastware's own, from the file's _XML.XML report.
_US = "unit-summary-11-05-26"
def _prints_as(value, printed):
d = len(printed.split(".")[1]) if "." in printed else 0
return abs(value - float(printed)) <= 0.5 * 10 ** -d + 1e-9
@pytest.mark.parametrize("rel,printed", [
# (Tran, Vert, Long, MicL) ZC Freq as Blastware prints it; None = no channel
(f"{_US}/I145L6UJ.3Y0W", ("43", "37", "39", "43")), # 1024 sps
(f"{_US}/K557L7FX.SC0W", (">200", "171", ">200", "26")), # 2048 sps
(f"{_US}/R349KMF7.9O0W", ("17.4", "66", "12.6", "19.5")), # 4096 sps
(f"{_US}/K558IKSJ.P20W", ("N/A", "<1.0", "N/A", "N/A")),
(f"{_US}/O117I1NK.R70W", (">100", ">100", ">100", ">100")),
(f"{_US}/R352HFZ7.5D0W", ("73", "30", "24", None)), # a unit without a mic
(f"{_US}/T193HLJ3.X80H", (">100", ">100", "73", "57")), # a histogram
])
def test_zc_frequency_is_the_units_own(rel, printed):
pv = read_blastware_file(_FIX / rel).peak_values
for ch, want in zip(("tran", "vert", "long", "mic"), printed):
got, above = getattr(pv, f"{ch}_zc_freq"), getattr(pv, f"{ch}_zc_above_range")
if want in (None, "N/A"):
assert (got, above) == (None, False), ch
elif want.startswith(">"):
assert (got, above) == (float(want[1:]), True), ch # Blastware's threshold, flagged
elif want == "<1.0":
assert 0 < got < 1.0 and not above, (ch, got)
else:
assert _prints_as(got, want) and not above, (ch, got, want)
@pytest.mark.parametrize("rel,printed", [
(f"{_US}/I145L6UJ.3Y0W", ("0.000", "0.000", "0.000")),
(f"{_US}/K558IKSJ.P20W", ("0.000", "0.046", "0.000")),
(f"{_US}/R349KMF7.9O0W", ("0.004", "0.001", "0.012")), # 4096 sps
(f"{_US}/R352HFZ7.5D0W", ("0.003", "0.010", "0.006")),
(f"{_US}/O117I1NK.R70W", ("1.480", "1.483", "2.616")), # clipped: beyond the samples
])
def test_peak_displacement_is_the_units_own(rel, printed):
pv = read_blastware_file(_FIX / rel).peak_values
for ch, want in zip(("tran", "vert", "long"), printed):
got = getattr(pv, f"{ch}_peak_disp_in")
assert got is not None and _prints_as(got, want), (ch, got, want)
def test_a_histogram_has_no_peak_displacement():
pv = read_blastware_file(_FIX / f"{_US}/T193HLJ3.X80H").peak_values
assert (pv.tran_peak_disp_in, pv.vert_peak_disp_in, pv.long_peak_disp_in) == (None, None, None)
def test_time_of_peak_is_the_units_own_peak_sample():
# O117I1NK clips: its stored samples wrap at the trigger, so their largest
# lands elsewhere, but the unit's summary has every peak at the trigger --
# Blastware prints 0.000 on all four channels and the vector sum.
pv = read_blastware_file(_FIX / f"{_US}/O117I1NK.R70W").peak_values
for ch in ("tran", "vert", "long", "micl"):
assert getattr(pv, f"{ch}_time_of_peak") == 0.0, ch
assert pv.pvs_time == 0.0
def test_an_unreadable_channel_record_leaves_only_that_channel_unread():
raw = bytearray((_FIX / f"{_US}/I145L6UJ.3Y0W").read_bytes())
i = raw.find(b"\x00\x16\x32")
raw[i + 2] = 0x00 # break the Tran record's id; the chain holds
pv = decode_blastware_bytes(bytes(raw), name=None).peak_values
assert (pv.tran_zc_freq, pv.tran_peak_disp_in) == (None, None)
assert abs(pv.tran_time_of_peak - 2.281) <= 0.0005 # the samples' peak, as before
assert _prints_as(pv.mic_zc_freq, "43") # the others are read
def test_without_a_whole_record_chain_nothing_is_guessed():
# The chain from the event record ends exactly at the file's end on all
# 70,041 DL2 files; one that does not is not read at all.
raw = bytearray((_FIX / f"{_US}/I145L6UJ.3Y0W").read_bytes())
i = raw.find(b"\x00\xd4\x3c") # the Tran sensor-check record, length 212
raw[i + 1] = 0xd3 # one byte short
ev = decode_blastware_bytes(bytes(raw), name=None)
assert ev.sensor_check_results is None
pv = ev.peak_values
assert (pv.tran_zc_freq, pv.mic_zc_freq, pv.tran_peak_disp_in) == (None, None, None)
# ── Group E: the sensor check results ───────────────────────────────────────
# Records 0x3c Tran .. 0x3f MicL, after the unit's summary, carry the sensor
# check the unit ran: its trace (minimateplus.sensor_check) and, in the record's
# header, its results (measured on DL2, 2026-11-06):
# [2] channel type (1 geophone, 2 mic, 0 check disabled) [4] status, 0 = passed
# [5:7] frequency x 10 [7:9] ratio x 10 [9:11] amplitude, mV
# Blastware prints them as they are: 209,943 / 209,943 geophone frequencies and
# ratios, 69,975 / 69,975 mic frequencies and amplitudes; "Passed" on status 0,
# "Check" on every other status, "Disabled" on type 0.
@pytest.mark.parametrize("rel,want", [
# channel: (result, frequency Hz, ratio, amplitude mV), Blastware's _XML.XML
(f"{_US}/I145L6UJ.3Y0W", {"Tran": ("Passed", 7.3, 3.7, None), "Vert": ("Passed", 7.2, 3.9, None),
"Long": ("Passed", 7.2, 3.9, None), "MicL": ("Passed", 19.7, None, 592)}),
(f"{_US}/K440HJCN.AS0W", {"Tran": ("Check", 9.6, 13.8, None), "Vert": ("Check", 8.5, 7.2, None),
"Long": ("Passed", 7.3, 1.9, None), "MicL": ("Passed", 19.7, None, 519)}),
(f"{_US}/R349KMF7.9O0W", {"Tran": ("Passed", 7.4, 3.8, None), "Vert": ("Passed", 7.5, 3.5, None),
"Long": ("Passed", 7.8, 3.6, None), "MicL": ("Check", 0.0, None, 0)}),
(f"{_US}/R352HFZ7.5D0W", {"Tran": ("Disabled", None, None, None), # no mic; check disabled
"Vert": ("Disabled", None, None, None),
"Long": ("Disabled", None, None, None)}),
(f"{_US}/T193HLJ3.X80H", {"Tran": ("Passed", 7.4, 3.9, None), "Vert": ("Passed", 7.2, 3.9, None),
"Long": ("Passed", 7.5, 4.1, None), "MicL": ("Passed", 20.1, None, 556)}),
])
def test_sensor_check_results_are_the_units_own(rel, want):
got = read_blastware_file(_FIX / rel).sensor_check_results
assert set(got) == set(want)
for ch, (result, freq, ratio, amp) in want.items():
r = got[ch]
assert r.result == result, ch
assert r.freq_hz == (pytest.approx(freq) if freq is not None else None), ch
assert r.ratio == (pytest.approx(ratio) if ratio is not None else None), ch
assert r.amplitude_mv == amp, ch
def test_a_check_keeps_the_units_status_code():
# Blastware prints only "Check"; the code's bits are not decoded (K559L6N1's
# Tran is a Check at 8.1 Hz and 3.3, inside every passing range).
got = read_blastware_file(_FIX / f"{_US}/K440HJCN.AS0W").sensor_check_results
assert [got[ch].status for ch in ("Tran", "Vert", "Long", "MicL")] == [11, 2, 0, 0]
# ── Group F: the monitor log ────────────────────────────────────────────────
# Blastware prints one Monitor Log line per event: the footer's start and stop,
# and words from the footer's flag word [18:20]. 69,983 / 69,983 DL2 lines,
# character for character (2026-11-08). Expected lines are Blastware's own,
# from each file's _XML.XML report.
_ML = "monitor-log-11-08-26"
def _log_line(ml):
return f'{ml.start:%Y-%m-%d %H:%M:%S} - {ml.stop:%Y-%m-%d %H:%M:%S} "{ml.description}"'
@pytest.mark.parametrize("rel,line", [
(f"{_US}/I145L6UJ.3Y0W", '2025-08-08 18:23:55 - 2025-08-08 18:24:01 "Event Recorded "'),
(f"{_US}/O117I1NK.R70W", '2019-07-31 06:59:31 - 2019-07-31 06:59:33 "Event Recorded "'),
(f"{_US}/T193HLJ3.X80H", '2018-09-20 20:07:55 - 2018-09-21 13:20:01 "Event Recorded Modem Exit"'),
(f"{_ML}/T189INWA.060H", '2020-10-05 16:04:53 - 2020-10-05 16:06:09 "Event Recorded Keyboard Exit"'),
(f"{_ML}/K559HCQ7.IU0H", '2018-04-02 17:06:30 - 2018-04-02 17:07:47 "Event Recorded Remote Exit"'),
(f"{_ML}/T192JWEL.0Y0H", '2023-02-17 21:58:09 - 2023-02-17 22:00:00 "Event Recorded Timer Stop"'),
(f"{_ML}/T189JZY7.L60H", '2023-04-27 20:00:41 - 2023-04-27 20:01:42 "Event Recorded Battery Low Exit"'),
])
def test_the_monitor_log_is_the_footers(rel, line):
assert _log_line(read_blastware_file(_FIX / rel).monitor_log) == line
from minimateplus.event_file_io import monitor_log_description # noqa: E402
@pytest.mark.parametrize("flags,words", [
(0x0001, "Event Recorded "),
(0x0003, "Event Recorded Keyboard Exit"),
(0x0005, "Event Recorded Remote Exit"),
(0x0009, "Event Recorded Selfcheck Passed"),
(0x0011, "Event Recorded Timer Stop"),
(0x0021, "Event Recorded Modem Exit"),
(0x0201, "Event Recorded Battery Low Exit"),
(0x0801, "Event Recorded Memory Full Exit"),
# One DL2 line sets Modem and Timer; Blastware prints Modem: the higher
# bit wins (one file, so the order of the others is inferred).
(0x0031, "Event Recorded Modem Exit"),
])
def test_the_monitor_log_words(flags, words):
assert monitor_log_description(flags) == words
def test_without_a_whole_record_chain_there_is_no_monitor_log():
raw = bytearray((_FIX / f"{_US}/I145L6UJ.3Y0W").read_bytes())
i = raw.find(b"\x00\xd4\x3c")
raw[i + 1] = 0xd3 # one byte short: the footer is not proven
assert decode_blastware_bytes(bytes(raw), name=None).monitor_log is None
+4 -80
View File
@@ -40,10 +40,8 @@ def test_event_type_comes_from_the_bytes():
def test_report_fields_stay_blank():
s = sfm_side((FIX / "T1905KDW.5F0W").read_bytes())
# (BatteryLevel and Calibration are read since 2026-11-03, peak acceleration
# since 2026-11-04, ZC frequency and displacement since 2026-11-05:
# test_the_setup_fields_match_blastware, test_waveform_peak_detail_*,
# test_zc_frequency_and_displacement_match_blastware. Its Tran ZC is N/A.)
for tag in ("TranZCFreq",): # (sensor check results since 2026-11-06)
# since 2026-11-04: test_the_setup_fields_match_blastware, test_waveform_peak_detail_*)
for tag in ("TranZCFreq", "TranPeakDisplacement", "TranTestResults"):
assert s.values.get(tag) is None
@@ -69,7 +67,7 @@ def test_full_waveform_row_verdicts():
for f in ("SampleRate", "RecordTime", "Pre-triggerLength", "EventDate", "EventTime",
"notes", "samples.Tran", "samples.Vert", "samples.Long"):
assert res[f].verdict == "match", (f, res[f])
assert res["TranZCFreq"].verdict == "match" # ">100", the unit's own (2026-11-05)
assert res["TranZCFreq"].verdict in ("sfm_blank", "no_reference")
assert res["BatteryLevel"].verdict == "match" # 6.72 V, printed "6.7 Volts"
assert "FileName" not in res
@@ -93,7 +91,7 @@ def test_an_extra_reference_row_is_a_mismatch_with_detail():
def test_zc_frequency_na_and_above_range():
res = _results("T1905KDW.5F0W") # its JobNumber: test_the_job_number_matches_blastware
assert res["TranZCFreq"].verdict == "no_reference" # N/A
assert res["VertZCFreq"].verdict == "match" # >100: the unit's half-period
assert res["VertZCFreq"].verdict == "sfm_blank" # >100, SFM has no flag yet
def test_mic_units_pick_the_conversion():
@@ -357,77 +355,3 @@ def test_waveform_peak_detail_matches_blastware(path):
"PeakVectorSumTimeSum", "TranPeakAcceleration", "VertPeakAcceleration",
"LongPeakAcceleration"):
assert res[f].verdict == "match", (f, res[f])
# ── Group D, part 2: the unit's own summary (2026-11-05) ────────────────────
_US = FIX.parent / "unit-summary-11-05-26"
_ZC_AND_DISP = ([f"{ch}ZCFreq" for ch in ("Tran", "Vert", "Long", "MicL")]
+ [f"{ch}PeakDisplacement" for ch in ("Tran", "Vert", "Long")])
@pytest.mark.parametrize("path", [
FIX / "R352HIUI.F40W", FIX / "T1905KDW.5F0W",
FIX.parent / "setup-fields-11-03-26" / "T189HUD6.QE0W",
FIX / "T004JTRF.ME0H", FIX / "M529L4XQ.R30H", # histograms
_US / "K558IKSJ.P20W", # "<1.0" and N/A
_US / "O117I1NK.R70W", # the mic's ">100"; clipped
])
def test_zc_frequency_and_displacement_match_blastware(path):
ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML"))
res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)}
checked = 0
for f in _ZC_AND_DISP:
printed = ref.scalars.get(f)
if printed is None:
continue
want = "no_reference" if printed == "N/A" else "match"
assert res[f].verdict == want, (f, res[f])
checked += want == "match"
assert checked >= 3
def test_a_clipped_events_peak_times_match_blastware():
path = _US / "O117I1NK.R70W"
ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML"))
res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)}
for f in ("TranTimeofPeak", "VertTimeofPeak", "LongTimeofPeak", "MicLTimeofPeak",
"PeakVectorSumTimeSum"):
assert res[f].verdict == "match", (f, res[f])
# ── Group E: the sensor check results (2026-11-06) ──────────────────────────
_SENSOR_CHECK = [f"{ch}Test{f}" for ch in ("Tran", "Vert", "Long", "MicL")
for f in ("Results", "Freq", "Ratio", "Amplitude")]
@pytest.mark.parametrize("path", [
FIX / "R352HIUI.F40W", FIX / "T1905KDW.5F0W", FIX / "T004JTRF.ME0H", FIX / "M529L4XQ.R30H",
_US / "K440HJCN.AS0W", # two Checks
_US / "K558IKSJ.P20W", _US / "O117I1NK.R70W",
])
def test_sensor_check_results_match_blastware(path):
ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML"))
res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)}
checked = 0
for f in _SENSOR_CHECK:
if ref.scalars.get(f) is None:
continue
assert res[f].verdict == "match", (f, res[f])
checked += 1
assert checked >= 4
# ── Group F: the monitor log (2026-11-08) ───────────────────────────────────
_ML = FIX.parent / "monitor-log-11-08-26"
@pytest.mark.parametrize("path", [
FIX / "R352HIUI.F40W", FIX / "T004JTRF.ME0H", FIX / "M529L4XQ.R30H",
_US / "K440HJCN.AS0W", _US / "O117I1NK.R70W",
_ML / "T189INWA.060H", _ML / "K559HCQ7.IU0H", _ML / "T192JWEL.0Y0H", _ML / "T189JZY7.L60H",
])
def test_the_monitor_log_matches_blastware(path):
ref = parse_xml_report_file(path.with_name(path.name.replace(".", "_", 1) + "_XML.XML"))
res = {r.field: r for r in compare(sfm_side(path.read_bytes()), ref, CARVEOUTS)}
assert res["MonitorLog"].verdict == "match", res["MonitorLog"]
-11
View File
@@ -65,14 +65,3 @@ def test_mic_channel_is_a_pulse_train():
def test_returns_empty_when_no_sensor_check_block():
assert decode_sensor_check(b"not a blastware file") == {}
assert decode_sensor_check(b"") == {}
def test_a_unit_without_a_mic_has_its_three_geophone_traces():
# BE16352 records no mic: its chain carries 0x3c-0x3e only (all 8 of its
# DL2 events, 2026-11-06), and the three ring-downs were being dropped.
raw = (Path(__file__).parent / "fixtures" / "decode-checker-10-29-26" / "R352HFZ7.530H").read_bytes()
sc = decode_sensor_check(raw)
assert set(sc) == {"Tran", "Vert", "Long"}
for ch in ("Tran", "Vert", "Long"):
tr = np.asarray(sc[ch], dtype=float)
assert len(tr) > 200 and tr.min() < -500, (ch, len(tr), tr.min())