ae0e17b5dc
Three things to make pickup smoother: 1. analysis/README.md (NEW): catalogues the ~25 scratch scripts. Categorizes them as "still useful" / "superseded — keep for archaeology" / "pure exploration". Tells a fresh engineer which files to read first and which to ignore. 2. scratch/next_experiment_skeleton.py (NEW): stub + spec for the segment-channel scoring analyzer. Includes the fixture loader, block walker, and decode-segment-as-channel helper — just enough scaffolding that the next pass starts from "fill in score_segment_against_all_channels()" rather than from scratch. Already runs and confirms 13 segments per 3-sec event with sample starts going to 6590 (way past the 3328 actual samples) — strong evidence that not all segments carry Tran. 3. Removed decode-re/ duplicate. It was a mirror of tests/fixtures/. Analysis scripts that hardcoded decode-re/ paths updated to point at tests/fixtures/. CLAUDE.md note updated: future event uploads go directly into a dated subdirectory under tests/fixtures/. All 40 tests still pass. Skeleton runs.
51 lines
2.0 KiB
Python
51 lines
2.0 KiB
Python
"""Quick inspection of the new high-amplitude events."""
|
|
import os, re, sys
|
|
sys.path.insert(0, ".")
|
|
from analysis.load_bundle import _parse_txt
|
|
from minimateplus.waveform_codec import walk_body, find_data_start
|
|
|
|
ROOT = "tests/fixtures/5-11-26"
|
|
|
|
|
|
def main():
|
|
for stem in ("M529LL1A.SP0", "M529LL1A.SS0", "M529LL1A.SV0"):
|
|
bin_path = os.path.join(ROOT, stem)
|
|
txt_path = bin_path + ".TXT"
|
|
with open(bin_path, "rb") as f:
|
|
raw = f.read()
|
|
body = raw[43:-26]
|
|
meta, samples = _parse_txt(txt_path)
|
|
n = len(samples["Tran"])
|
|
|
|
print(f"\n=== {stem} ===")
|
|
print(f" file={len(raw)}, body={len(body)}, N_samples={n}")
|
|
print(f" rectime={meta.get('Record Time')} pretrig={meta.get('Pre-trigger Length')}")
|
|
print(f" PPV(T,V,L)={meta.get('Tran PPV')} / {meta.get('Vert PPV')} / {meta.get('Long PPV')}")
|
|
# Show first few non-trivial samples
|
|
print(f" First 5 truth samples (in/s):")
|
|
for i in range(5):
|
|
print(f" T={samples['Tran'][i]:8.3f} V={samples['Vert'][i]:8.3f} "
|
|
f"L={samples['Long'][i]:8.3f} M={samples['MicL'][i]:8.3f}")
|
|
# Peak sample positions
|
|
for ch in ("Tran", "Vert", "Long"):
|
|
vals = samples[ch]
|
|
peak_i = max(range(n), key=lambda i: abs(vals[i]))
|
|
print(f" {ch}: peak {vals[peak_i]:.3f} at sample {peak_i} (t={peak_i/1024:.3f}s)")
|
|
# Body structure
|
|
start = find_data_start(body)
|
|
blocks = walk_body(body, start)
|
|
types = {}
|
|
for b in blocks:
|
|
types[b.tag_hi] = types.get(b.tag_hi, 0) + 1
|
|
print(f" body start={start}, total blocks walked: {len(blocks)}")
|
|
print(f" block tag counts: {types}")
|
|
# How far the walker got
|
|
if blocks:
|
|
last = blocks[-1]
|
|
walked = last.offset + last.length
|
|
print(f" walker stopped at offset {walked}/{len(body)} ({100*walked/len(body):.0f}%)")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|