merge: dev into feat/series4-sfm-parity -- the geophone range from the file, and v0.33.0

Brings 057df47 (fix 4844135, changelog be58b4f) from the decode checker's branch
-- Event.geo_range from the file's setup channel block (label+29: 0 Normal,
1 Sensitive, None not read), peaks and histogram PVS scaled by it,
write_event_hdf5(geo_range=None) using it -- and dev's v0.33.0 release commit
(6c7c6b0).

Conflicts, resolved as agreed with the decode session:
- sfm/waveform_store.py save_imported_bw: dev dropped the forced
  geo_range="normal"; this branch keeps its geo_range parameter, now
  Optional, default None -- an import uses the file's own range, an explicit
  value (a live download's) still wins.
- CLAUDE.md: dev's newer 'Where things stand (updated 2026-11-01)' date.

Measured on the merged tree: K557J1KB.RQ0W (Sensitive waveform) decodes
0.019 / 0.055 / 0.019, PVS 0.061 -- Blastware's report -- and its imported
.h5 peaks 0.0194 / 0.055 / 0.0194 (forcing 'normal' gives 8x: 0.155 / 0.44).
M010HR6K.OA0H (Sensitive histogram) likewise.  The live path still passes the
unit's 1A range or 'normal' when unread -- unchanged by this merge.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01SyJ2ip3Krb6dtdv2cXua44
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-02 12:06:35 -05:00
commit d0c14aaec8
17 files changed
+3724 -62

No files matched your search

+107
View File
@@ -6,6 +6,71 @@ All notable changes to seismo-relay are documented here.
## Unreleased
### Fixed
- **A Blastware file's geophone range comes from its setup, so Sensitive
events no longer read 8× high.**
- **Where it is:** in the setup's channel blocks, the byte 29 after each
geophone label. `0x00` is Normal (10 in/s full scale), `0x01` is Sensitive
(1.25 in/s). SFM's live 1A read has the same byte at label+33.
- **Measured:** it matches Blastware's GeoRange on 70,042 / 70,042 DL2
events, all three channels agreeing on every one (35 Sensitive).
- **Before:** SFM assumed Normal, so every Sensitive event's peaks, vector
sum and `.h5` samples read 8× high.
- **`Event.geo_range`** is new: 0 or 1, or None when it isn't read (the
channels disagree, an unknown value, or a missing block). None comes with
a `decode_problems` entry, and peaks then assume Normal as before.
- **`decode_blastware_bytes`** scales peaks and the histogram vector sum by
the range.
- **`event_hdf5.write_event_hdf5`:** `geo_range` now defaults to None,
meaning the event's own range, else Normal. An explicit argument still
wins.
- **`waveform_store.save_imported_bw` and `scripts/backfill_sidecars.py`**
no longer force `"normal"`. The `waveform_store` line was agreed with the
parity session, which owns that file.
- **Decode checker:** GeoRange 70,042 / 70,042, and geophone samples exact
on **6,524 / 6,524** waveforms (was 6,491). PPV mismatches about halved,
and 10 of 88 fields fully match (was 6). 70,287 comparisons fixed, 0
regressions.
- ⚠ **Codec change: bump `TOOL_VERSION` at the next release.** The backfill
(`backfill_sidecars.py` then `backfill_event_shape.py`) rewrites stored
Sensitive events' peaks and `.h5` files. No schema change.
## v0.33.0 — 2026-11-01
**SFM reads Series-3 events from the file alone, and proves it against
Blastware.**
**What was broken.** A Blastware event that reached SFM without its ASCII
report used to come in half-decoded:
- no sample rate
- a "70 s" record time, which was really the record-type byte
- blank notes
- every histogram typed as a waveform
- a histogram vector sum built from channel peaks taken at different moments
- a mic reading about 95× low in psi
That matters more now: every DL2 event from before 2025 arrives with no report,
and SFM's own download and call-in paths never have one.
**What this release does.** It reads all of those from the event file itself,
and adds the decode checker that proves it. The checker compares SFM's
file-only decode, field by field and sample by sample, with Blastware's own
`_XML.XML` event reports for the 70,042 DL2 events that have one (2016–2026).
**Where that stands now:**
- sample rate, record time, pre-trigger, notes and event type match on every
event
- geophone samples are exact on 6,491 / 6,524 waveforms (the 33 others are on
the 1.250 in/s range, which SFM cannot read from the file yet)
- the histogram vector sum matches on 69,919
- the mic matches on all but a few dozen
Events imported with an ASCII report are unchanged on prod; the report still
overlays.
⚠ **This release owes prod a backfill.** It does not move stored event times;
see *Migration* below.
### Fixed
- **The mic in psi was ~95× low: one MicL count is 0.25 Pa.**
- SFM converted mic counts with a "~0.5 psi full-scale" guess (0.0125 /
@@ -163,6 +228,9 @@ All notable changes to seismo-relay are documented here.
- job number, ZC frequency, acceleration, displacement, time of peak,
sensor check, battery, calibration, range, units and monitor log
are not read yet
- Later in this release, the record type (#41), the histogram vector sum
and the mic conversion were fixed. See their entries above; each was
proven by a full checker run with 0 regressions.
- It replaces `scratch/verify_bw_fields_against_xml.py`, added and
removed within this release.
- **Operational consequence: none.** Nothing on the ingest path changes.
@@ -191,6 +259,45 @@ All notable changes to seismo-relay are documented here.
The old section stays below the banner as history.
Docs only: no code or schema change, no migration, `TOOL_VERSION` unchanged.
### Migration
⚠ **This release owes prod a backfill.** It does not move stored event times.
**Before you start:**
- `TOOL_VERSION` is bumped to **0.33.0**, which gates the regeneration, so no
`--force` is needed.
- No parser change, so no `--reparse-txt` is needed.
- No schema change.
- **Back up `seismo_relay.db` first.**
**Then, in the `sfm` container, in this order** (the scripts default to
`bridges/captures/seismo_relay.db` and its `waveforms/`):
1. `python scripts/backfill_sidecars.py` re-decodes every Series-3 event file
whose sidecar predates 0.33.0. Sidecars and `.h5` files regenerate, and each
DB row refreshes in place (id and review kept). ⚠ **~2 h on the NAS.**
- **Report-less events** pick up the new values: sample rate, record time,
pre-trigger, notes, record type, histogram vector sum, mic.
- **Report-paired events** keep the report's values.
- **The record type** stays the same for every ACH file (`…W` / `…H`). Only a
histogram stored under a 3-character manual-download name flips from
Waveform to Histogram.
2. `python scripts/backfill_event_shape.py --db-path bridges/captures/seismo_relay.db
--store-root bridges/captures/waveforms` recomputes the shape and offset
metrics from the regenerated files.
Series-4 (Thor) events are untouched; nothing in their decode changed.
**Not rehearsed on a prod snapshot** (v0.32.0 was). The risk is lower:
- Event times do not move, so every row is matched in place.
- No row is created or removed.
- The full decode checker ran clean against all 70,112 DL2 event files before
release.
**Afterwards**, the DL2 watcher can be widened for the 2016–2024 backfill:
`MAX_EVENT_AGE_DAYS = 2130` reaches 2021. Set it back to 365 when done,
because the same setting widens the heartbeat's scan.
---
## v0.32.0 — 2026-10-27
+31 -25
View File
@@ -2,7 +2,7 @@
Ground-up Python replacement for **Blastware**, Instantel's Windows-only software for
managing MiniMate Plus seismographs. Connects over direct RS-232 or cellular modem
(Sierra Wireless RV50 / RV55). Current version: **v0.32.0**.
(Sierra Wireless RV50 / RV55). Current version: **v0.33.0**.
Stack-level context — which repo owns what, and how the three project versions
pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
@@ -10,36 +10,42 @@ pair — lives in `../terra-view/docs/tmi-stack.md`, which is also loaded as
---
## Where things stand (updated 2026-10-26)
## Where things stand (updated 2026-11-01)
Read this first when picking the project back up.
- **🔑 The Series-3 decode checker (2026-10-29).** Goal: SFM produces everything
Blastware reports, from the event file alone (spec/plan in `docs/superpowers/`).
Run it with `scratch/check_s3_decode.py ~/dl2-archive/files ~/dl2-archive/xml`.
It decodes each event from its bytes only (no filename, no report) and
compares every field, sample and interval with Blastware's `_XML.XML`: 70,042
events, 2016–2026, ~22 min at `--jobs 4`. Run output (`summary.md`,
`details.json`, `changes.md`) goes to `~/dl2-archive/checker-runs/` and is
never committed. The rule: every mismatch is SFM's bug unless a carve-out
with evidence covers it.
**First full run:**
- ✅ Sample rate, record time, pre-trigger and notes match everywhere.
- ✅ Geophone samples are exact on 6,491 / 6,524 waveforms in every year. The
33 others are the 1.250 in/s range, 8× under SFM's Normal-range assumption.
- ❌ Every histogram reads as a waveform without its filename (#41), and
their start times are 1 s early (#51).
- ❌ Open findings:
- histogram PVS: SFM takes the vector magnitude of each channel's interval
peak (peaks that may come from different moments); Blastware takes the
per-interval vector sum
- mic psi conversion
- mic dB off by 0.05–0.1 on ~1,000 events
- **🔑 The Series-3 decode checker (2026-10-29; v0.33.0).**
- **Goal:** SFM produces everything Blastware reports, from the event file
alone (spec and plan in `docs/superpowers/`).
- **Running it:** `scratch/check_s3_decode.py ~/dl2-archive/files
~/dl2-archive/xml` decodes each event from its bytes only (no filename, no
report). It compares every field, sample and interval with Blastware's
`_XML.XML`: 70,042 events, 2016–2026, ~22 min at `--jobs 4`.
- **Output** (`summary.md`, `details.json`, `changes.md`) goes to
`~/dl2-archive/checker-runs/` and is never committed.
- **The rule:** every mismatch is SFM's bug unless a carve-out with evidence
covers it.
**As of v0.33.0:**
- ✅ **Match on every event:** sample rate, record time, pre-trigger, notes,
and event type (#41, from STRT[18]).
- ✅ **Geophone samples** are exact on 6,491 / 6,524 waveforms in every year.
The 33 others are the 1.250 in/s range, 8× under SFM's Normal-range
assumption.
- ✅ **Histogram PVS** = the stored per-interval PVS²: 69,919 / 70,042.
- ✅ **Mic: one count = 0.25 Pa,** with Blastware's dB offset at 81.9384. It
fails on only a few dozen events.
- ❌ **Open:**
- histogram start times are 1 s early (#51)
- 35 sub-minute (5 s / 2 s) histograms decode wrongly, plus 2 one-minute
no-mic histograms (`R352HFZ7`-shaped, likely a separate cause)
- 26 histogram start dates are a day off
- ⬜ Not read yet: job number, ZC frequency, acceleration, displacement, time
of peak, sensor check, battery, calibration, range, units, monitor log.
- the per-interval PVS is not stored
- Blastware prints `OORANGE` when the vector sum alone exceeds the range
(a carve-out to prove)
- ⬜ **Not read yet:** job number, ZC frequency, acceleration, displacement,
time of peak, sensor check, battery, calibration, range, units, monitor
log.
- **The Series-4 LIVE wire protocol is reverse-engineered end to end
(2026-09-25).** `docs/micromate_protocol_reference.md` is the Series-4
Rosetta Stone, sibling to `instantel_protocol_reference.md`. **A Micromate
+32 -2
View File
@@ -1,4 +1,4 @@
# seismo-relay `v0.32.0`
# seismo-relay `v0.33.0`
A ground-up replacement for **Blastware** — Instantel's aging Windows-only
software for managing seismographs. Supports both the **MiniMate Plus
@@ -74,6 +74,27 @@ over direct RS-232 or cellular modem (Sierra Wireless RV50 / RV55).
>
> ⚠ The deploy owes a backfill and moves stored waveform times; see the
> changelog's *Migration*.
>
> **v0.33.0 (2026-11-01)** reads Series-III events from the file alone, and
> proves it.
> - **Fields now read from the event file** when no Blastware report comes with
> the event:
> - sample rate, record time, pre-trigger and the four notes (#44/#45)
> - the event type (#41)
> - a histogram's peak vector sum, which the unit stores per interval
> - the mic, at one count = 0.25 Pa (it read ~95× low in psi)
>
> This matters for every DL2 event from before 2025, and for SFM's own
> download and call-in paths, none of which have a report.
> - **The decode checker** (`scratch/check_s3_decode.py`) compares SFM's
> file-only decode with Blastware's `_XML.XML` event reports, field by field
> and sample by sample, for 70,042 DL2 events back to 2016:
> - every setup field, the notes and the event type match on every event
> - geophone samples are exact on 6,491 / 6,524 waveforms
> - the histogram vector sum matches on 69,919
>
> ⚠ The deploy owes a backfill; it does not move event times. See the
> changelog's *Migration*.
> See [CHANGELOG.md](CHANGELOG.md) for full version history.
---
@@ -615,7 +636,16 @@ Implementation steps (concrete):
### High-impact (unblocks product features)
- [ ] **Series III waveform body codec reverse-engineering.** The 5A bulk-stream body is some kind of compressed/encoded format (not raw int16 LE as previously assumed — see §7.6.1 retraction in `docs/instantel_protocol_reference.md`). Structural framing is ~50% decoded on branch `claude/codec-re-cBGNe` (tagged-block walker, segment counters); per-byte sample mapping is still open. Until this lands, the in-app waveform viewer renders garbage and BW-import peak values fall back to `_peaks_from_samples()` saturation noise. Workaround: pair every BW-imported event with its `_ASCII.TXT` so the device-authoritative peaks land in the DB regardless of codec.
- [x] **Series III waveform body codec reverse-engineering.** ✅ The body codec is fully decoded (`minimateplus/waveform_codec.py`, `histogram_codec.py`), and verified per-sample against Blastware's own exports. As of v0.33.0, geophone samples are exact on 6,491 / 6,524 DL2 waveforms against their `_XML.XML` reports, across 2016–2026.
- [ ] **SFM produces everything Blastware reports, from the event file alone.** The four-piece plan:
1. the decode checker ✅ v0.33.0
2. complete the file-only decode, one field group at a time, each proven by the checker
3. flip ingest so reports are kept only for checking
4. stop the watchers forwarding reports
**Done so far:** setup fields, notes, event type, histogram PVS, mic.
**Next:** histogram start times (#51), the 37 histograms that decode wrongly, the job number, the geophone range (Sensitive-range events read 8×), and the values Blastware computes itself (ZC frequency, acceleration, displacement, time of peak), plus the sensor check, battery, calibration and monitor log. Design: `docs/superpowers/specs/2026-10-29-s3-decode-checker-design.md`.
- [x] **Series IV (Thor IDF) binary codec reverse-engineering.** ✅ v0.21.0 — `micromate/idf_file.read_idf_file()` decodes both IDFW (waveform body at offset `0x0f1f`, reusing `decode_waveform_v2()`; 87–99% sample fidelity on quiet events) and IDFH (dedicated segment-based decoder: all 859 corpus files decode, 181,071 intervals, peaks within ~1.8% of sidecar values). `WaveformStore.save_imported_idf` now also projects parsed Thor data into a `bw_report` block via `micromate/idf_to_bw_report.py` so Thor events render in the existing Event Report PDF pipeline without a separate renderer.
- [ ] **In-app waveform viewer accuracy.** Depends on Series III codec decode. Plot.v1 JSON pipeline + viewer skeleton already exist; will start showing real waveforms automatically once `_decode_a5_waveform` produces correct samples. Series IV waveforms come online when the IDF codec lands.
- [ ] **Series IV live-device support.** Once the IDF binary is decoded, extend `micromate/` with `transport.py` / `framing.py` / `protocol.py` / `client.py` mirroring the `minimateplus/` package layout — depends on capturing Thor's wire protocol (TCP / RS-232 captures TBD).
+14 -9
View File
@@ -18,12 +18,13 @@ from dataclasses import dataclass
from typing import Callable, Optional, Sequence
from .bw_xml_report import XmlReport
from .event_file_io import _GEO_INT16_FS, _GEO_NORMAL_FS_INS, _MIC_PSI_PER_COUNT, decode_blastware_bytes
from .event_file_io import (_GEO_FS_BY_RANGE, _GEO_INT16_FS, _GEO_NORMAL_FS_INS, _MIC_PSI_PER_COUNT,
decode_blastware_bytes)
from .models import Event
from .waveform_codec import mic_count_to_db
# SFM's conversion: it cannot yet read the geophone range from the file, and
# assumes Normal (10 in/s full scale = 32000 counts).
# SFM's conversion at the Normal range (10 in/s full scale = 32000 counts),
# which SFM assumes when it cannot read the event's range from the file.
GEO_IPS_PER_COUNT: float = _GEO_NORMAL_FS_INS / _GEO_INT16_FS
_CHANNELS = ("Tran", "Vert", "Long", "MicL")
@@ -38,6 +39,7 @@ class SfmSide:
job_number: Optional[str] # None until the decoder reads it
channels: list[str] # channels with decoded data, in Tran/Vert/Long/MicL order
counts: dict[str, list[int]] # waveform samples or histogram interval peaks
geo_ips_per_count: float = GEO_IPS_PER_COUNT # at the event's range, as SFM read it
def sfm_side(raw: bytes) -> SfmSide:
@@ -55,6 +57,7 @@ def sfm_side(raw: bytes) -> SfmSide:
# SFM's interval count is its decoded entry count; the reference
# carries this field for histograms only.
"NumberofIntervals": len(counts["Tran"]) or None,
"GeoRange": _GEO_FS_BY_RANGE.get(ev.geo_range),
}
if ts is not None:
date = f"{ts.year:04d}-{ts.month:02d}-{ts.day:02d}"
@@ -78,6 +81,7 @@ def sfm_side(raw: bytes) -> SfmSide:
job_number=None,
channels=[ch for ch in _CHANNELS if counts[ch]],
counts=counts,
geo_ips_per_count=_GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS) / _GEO_INT16_FS,
)
@@ -184,19 +188,20 @@ def _series_result(field: str, n_bw: int, n_sfm: int, diffs: list[tuple[int, flo
)
def _sample_converters(ref: XmlReport) -> dict[str, Callable[[int], float]]:
convert: dict[str, Callable[[int], float]] = {ch: (lambda c: c * GEO_IPS_PER_COUNT) for ch in _GEO}
def _sample_converters(sfm: SfmSide, ref: XmlReport) -> dict[str, Callable[[int], float]]:
k = sfm.geo_ips_per_count
convert: dict[str, Callable[[int], float]] = {ch: (lambda c: c * k) for ch in _GEO}
mic = _mic_converter(ref)
if mic is not None:
convert["MicL"] = mic
return convert
def _interval_converter(title: str) -> Optional[Callable[[int], float]]:
def _interval_converter(title: str, sfm: SfmSide) -> Optional[Callable[[int], float]]:
"""SFM keeps each interval's peaks; it drops their frequencies and geo PVS."""
ch, _, rest = title.partition(" ")
if rest.startswith("Peak") and ch in _GEO:
return lambda c: c * GEO_IPS_PER_COUNT
return lambda c: c * sfm.geo_ips_per_count
if ch == "MicL" and rest == "Peak dB(L)":
return mic_count_to_db
if ch == "MicL" and rest == "Peak psi(L)":
@@ -215,7 +220,7 @@ def series_pairs(sfm: SfmSide, ref: XmlReport,
a row whose cell count differs is a disagreement for every channel."""
if field.startswith("samples."):
ch = field[len("samples."):]
convert = _sample_converters(ref).get(ch)
convert = _sample_converters(sfm, ref).get(ch)
counts = sfm.counts.get(ch, [])
if convert is None or not counts:
return None
@@ -232,7 +237,7 @@ def series_pairs(sfm: SfmSide, ref: XmlReport,
if field.startswith("intervals."):
title = field[len("intervals."):]
columns = ref.interval_columns or []
convert = _interval_converter(title)
convert = _interval_converter(title, sfm)
counts = sfm.counts.get(title.partition(" ")[0], [])
if convert is None or not counts or title not in columns:
return None
+48 -12
View File
@@ -51,7 +51,7 @@ SIDECAR_KIND = "sfm.event"
# bumped without a `pip install` re-run — leading to confusing stale
# version stamps in sidecars. Bump this constant and CHANGELOG.md
# together at release time.
TOOL_VERSION = "0.32.0" # waveform times from the event record, report dates, histogram reader; gates the backfill regen
TOOL_VERSION = "0.33.0" # setup + notes, record type, histogram PVS and mic from the file; gates the backfill regen
try:
# Best-effort: prefer the installed metadata when it's NEWER than the
@@ -704,9 +704,11 @@ _INT16_FS = 32768.0
# sfm.event_hdf5._GEO_INT16_FS or sidecar peaks disagree with the plotted
# waveform by 2.3%. Confirmed 2026-08-25 against the BW ASCII corpus.
_GEO_INT16_FS = 32000.0
# A histogram's geo values are in decoder units of 16 counts = 0.005 in/s at
# the Normal range (the same assumption as the samples above).
_HIST_GEO_UNIT_INS = 16 * _GEO_NORMAL_FS_INS / _GEO_INT16_FS
# Full scale per geo_range: 0 Normal, 1 Sensitive.
_GEO_FS_BY_RANGE = {0: _GEO_NORMAL_FS_INS, 1: _GEO_SENSITIVE_FS_INS}
# A histogram's geo values are decoder units of 16 counts: 0.005 in/s at the
# Normal range, scaled by the range's full scale like the samples above.
_HIST_GEO_COUNTS_PER_UNIT = 16
# Microphone scale factor, psi per MicL count: one count is 0.25 Pa
# (waveform_codec.MIC_PA_PER_COUNT, measured against Blastware's psi(L) on
@@ -749,17 +751,19 @@ def _decode_samples_4ch_int16_le(stream: bytes) -> dict[str, list[int]]:
}
def _peaks_from_samples(samples: dict[str, list[int]]) -> PeakValues:
def _peaks_from_samples(samples: dict[str, list[int]],
geo_fs_ins: float = _GEO_NORMAL_FS_INS) -> PeakValues:
"""
Compute approximate peaks from raw int16 samples assuming Normal-range
geophone sensitivity. Used by the BW-importer when the 0C waveform
record (the device's authoritative peaks) is unavailable.
Compute peaks from raw int16 samples at the given geophone full scale
(Normal, 10 in/s, unless the file's range says otherwise). Used by the
BW-importer when the 0C waveform record (the device's authoritative peaks)
is unavailable.
"""
def _peak_ins(ch: list[int]) -> float:
if not ch:
return 0.0
m = max(abs(int(v)) for v in ch)
return m / _GEO_INT16_FS * _GEO_NORMAL_FS_INS
return m / _GEO_INT16_FS * geo_fs_ins
tran = _peak_ins(samples.get("Tran", []))
vert = _peak_ins(samples.get("Vert", []))
@@ -773,7 +777,7 @@ def _peaks_from_samples(samples: dict[str, list[int]]) -> PeakValues:
pvs = 0.0
n = min(len(samples.get("Tran", [])), len(samples.get("Vert", [])), len(samples.get("Long", [])))
if n:
scale = _GEO_NORMAL_FS_INS / _GEO_INT16_FS
scale = geo_fs_ins / _GEO_INT16_FS
T = samples["Tran"]; V = samples["Vert"]; L = samples["Long"]
for i in range(n):
t = T[i] * scale
@@ -996,6 +1000,32 @@ def _setup_notes(raw: bytes) -> ProjectInfo:
operator=operator, sensor_location=location)
# The geophone range sits in the setup's channel blocks, which follow the
# notes: the byte 29 after each geophone label (`00 00 01 Tran ...`). 0x00 is
# Normal, 0x01 Sensitive -- Blastware's GeoRange on 70,042 / 70,042 DL2 events,
# all three channels agreeing on every one (measured 2026-11-01). SFM's live
# 1A read has the same byte at label+33.
_RANGE_AFTER_LABEL = 29
_CHANNEL_BLOCK_SPAN = 2000 # how far past the setup name the blocks may sit
def _setup_geo_range(raw: bytes) -> tuple[Optional[int], Optional[str]]:
"""(geo_range, problem): 0 Normal or 1 Sensitive when all three geophone
channels say the same, else None and why."""
k = _setup_name_at(raw)
if k is None:
return None, "no recording-setup block to read the geophone range from"
found = {}
for label in (b"Tran", b"Vert", b"Long"):
i = raw.find(b"\x00\x00\x01" + label, k, k + _CHANNEL_BLOCK_SPAN)
p = i + 3 + _RANGE_AFTER_LABEL
found[label.decode()] = raw[p] if i >= 0 and p < len(raw) else None
values = set(found.values())
if len(values) == 1 and values <= {0, 1}:
return values.pop(), None
return None, f"geophone range not read: channel range bytes {found}"
def read_blastware_file(path: Union[str, Path], *, name: Optional[str] = None) -> Event:
"""Parse a Blastware event file into an Event: `decode_blastware_bytes` on its
bytes, `name` defaulting to the file's own (see there -- never a time source)."""
@@ -1156,6 +1186,9 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
# every waveform used to read "70 s". A histogram has no record time or
# pre-trigger -- Blastware reports neither.
ev.sample_rate = _setup_sample_rate(raw)
ev.geo_range, range_problem = _setup_geo_range(raw)
if range_problem:
ev.decode_problems.append(range_problem + "; peaks assume the Normal range")
if is_waveform_body:
ev.rectime_seconds = _setup_record_time(raw)
ev.total_samples = len(samples["Tran"]) or None
@@ -1244,14 +1277,17 @@ def decode_blastware_bytes(raw: bytes, *, name: Optional[str] = None) -> Event:
# None, and ``apply_report_to_event`` overlays from a paired ASCII
# report when one is supplied.
has_samples = any(samples.get(ch) for ch in ("Tran", "Vert", "Long", "MicL"))
ev.peak_values = _peaks_from_samples(samples) if has_samples else None
# The geophone full scale is the file's range; Normal when it wasn't read.
geo_fs = _GEO_FS_BY_RANGE.get(ev.geo_range, _GEO_NORMAL_FS_INS)
ev.peak_values = _peaks_from_samples(samples, geo_fs) if has_samples else None
if not is_waveform_body and ev.peak_values is not None:
# A histogram stores each interval's vector sum (squared); the event's
# is the largest. Combining the channel peaks instead read high on 86%
# of DL2's histograms -- they can come from different moments.
pvs = interval_pvs(body)
if pvs:
ev.peak_values.peak_vector_sum = max(pvs) * _HIST_GEO_UNIT_INS
ev.peak_values.peak_vector_sum = (
max(pvs) * _HIST_GEO_COUNTS_PER_UNIT * geo_fs / _GEO_INT16_FS)
ev._a5_frames = None # not recoverable from BW file
return ev
+3
View File
@@ -543,6 +543,9 @@ class Event:
total_samples: Optional[int] = None # from STRT record: expected total sample-sets
pretrig_samples: Optional[int] = None # from STRT record: pre-trigger sample count
rectime_seconds: Optional[int] = None # from STRT record: record duration (seconds)
# Geophone range from the recording setup, as ComplianceConfig.geo_range:
# 0 Normal (10 in/s full scale), 1 Sensitive (1.25 in/s). None: not read.
geo_range: Optional[int] = None
# Sensor self-check traces keyed by channel label — the short diagnostic
# waveforms the unit records when it pulses each sensor before monitoring
+1 -1
View File
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
[project]
name = "seismo-relay"
version = "0.32.0"
version = "0.33.0"
description = "Python client and REST server for MiniMate Plus seismographs"
requires-python = ">=3.10"
dependencies = [
+1 -2
View File
@@ -428,8 +428,7 @@ def main(argv=None) -> int:
try:
event_hdf5.write_event_hdf5(
hdf5_path, ev,
serial=serial,
geo_range="normal",
serial=serial, # range: the event's own, from its setup
source_kind=source_kind,
)
hdf5_filename = hdf5_path.name
+6 -1
View File
@@ -180,7 +180,7 @@ def write_event_hdf5(
event: Event,
*,
serial: str,
geo_range = "normal",
geo_range = None,
source_kind: str = "sfm-live",
tool_version: Optional[str] = None,
captured_at: Optional[datetime.datetime] = None,
@@ -190,6 +190,9 @@ def write_event_hdf5(
"""
Persist a decoded Event as an HDF5 file with samples in physical units.
``geo_range`` left as None takes the event's own (``event.geo_range``,
which a Blastware file's decode reads from its setup block), else Normal.
``geo_ips_per_count`` overrides the range-derived MiniMate count scale
for sources whose counts differ — Thor IDF imports pass
``micromate.idf_file._GEO_LSB_IPS`` (issue #42).
@@ -202,6 +205,8 @@ def write_event_hdf5(
pv = event.peak_values
pi = event.project_info
if geo_range is None:
geo_range = event.geo_range if getattr(event, "geo_range", None) is not None else "normal"
geo_fs = _resolve_geo_full_scale(geo_range)
geo_range_str = _normalise_range(geo_range)
captured_at = captured_at or datetime.datetime.utcnow()
+4 -3
View File
@@ -298,7 +298,7 @@ class WaveformStore:
serial_hint: Optional[str] = None,
bw_report_text: Optional[Union[str, bytes]] = None,
source_kind: str = "bw-import",
geo_range: Union[str, int] = "normal",
geo_range: Optional[Union[str, int]] = None,
) -> tuple[Event, dict]:
"""
Ingest a Blastware event file produced by an external tool
@@ -417,8 +417,9 @@ class WaveformStore:
event_hdf5.write_event_hdf5(
hdf5_path, ev,
serial=serial,
# The BW file doesn't carry the range (yet); an import assumes Normal,
# a live download passes the unit's own (event_ingest).
# None (an import): the event's own range, read from the file's
# setup (ev.geo_range), else Normal. An explicit value -- a live
# download's (event_ingest) -- wins.
geo_range=geo_range,
source_kind="bw-import",
)
BIN
View File
Binary file not shown.
File diff suppressed because it is too large. Load diff
BIN
View File
Binary file not shown.
+167
View File
@@ -0,0 +1,167 @@
<?xml version="1.0" encoding="UTF-8"?>
<Event>
<FileVersion>8.0</FileVersion>
<EventType>Full Histogram</EventType>
<SerialNumber>BE11010</SerialNumber>
<Version>V 10.72-8.17 MiniMate Plus</Version>
<FileName>M010HR6K.OA0H</FileName>
<HistogramStartTime>17:02:34</HistogramStartTime>
<HistogramStartDate>2019-01-08</HistogramStartDate>
<HistogramStopTime>17:20:00</HistogramStopTime>
<HistogramStopDate>2019-01-08</HistogramStopDate>
<Channels>
<Channel>Tran</Channel>
<Channel>Vert</Channel>
<Channel>Long</Channel>
<Channel>MicL</Channel>
</Channels>
<NumberofIntervals>18.00</NumberofIntervals>
<IntervalSize>1 minute</IntervalSize>
<SampleRate>1024 sps</SampleRate>
<BatteryLevel>6.8 Volts</BatteryLevel>
<Calibration>December 17, 2018 by Instantel</Calibration>
<Units>in/s and dB(L)</Units>
<Project>Wampum Ave-ECMS 29301-215 Joseph St</Project>
<Client>Brayman Construction</Client>
<UserName>Terra-Mechanics Inc - D. Bartholomae</UserName>
<Seis.Loc>Loc, #1 - 215 Joseph Street</Seis.Loc>
<GeoRange>
<Value>1.250</Value>
<Units>in/s</Units>
</GeoRange>
<TranPPV>
<Value>0.008</Value>
<Units>in/s</Units>
</TranPPV>
<VertPPV>
<Value>0.009</Value>
<Units>in/s</Units>
</VertPPV>
<LongPPV>
<Value>0.005</Value>
<Units>in/s</Units>
</LongPPV>
<TranZCFreq>
<Value>11</Value>
<Units>Hz</Units>
</TranZCFreq>
<VertZCFreq>
<Value>73</Value>
<Units>Hz</Units>
</VertZCFreq>
<LongZCFreq>
<Value>16</Value>
<Units>Hz</Units>
</LongZCFreq>
<TranPeakTime>17:11:34</TranPeakTime>
<TranPeakDate>2019-01-08</TranPeakDate>
<VertPeakTime>17:03:34</VertPeakTime>
<VertPeakDate>2019-01-08</VertPeakDate>
<LongPeakTime>17:11:34</LongPeakTime>
<LongPeakDate>2019-01-08</LongPeakDate>
<PeakVectorSum>
<Value>0.009</Value>
<Units>in/s</Units>
</PeakVectorSum>
<PeakVectorSumTime>17:11:34</PeakVectorSumTime>
<PeakVectorSumDate>2019-01-08</PeakVectorSumDate>
<Microphone>Linear Weighting</Microphone>
<MicLPSPL>
<Value>134.1</Value>
<Units>dB(L)</Units>
</MicLPSPL>
<MicLTime>17:03:34</MicLTime>
<MicLDate>2019-01-08</MicLDate>
<MicLZCFreq>
<Value>9.7</Value>
<Units>Hz</Units>
</MicLZCFreq>
<TranTestFreq>7.2 Hz.</TranTestFreq>
<TranTestRatio>4.3</TranTestRatio>
<TranTestResults>Passed</TranTestResults>
<VertTestFreq>7.6 Hz.</VertTestFreq>
<VertTestRatio>3.4</VertTestRatio>
<VertTestResults>Passed</VertTestResults>
<LongTestFreq>7.2 Hz.</LongTestFreq>
<LongTestRatio>3.8</LongTestRatio>
<LongTestResults>Passed</LongTestResults>
<MicLTestFreq>20.1 Hz.</MicLTestFreq>
<MicLTestAmplitude>583 mv</MicLTestAmplitude>
<MicLTestResults>Passed</MicLTestResults>
<UsbSummaryChannels>
</UsbSummaryChannels>
<MonitorLog>2019-01-08 17:02:33 - 2019-01-08 17:20:00 &quot;Event Recorded Modem 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>2019-01-08 17:03:34</Time>
<Row>
<Cell>0.003</Cell><Cell>47</Cell><Cell>0.009</Cell><Cell>73</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.009</Cell><Cell>0.015</Cell><Cell>134.1</Cell><Cell>9.7</Cell></Row>
<Time>2019-01-08 17:04:34</Time>
<Row>
<Cell>0.003</Cell><Cell>21</Cell><Cell>0.007</Cell><Cell>27</Cell><Cell>0.002</Cell><Cell>85</Cell><Cell>0.007</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:05:34</Time>
<Row>
<Cell>0.004</Cell><Cell>20</Cell><Cell>0.004</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>0.003</Cell><Cell>119.1</Cell><Cell>7.5</Cell></Row>
<Time>2019-01-08 17:06:34</Time>
<Row>
<Cell>0.003</Cell><Cell>34</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>51</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>81.94</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:07:34</Time>
<Row>
<Cell>0.003</Cell><Cell>51</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>39</Cell></Row>
<Time>2019-01-08 17:08:34</Time>
<Row>
<Cell>0.004</Cell><Cell>12</Cell><Cell>0.004</Cell><Cell>16</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.005</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>13</Cell></Row>
<Time>2019-01-08 17:09:34</Time>
<Row>
<Cell>0.002</Cell><Cell>51</Cell><Cell>0.002</Cell><Cell>64</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>81.94</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:10:34</Time>
<Row>
<Cell>0.003</Cell><Cell>12</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.004</Cell><Cell>0.000</Cell><Cell>81.94</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:11:34</Time>
<Row>
<Cell>0.008</Cell><Cell>11</Cell><Cell>0.005</Cell><Cell>13</Cell><Cell>0.005</Cell><Cell>16</Cell><Cell>0.009</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>19</Cell></Row>
<Time>2019-01-08 17:12:34</Time>
<Row>
<Cell>0.006</Cell><Cell>13</Cell><Cell>0.004</Cell><Cell>14</Cell><Cell>0.004</Cell><Cell>51</Cell><Cell>0.007</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>20</Cell></Row>
<Time>2019-01-08 17:13:34</Time>
<Row>
<Cell>0.003</Cell><Cell>57</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:14:34</Time>
<Row>
<Cell>0.003</Cell><Cell>47</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>13</Cell></Row>
<Time>2019-01-08 17:15:34</Time>
<Row>
<Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.004</Cell><Cell>0.000</Cell><Cell>95.92</Cell><Cell>2.5</Cell></Row>
<Time>2019-01-08 17:16:34</Time>
<Row>
<Cell>0.003</Cell><Cell>13</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>85</Cell><Cell>0.004</Cell><Cell>0.000</Cell><Cell>93.98</Cell><Cell>9.1</Cell></Row>
<Time>2019-01-08 17:17:34</Time>
<Row>
<Cell>0.003</Cell><Cell>17</Cell><Cell>0.002</Cell><Cell>85</Cell><Cell>0.002</Cell><Cell>73</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>81.94</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:18:34</Time>
<Row>
<Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.004</Cell><Cell>0.000</Cell><Cell>87.96</Cell><Cell>&gt;100</Cell></Row>
<Time>2019-01-08 17:19:34</Time>
<Row>
<Cell>0.003</Cell><Cell>73</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>20</Cell><Cell>0.004</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>6.1</Cell></Row>
<Time>2019-01-08 17:20:00</Time>
<Row>
<Cell>0.002</Cell><Cell>37</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.002</Cell><Cell>&gt;100</Cell><Cell>0.003</Cell><Cell>0.000</Cell><Cell>91.48</Cell><Cell>18</Cell></Row>
</HistogramDataIntervals>
</HistogramData>
<HistogramDataUsbChannels>
</HistogramDataUsbChannels>
</Event>
+70
View File
@@ -206,3 +206,73 @@ def test_mic_peak_in_psi():
# Blastware: MicL PSPL 106.0 dB(L) = 20 uPa x 10^(106/20) = 3.990 Pa = 5.787e-4 psi.
ev = read_blastware_file(_FIX / "decode-checker-10-29-26/M529L4XQ.R30H")
assert ev.peak_values.micl == pytest.approx(5.787e-4, rel=0.01)
# ── The geophone range: Normal or Sensitive ─────────────────────────────────
# In the setup's channel blocks, the byte 29 after each geophone label is the
# range: 0x00 Normal (10 in/s full scale), 0x01 Sensitive (1.25 in/s). It
# matches Blastware's GeoRange on 70,042 / 70,042 DL2 events, all three
# channels agreeing on every one (35 Sensitive), measured 2026-11-01. Until
# now SFM assumed Normal, so a Sensitive event read 8x high.
from minimateplus.event_file_io import _setup_name_at # noqa: E402
@pytest.mark.parametrize("rel,want", [
("bw-import-fields-10-29-26/R352HIUI.F40W", 0),
("geo-range-11-01-26/K557J1KB.RQ0W", 1), # waveform, XML GeoRange 1.250
("geo-range-11-01-26/M010HR6K.OA0H", 1), # histogram, XML GeoRange 1.250
])
def test_geo_range_comes_from_the_file(rel, want):
assert read_blastware_file(_FIX / rel).geo_range == want
# (file, Blastware's Tran / Vert / Long PPV and Peak Vector Sum, from its XML)
@pytest.mark.parametrize("rel,peaks", [
("geo-range-11-01-26/K557J1KB.RQ0W", ("0.019", "0.055", "0.019", "0.061")),
("geo-range-11-01-26/M010HR6K.OA0H", ("0.008", "0.009", "0.005", "0.009")),
])
def test_sensitive_range_peaks_are_not_8x(rel, peaks):
pv = read_blastware_file(_FIX / rel).peak_values
for got, want in zip((pv.tran, pv.vert, pv.long, pv.peak_vector_sum), peaks):
assert abs(got - float(want)) <= 0.0005 + 1e-9, (got, want)
def test_channels_that_disagree_give_no_range_and_a_problem():
raw = bytearray((_FIX / "geo-range-11-01-26/K557J1KB.RQ0W").read_bytes())
i = raw.find(b"\x00\x00\x01Vert", _setup_name_at(bytes(raw)))
raw[i + 3 + 29] = 0x00 # Vert Normal, Tran / Long Sensitive
ev = decode_blastware_bytes(bytes(raw), name=None)
assert ev.geo_range is None
assert any("range" in p for p in ev.decode_problems)
def test_the_h5_takes_the_events_range(tmp_path):
import h5py
from sfm import event_hdf5
ev = read_blastware_file(_FIX / "geo-range-11-01-26/K557J1KB.RQ0W")
event_hdf5.write_event_hdf5(tmp_path / "e.h5", ev, serial="BE9557")
with h5py.File(tmp_path / "e.h5", "r") as f:
assert f.attrs["geo_range"] == "sensitive"
assert abs(float(abs(f["samples/Vert"][:]).max()) - 0.055) <= 0.0005 + 1e-9
def test_an_imported_file_and_the_backfill_store_its_range(tmp_path):
import h5py
import scripts.backfill_sidecars as backfill
from sfm import event_hdf5
from sfm.waveform_store import WaveformStore
src = _FIX / "geo-range-11-01-26/K557J1KB.RQ0W"
store = WaveformStore(tmp_path / "waveforms")
ev, _ = store.save_imported_bw(src.read_bytes(), source_path=src)
h5 = store.hdf5_path_for("BE9557", src.name)
with h5py.File(h5, "r") as f:
assert f.attrs["geo_range"] == "sensitive"
# A file stored before this fix carries "normal"; the backfill rewrites it.
event_hdf5.write_event_hdf5(h5, ev, serial="BE9557", geo_range="normal")
assert backfill.main(["--store-root", str(tmp_path / "waveforms"),
"--db-path", str(tmp_path / "seismo_relay.db"), "--force"]) == 0
with h5py.File(h5, "r") as f:
assert f.attrs["geo_range"] == "sensitive"
+3 -2
View File
@@ -28,7 +28,8 @@ def test_find_pairs_dedupes_and_pairs(tmp_path):
def test_check_event_rows_and_attrs():
out = run.check_event("M007HVWF.K30W", str(FIX / "M007HVWF.K30W"), str(FIX / "M007HVWF_K30W_XML.XML"))
assert out["attrs"]["range"] == "1.250" and out["attrs"]["model"] == "MiniMate Plus"
assert any(r[0] == "TranPPV" and r[1] == "mismatch" for r in out["results"])
# clipped at its own 1.250 ceiling: accepted under the saturation carve-out
assert ["TranPPV", "accepted"] in [r[:2] for r in out["results"]]
def test_bad_input_is_one_error_row(tmp_path):
@@ -128,7 +129,7 @@ def test_compare_to_marks_the_summary(tmp_path):
def test_file_prints_one_event(tmp_path, capsys):
assert run.main([str(FIX), str(FIX), "--file", "M007HVWF.K30W"]) == 0
out = capsys.readouterr().out
assert any("TranPPV" in line and "mismatch" in line for line in out.splitlines())
assert any("TranPPV" in line and "accepted" in line for line in out.splitlines())
# ── Final review fixes ──────────────────────────────────────────────────────
+30 -5
View File
@@ -114,8 +114,23 @@ def test_clipped_normal_range_is_accepted():
assert (res[f].verdict, res[f].carveout) == ("accepted", "saturation")
def test_sensitive_range_8x_stays_a_mismatch():
def test_a_clipped_sensitive_event_is_accepted_at_its_own_ceiling():
# SFM reads the 1.250 range from the file; the clipped channels sit at 1.2506.
res = _results("M007HVWF.K30W", CARVEOUTS)
assert res["GeoRange"].verdict == "match" and res["samples.Tran"].verdict == "match"
for f in ("TranPPV", "PeakVectorSum"):
assert (res[f].verdict, res[f].carveout) == ("accepted", "saturation")
def test_the_carveout_never_accepts_an_8x_value():
# What SFM produced while it assumed Normal on a Sensitive unit: 8x high.
# The saturation rule must leave it a mismatch.
raw = (FIX / "M007HVWF.K30W").read_bytes()
side = sfm_side(raw)
side.values.update(TranPPV=10.005, VertPPV=10.005, LongPPV=10.005, PeakVectorSum=17.33)
side.geo_ips_per_count = 10.0 / 32000
res = {r.field: r for r in compare(side, parse_xml_report_file(FIX / "M007HVWF_K30W_XML.XML"),
CARVEOUTS)}
assert res["TranPPV"].verdict == "mismatch" and res["samples.Tran"].verdict == "mismatch"
assert res["PeakVectorSum"].verdict == "mismatch"
@@ -133,13 +148,14 @@ def test_pvs_carveout_needs_oorange_from_blastware():
def test_pvs_carveout_needs_the_clipped_channel_at_the_ceiling():
# 1.250 range, Blastware PVS OORANGE; an UNclipped channel's 8x value happens to land
# in the 1.250 band -- that must not let SFM's 8x vector sum through.
# 1.250 range, Blastware PVS OORANGE, but no channel Blastware clamped: an
# UNclipped channel's 8x value landing in the 1.250 band must not let a vector
# sum through, even one inside the sqrt(3) bound.
raw = (FIX / "M007HVWF.K30W").read_bytes()
ref = parse_xml_report_file(FIX / "M007HVWF_K30W_XML.XML")
ref.scalars["TranPPV"] = "0.157"
ref.scalars.update(TranPPV="0.157", VertPPV="0.157", LongPPV="0.157")
side = sfm_side(raw)
side.values["TranPPV"] = 1.256
side.values.update(TranPPV=1.256, PeakVectorSum=2.0)
res = {r.field: r for r in compare(side, ref, CARVEOUTS)}
assert res["PeakVectorSum"].verdict == "mismatch"
@@ -147,3 +163,12 @@ def test_pvs_carveout_needs_the_clipped_channel_at_the_ceiling():
def test_interval_mic_psi_matches():
# psi(L) report: every interval's "MicL Peak psi(L)" now converts right
assert _results("T004JTRF.ME0H")["intervals.MicL Peak psi(L)"].verdict == "match"
def test_a_sensitive_range_event_now_matches():
gr = FIX.parent / "geo-range-11-01-26"
raw = (gr / "K557J1KB.RQ0W").read_bytes()
res = {r.field: r for r in compare(sfm_side(raw), parse_xml_report_file(gr / "K557J1KB_RQ0W_XML.XML"))}
for f in ("GeoRange", "TranPPV", "VertPPV", "LongPPV", "PeakVectorSum",
"samples.Tran", "samples.Vert", "samples.Long"):
assert res[f].verdict == "match", (f, res[f])