feat(decode): over range inside a histogram's intervals, as in the event
Inside an interval the rule is the event's: a peak past 2,000 units (the mic in counts) is Blastware's OORANGE, and the interval's vector sum is OORANGE when any geophone is. DL2 (2026-11-09): numeric up to 1,846 (geophones) / 1,414 (mic), OORANGE from 2,001; vector sums 16 / 16 OORANGE with a geophone over, 2,862 / 2,862 numeric without. event_file_io.over_full_scale(count, channel); the checker renders those interval cells as OORANGE. The saturation carve-out compares SFM's own words properly (_differs): an OORANGE from SFM never counts as saturation, and an OORANGE equal to Blastware's is not a difference. Its interval tests run on the numeric values it used to see. 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
836c9e864b
commit
e25784d9db
4 files changed
+54
-10
No files matched your search
@@ -21,7 +21,7 @@ from typing import Callable, Optional, Sequence
|
||||
|
||||
from .bw_xml_report import XmlReport
|
||||
from .event_file_io import (interval_times, _GEO_FS_BY_RANGE, _GEO_INT16_FS, _GEO_NORMAL_FS_INS, _MIC_PSI_PER_COUNT,
|
||||
decode_blastware_bytes, mic_count_divisor)
|
||||
decode_blastware_bytes, mic_count_divisor, over_full_scale)
|
||||
from .histogram_codec import half_period_to_hz
|
||||
from .models import Event
|
||||
from .waveform_codec import mic_count_to_db
|
||||
@@ -189,7 +189,12 @@ def sfm_side(raw: bytes) -> SfmSide:
|
||||
for ch, hps in ev.interval_half_periods.items():
|
||||
interval_values[f"{ch} Freq Hz"] = [interval_frequency(h, ev.sample_rate) for h in hps]
|
||||
if ev.interval_pvs:
|
||||
interval_values["Geo PVS in/s"] = list(ev.interval_pvs)
|
||||
# OORANGE when any geophone passes full scale in that interval: 16 / 16
|
||||
# DL2 cells, and none of 2,862 without one (2026-11-09).
|
||||
geo = [counts[c] for c in _GEO if counts.get(c)]
|
||||
interval_values["Geo PVS in/s"] = [
|
||||
"OORANGE" if any(i < len(g) and over_full_scale(g[i], "Tran") for g in geo) else v
|
||||
for i, v in enumerate(ev.interval_pvs)]
|
||||
times = None
|
||||
n = len(counts["Tran"])
|
||||
if ev.record_type == "Histogram" and ts is not None and ev.histogram_interval_sec and n:
|
||||
@@ -352,13 +357,14 @@ def _sample_converters(sfm: SfmSide, ref: XmlReport) -> dict[str, Callable[[int]
|
||||
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(" ")
|
||||
# A peak past full scale is Blastware's OORANGE, in an interval as in the event.
|
||||
if rest.startswith("Peak") and ch in _GEO:
|
||||
return lambda c: c * sfm.geo_ips_per_count
|
||||
return lambda c: "OORANGE" if over_full_scale(c, ch) else c * sfm.geo_ips_per_count
|
||||
d = sfm.mic_divisor
|
||||
if ch == "MicL" and rest == "Peak dB(L)":
|
||||
return lambda c: mic_count_to_db(c / d)
|
||||
return lambda c: "OORANGE" if over_full_scale(c, ch) else mic_count_to_db(c / d)
|
||||
if ch == "MicL" and rest == "Peak psi(L)":
|
||||
return lambda c: c * _MIC_PSI_PER_COUNT / d
|
||||
return lambda c: "OORANGE" if over_full_scale(c, ch) else c * _MIC_PSI_PER_COUNT / d
|
||||
return None
|
||||
|
||||
|
||||
|
||||
Reference in new issue
Block a user