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:
1 parent
15a27d5921
commit
7a58bad28d
10 files changed
+312
-6
No files matched your search
@@ -36,7 +36,7 @@ class SfmSide:
|
||||
event: Event
|
||||
values: dict[str, object] # reference tag -> SFM's value; absent or None = blank
|
||||
notes: list[str] # non-empty user-note slots, in order
|
||||
job_number: Optional[str] # None until the decoder reads it
|
||||
job_number: Optional[str] # only when the file says Blastware shows 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
|
||||
@@ -78,7 +78,7 @@ def sfm_side(raw: bytes) -> SfmSide:
|
||||
values=values,
|
||||
notes=[v for v in (pi.project, pi.client, pi.operator, pi.sensor_location) if v]
|
||||
if pi is not None else [],
|
||||
job_number=None,
|
||||
job_number=str(pi.job_number) if pi is not None and pi.job_number_enabled else 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,
|
||||
@@ -289,6 +289,9 @@ def compare(sfm: SfmSide, ref: XmlReport, carveouts: Sequence["Carveout"] = ())
|
||||
if sfm.job_number is None else
|
||||
FieldResult("JobNumber", "match" if _same_text(sfm.job_number, ref.job_number)
|
||||
else "mismatch", ref.job_number, sfm.job_number))
|
||||
elif sfm.job_number is not None:
|
||||
# SFM says the job number is shown; Blastware printed none.
|
||||
out.append(FieldResult("JobNumber", "mismatch", None, sfm.job_number))
|
||||
out.append(FieldResult("Channels", "match" if ref.channels == sfm.channels else "mismatch",
|
||||
" ".join(ref.channels), " ".join(sfm.channels)))
|
||||
if ref.sample_rows is not None:
|
||||
|
||||
@@ -996,8 +996,29 @@ def _setup_notes(raw: bytes) -> ProjectInfo:
|
||||
text = [p.decode("ascii", errors="replace").strip() or None for p in parts]
|
||||
text += [None] * (2 + 2 * _NOTE_SLOTS - len(text))
|
||||
project, client, operator, location = text[2:2 + 2 * _NOTE_SLOTS:2]
|
||||
enabled, number = _setup_job_number(raw, k)
|
||||
return ProjectInfo(setup_name=text[0], project=project, client=client,
|
||||
operator=operator, sensor_location=location)
|
||||
operator=operator, sensor_location=location,
|
||||
job_number_enabled=enabled, job_number=number)
|
||||
|
||||
|
||||
# The job number, in Series IV's 0x1A layout ([39] report flags, [40:42] the
|
||||
# number): flags at k - 9, bit 0x02 = shown; 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, and every
|
||||
# printed value matches (all are 1; measured 2026-11-02).
|
||||
_REPORT_FLAGS_BEFORE_NAME = 9
|
||||
_JOB_NUMBER_BEFORE_NAME = 8
|
||||
_JOB_NUMBER_ON = 0x02
|
||||
|
||||
|
||||
def _setup_job_number(raw: bytes, k: int) -> tuple[Optional[bool], Optional[int]]:
|
||||
"""(shown, number) from the setup block whose name starts at k."""
|
||||
if k < _REPORT_FLAGS_BEFORE_NAME:
|
||||
return None, None
|
||||
flags = raw[k - _REPORT_FLAGS_BEFORE_NAME]
|
||||
j = k - _JOB_NUMBER_BEFORE_NAME
|
||||
return bool(flags & _JOB_NUMBER_ON), int.from_bytes(raw[j:j + 2], "big")
|
||||
|
||||
|
||||
# The geophone range sits in the setup's channel blocks, which follow the
|
||||
|
||||
@@ -379,6 +379,8 @@ class ProjectInfo:
|
||||
operator: Optional[str] = None # operator / user name
|
||||
sensor_location: Optional[str] = None # sensor location string
|
||||
notes: Optional[str] = None # extended notes
|
||||
job_number_enabled: Optional[bool] = None # Blastware prints the job number
|
||||
job_number: Optional[int] = None # kept while switched off
|
||||
|
||||
|
||||
# ── Compliance Config ──────────────────────────────────────────────────────────
|
||||
|
||||
Reference in new issue
Block a user