feat(decode): a Blastware file's identity, battery and trigger settings
Group A of the file-only decode, every field matched against every DL2 report (2026-11-03): - Identity block before the setup name, what the live read gets from SUB FE: serial k-202, firmware k-147, DSP version k-138, calibration date k-132 + 'by' k-128, manufacturer k-94, model k-72, firmware minor k-193. Event.device_info (DeviceInfo gains calibration_date / calibrated_by). Serial, Version and Calibration 69,983 / 69,983. - Battery: uint16 hundredths of a volt at k-190 (Event.battery_volts). 69,729 exact; the other 254 are Blastware rounding half up. - Trigger source: the two bytes between the embedded event record's lead and fe 80, a bitmask (0x01 Tran 0x02 Vert 0x04 Long 0x08 MicL 0x200 Manual): 6,493 / 6,493. Event.triggered_by. - Trigger settings in Series IV's 0x1A layout: sources bitmask k-19, stop mode k-31 (0 = Fixed), each channel's float32 level at label+30 (geo in/s, mic psi), mic type code at MicL+4 (2 = Linear Weighting). Geo level 6,447 / 6,447, mic 4,403 / 4,403; Blastware prints a level when its channel is a trigger source and the event was not Manual. The mic level's dB uses 6895 Pa/psi (4,272 / 4,272 against 4,271 at 6894.757). - .h5 attrs for all of them (additive). - Checker: SFM's side reports the ten fields; the mic trigger level follows the report's dB/psi. Carve-out units-is-a-display-preference: dB or psi is Blastware's PC setting when it wrote the report -- DL2's reports switch fleet-wide in 61 clean runs by write time, and no byte of the file separates them. Two tests that pinned BatteryLevel / Calibration as blank now pin the match. 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
be5bab4787
commit
6c2eda5f63
14 files changed
+8384
-15
No files matched your search
@@ -365,3 +365,67 @@ def test_a_waveform_with_the_early_record_is_timed_from_its_trigger():
|
||||
# Blastware: 2019-09-26 11:14:08, record time 4 s (SFM read the stop, 11:14:12)
|
||||
assert (ts.year, ts.month, ts.day, ts.hour, ts.minute, ts.second) == (2019, 9, 26, 11, 14, 8)
|
||||
assert ev.timestamp_source in ("event_record", "estimate")
|
||||
|
||||
|
||||
# ── Group A: identity, battery, trigger ─────────────────────────────────────
|
||||
# The identity block before the setup name is what the live read gets from
|
||||
# SUB FE (DeviceInfo): serial k-202, firmware k-147, DSP version k-138,
|
||||
# calibration date k-132 and "by" k-128, manufacturer k-94, model k-72; the
|
||||
# battery is a uint16 of hundredths of a volt at k-190. Measured against every
|
||||
# DL2 report 2026-11-03 (serial, version, calibration 69,983 / 69,983).
|
||||
import datetime as _dt # noqa: E402
|
||||
|
||||
_SF = "setup-fields-11-03-26"
|
||||
|
||||
|
||||
def test_the_identity_block_is_read():
|
||||
# Blastware: BE18189, "V 10.72-8.17 MiniMate Plus",
|
||||
# "February 20, 2019 by Instantel", "6.8 Volts"
|
||||
ev = read_blastware_file(_FIX / _SF / "T189HUD6.QE0W")
|
||||
di = ev.device_info
|
||||
assert (di.serial, di.firmware_version, di.dsp_version, di.manufacturer, di.model) == (
|
||||
"BE18189", "S338.17", "10.72", "Instantel", "MiniMate Plus")
|
||||
assert di.firmware_minor == 17
|
||||
assert (di.calibration_date, di.calibrated_by) == (_dt.date(2019, 2, 20), "Instantel")
|
||||
assert abs(ev.battery_volts - 6.8) <= 0.05 + 1e-9
|
||||
|
||||
|
||||
def test_the_battery_is_kept_exact():
|
||||
# Blastware prints "6.3 Volts" for a stored 6.25: it rounds half up.
|
||||
assert read_blastware_file(_FIX / _SF / "K558L4KY.440H").battery_volts == 6.25
|
||||
|
||||
|
||||
# (file, Blastware's Trigger as the event record's bitmask, geo level in/s,
|
||||
# mic level psi or None, mic a trigger source)
|
||||
@pytest.mark.parametrize("rel,by,geo,mic_psi,mic_src", [
|
||||
(f"{_SF}/T189HUD6.QE0W", 0x0008, 0.050, 0.0072, True), # MicL, 128.0 dB(L)
|
||||
(f"{_SF}/T438L713.RY0W", 0x0002, 0.500, 0.0100, True), # Vert, 130.8 dB(L)
|
||||
(f"{_SF}/M529I6LG.3Y0W", 0x0004, 0.050, 0.005, True), # Long, 0.005 psi(L)
|
||||
("bw-import-fields-10-29-26/R352HIUI.F40W", 0x0001, 0.400, None, False), # Tran
|
||||
("decode-checker-10-29-26/T1905KDW.5F0W", 0x0200, None, None, None), # Manual
|
||||
])
|
||||
def test_the_trigger_comes_from_the_file(rel, by, geo, mic_psi, mic_src):
|
||||
ev = read_blastware_file(_FIX / rel)
|
||||
assert ev.triggered_by == by
|
||||
if geo is not None:
|
||||
assert abs(ev.trigger_level_geo - geo) <= 0.0005 + 1e-9
|
||||
if mic_psi is not None:
|
||||
assert abs(ev.trigger_level_mic_psi - mic_psi) <= 0.0005 + 1e-9 # psi to 3 places, as printed
|
||||
if mic_src is not None:
|
||||
assert bool(ev.trigger_sources & 0x08) == mic_src
|
||||
assert (ev.record_stop_mode, ev.mic_type) == (0, 2) # Fixed, Linear Weighting
|
||||
|
||||
|
||||
def test_the_h5_carries_the_setup_fields(tmp_path):
|
||||
import h5py
|
||||
from sfm import event_hdf5
|
||||
ev = read_blastware_file(_FIX / _SF / "T189HUD6.QE0W")
|
||||
event_hdf5.write_event_hdf5(tmp_path / "e.h5", ev, serial="BE18189")
|
||||
with h5py.File(tmp_path / "e.h5", "r") as f:
|
||||
a = f.attrs
|
||||
assert abs(float(a["battery_volts"]) - 6.8) <= 0.05 + 1e-9
|
||||
assert (int(a["triggered_by"]), int(a["trigger_sources"])) == (0x0008, ev.trigger_sources)
|
||||
assert abs(float(a["trigger_level_geo_ips"]) - 0.050) <= 0.0005 + 1e-9
|
||||
assert abs(float(a["trigger_level_mic_psi"]) - ev.trigger_level_mic_psi) < 1e-9
|
||||
assert (str(a["firmware_version"]), str(a["dsp_version"]), str(a["calibration_date"])) == (
|
||||
"S338.17", "10.72", "2019-02-20")
|
||||
Reference in new issue
Block a user