feat(decode): a histogram's interval detail -- frequencies (#50), vector sums, interval size, stop
Group B of the file-only decode, measured on DL2 2026-11-03: - Frequency = (sample rate / 2) / half-period: 527,915 / 527,915 cells at 1024 sps and 1,725 / 1,725 at 2048. #50: half_period_to_hz took a fixed 512 and halved every 2048-sps frequency; it now takes the rate (default 1024). Blastware prints 'N/A' for a half-period of 0, '>100' ('>200' at 2048) at 5 samples or fewer, '<1.0' below 1 Hz. - Each interval's vector sum, sqrt(PVS^2) at the event's range: 771,354 / 771,354. - Interval size: uint16 seconds at k - 40 (Series IV [8:10]). - Stop: the footer's (2,995 / 2,999 sampled; 4 print a second earlier). Event gains histogram_interval_sec, interval_half_periods, interval_pvs and stop_time; the .h5 gains /intervals/half_period/<ch>, /intervals/pvs_ips and a histogram_interval_sec attr. The decoder walks a histogram once (histogram_codec.channels_from_records) and takes the event's PVS from the same records. The checker compares each interval column, number or Blastware's word; the test that pinned Tran Freq Hz as blank now pins 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
67b3ef8d0a
commit
2b698e74cf
10 files changed
+312
-32
No files matched your search
@@ -38,6 +38,10 @@ Layout written to `<filename>.h5`:
|
||||
trigger_level_mic_psi, firmware_version, dsp_version, model,
|
||||
calibration_date (ISO), calibrated_by
|
||||
(each only when read from the event file)
|
||||
histogram_interval_sec int (histograms)
|
||||
/intervals (histograms, when read)
|
||||
half_period/<ch> uint16 samples per interval; Hz = (sample rate / 2) / it
|
||||
pvs_ips float32 each interval's vector sum, in/s
|
||||
peak_tran_ips float (from 0C; authoritative)
|
||||
peak_vert_ips float
|
||||
peak_long_ips float
|
||||
@@ -273,6 +277,7 @@ def write_event_hdf5(
|
||||
("trigger_sources", getattr(event, "trigger_sources", None)),
|
||||
("trigger_level_geo_ips", getattr(event, "trigger_level_geo", None)),
|
||||
("trigger_level_mic_psi", getattr(event, "trigger_level_mic_psi", None)),
|
||||
("histogram_interval_sec", getattr(event, "histogram_interval_sec", None)),
|
||||
):
|
||||
if value is not None:
|
||||
attrs[attr] = value
|
||||
@@ -304,6 +309,22 @@ def write_event_hdf5(
|
||||
compression="gzip", compression_opts=4, shuffle=True,
|
||||
)
|
||||
|
||||
# /intervals — a histogram's per-interval detail as the file holds it:
|
||||
# each channel's half-period in samples (frequency = (sample rate / 2)
|
||||
# / half-period; 0 is Blastware's "N/A") and each interval's vector sum.
|
||||
half_periods = getattr(event, "interval_half_periods", None)
|
||||
interval_pvs = getattr(event, "interval_pvs", None)
|
||||
if half_periods or interval_pvs:
|
||||
igrp_iv = f.create_group("intervals")
|
||||
if half_periods:
|
||||
hgrp = igrp_iv.create_group("half_period")
|
||||
for ch, hps in half_periods.items():
|
||||
hgrp.create_dataset(ch, data=np.asarray(hps, dtype="uint16"),
|
||||
compression="gzip", compression_opts=4, shuffle=True)
|
||||
if interval_pvs:
|
||||
igrp_iv.create_dataset("pvs_ips", data=np.asarray(interval_pvs, dtype="float32"),
|
||||
compression="gzip", compression_opts=4, shuffle=True)
|
||||
|
||||
# /samples_int16 — optional raw ADC counts (preserved for analysis
|
||||
# tools that want pre-conversion data). Cheap to include.
|
||||
if include_int16:
|
||||
|
||||
Reference in new issue
Block a user