feat(decode): a Blastware file's job number, and whether Blastware shows it

The setup block has Series IV's 0x1A layout here too: report flags at
k - 9 (bit 0x02 = job number shown) and the number, uint16 BE, at k - 8,
kept while switched off.  The flag matches Blastware's JobNumber on
2,997 / 2,997 DL2 events that print one and 66,986 / 66,986 that don't.
Every printed value is 1 and matches; hidden ones hold real numbers
(802, 1012, 1013, 622), so the value is only proven for 1.

- ProjectInfo.job_number_enabled / job_number, named as in
  micromate.setup_block.
- write_event_hdf5 stores both as .h5 attrs when read (additive).
- The checker reports the number only when shown, and scores a number
  only SFM shows as a mismatch.  The old test that pinned JobNumber as
  sfm_blank now checks only the ZC cases it also covered.

Not carried into the DB, the API or the PDF report yet (needs a column).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01ALX2R8pghDaZuti9U7mEE9
This commit is contained in:
serversdownandClaude Opus 5.5 committed 2026-11-02 14:31:23 -05:00
1 parent 15a27d5921
commit 7a58bad28d
10 files changed
+312 -6

No files matched your search

+27
View File
@@ -276,3 +276,30 @@ def test_an_imported_file_and_the_backfill_store_its_range(tmp_path):
"--db-path", str(tmp_path / "seismo_relay.db"), "--force"]) == 0
with h5py.File(h5, "r") as f:
assert f.attrs["geo_range"] == "sensitive"
# ── The job number ──────────────────────────────────────────────────────────
# Series IV's 0x1A layout again: report flags at k - 9 (bit 0x02 = job number
# shown) and the number, uint16 BE, at k - 8, kept while switched off. The flag
# matches Blastware's JobNumber on 2,997 / 2,997 DL2 events that print one and
# 66,986 / 66,986 that don't (measured 2026-11-02). Every printed value is 1;
# hidden ones hold real numbers (802, 1012, 1013, 622).
@pytest.mark.parametrize("rel,enabled,number", [
("decode-checker-10-29-26/T1905KDW.5F0W", True, 1), # XML JobNumber 1
("job-number-11-02-26/T438I4V5.DJ0H", True, 1), # histogram, XML JobNumber 1
("job-number-11-02-26/K557I55Y.I20H", False, 802), # no JobNumber in the XML
("decode-checker-10-29-26/R352HFZ7.530H", False, 1),
])
def test_job_number_comes_from_the_file(rel, enabled, number):
pi = read_blastware_file(_FIX / rel).project_info
assert (pi.job_number_enabled, pi.job_number) == (enabled, number)
def test_the_h5_carries_the_job_number(tmp_path):
import h5py
from sfm import event_hdf5
ev = read_blastware_file(_FIX / "job-number-11-02-26/K557I55Y.I20H")
event_hdf5.write_event_hdf5(tmp_path / "e.h5", ev, serial="BE9557")
with h5py.File(tmp_path / "e.h5", "r") as f:
assert (bool(f.attrs["job_number_enabled"]), int(f.attrs["job_number"])) == (False, 802)