"""Dump per-instant tables of a column for all sensors, the pose and the housing temperature (window 2026-10-19 -> 2026-11-03).""" import csv, glob, sys, statistics as st from collections import defaultdict D='data/BREITHORN' T0,T1='2026-10-19','2026-11-03' rows=defaultdict(dict) for f in sorted(glob.glob(D+'/displacement/*advanced*.csv')): for r in csv.DictReader(open(f)): t=r['time_utc'][:16] if not (T0<=t[:10]float(r['error_threshold']) return (None if v=='' else float(v)), rej # level: median over window 2026-10-20..2026-10-23 accepted (or arg) ref=sys.argv[2] if len(sys.argv)>2 else 'none' lev={} for s in sensors: vals=[val(rows[t][s])[0] for t in rows if s in rows[t] and not val(rows[t][s])[1] and val(rows[t][s])[0] is not None and (ref=='none' or ref.split('/')[0]<=t<=ref.split('/')[1])] lev[s]=st.median(vals) if (vals and ref!='none') else 0 print('time '+' '.join(f'{s[:9]:>9}' for s in sensors)) for t in sorted(rows): out=[] for s in sensors: r=rows[t].get(s) if not r: out.append(f'{"-":>9}');continue v,rej=val(r) if v is None: out.append(f'{"R":>9}' ); continue mult=100 if col.startswith('corr') else 1 out.append(f'{(v-lev[s])*mult:8.2f}'+('R' if rej else ' ')) print(t[5:16].replace(' ','T')+' '+' '.join(out))