"""Verify the had_report=False path: ingest IDFW with no .txt.""" from __future__ import annotations import sys from pathlib import Path import tempfile REPO = Path(__file__).resolve().parents[1] sys.path.insert(0, str(REPO)) from sfm.waveform_store import WaveformStore def main(): idfw = REPO / "tests/fixtures/THORDATA_example/THORDATA_example/UPMC Presby/UM11719/UM11719_20231219162723.IDFW" with tempfile.TemporaryDirectory() as td: store = WaveformStore(Path(td)) ev, rec = store.save_imported_idf( idfw.read_bytes(), idfw, serial_hint=None, idf_report_text=None, # ← no .txt! ) print("=== IDFW without .txt ingest ===") print(f" serial: {rec['serial']}") print(f" timestamp: {ev.timestamp}") print(f" sample_rate: {ev.sample_rate}") print(f" record_type: {ev.record_type}") print(f" rectime_sec: {ev.rectime_seconds}") nT = len(ev.raw_samples.get('Tran', [])) if ev.raw_samples else 0 nV = len(ev.raw_samples.get('Vert', [])) if ev.raw_samples else 0 nL = len(ev.raw_samples.get('Long', [])) if ev.raw_samples else 0 nM = len(ev.raw_samples.get('MicL', [])) if ev.raw_samples else 0 print(f" raw_samples: Tran={nT} Vert={nV} Long={nL} MicL={nM}") if ev.peak_values: print(f" peak_values: tran={ev.peak_values.tran} vert={ev.peak_values.vert} long={ev.peak_values.long}") print(f" h5 written: {rec['hdf5_filename']}") if __name__ == "__main__": main()