"""Gap between REF42 and REFG43N raw positions per instant (from the advanced exports), and the common corr of the targets.""" import csv, glob, statistics as st rows = {} for f in sorted(glob.glob('data/MICHIGAN/displacement/MICHIGAN_advanced_202610*.csv')): for r in csv.DictReader(open(f)): t = r['time_utc'][:16] if '2026-10-03' <= t <= '2026-10-12T16:00': rows.setdefault(t, {})[r['sensor_name']] = r for t in sorted(rows): d = rows[t]; a, b = d['REF42'], d['REFG43N'] gx = float(a['x']) - float(b['x']); gy = float(a['y']) - float(b['y']) tg = [s for s in d.values() if s['pattern_type'] not in ('global_ref',) and s['corr_x']] cx = st.median(float(s['corr_x']) for s in tg); cy = st.median(float(s['corr_y']) for s in tg) print(t, f"gap_x {gx:9.3f} gap_y {gy:8.3f} med_corr_x {cx:+.3f} med_corr_y {cy:+.3f}")