"""Per-instant table: corr of targets minus a fixed baseline (median over a calm window), error_value of refs, pose.""" import sys sys.path.insert(0, 'tools/scripts') import data F = 'data/FLORIDA' t0, t1 = data.parse_time(sys.argv[1]), data.parse_time(sys.argv[2]) b0, b1 = data.parse_time(sys.argv[3]), data.parse_time(sys.argv[4]) M = data.load(F); cam = {p['t'].replace(second=0, microsecond=0): p for p in data.load_camera(F)} tg = ['Sellette 4', 'Sellette 5', 'Pont Ernen', 'Sellette 3', 'Sellette 6', 'Massif 2'] base = {} for s in tg: for c in ('corr_x', 'corr_y'): v = sorted(m[c] for m in M[s] if b0 <= m['t'] <= b1 and m[c] is not None) base[s, c] = v[len(v)//2] if v else 0 idx = {s: {m['t'].replace(second=0, microsecond=0): m for m in M[s]} for s in M} times = sorted(t for t in idx['p1_r'] if t0 <= t <= t1) print('time ' + ' '.join(f'{s[:2]+s[-1]:>5}x {s[:2]+s[-1]:>5}y' for s in tg) + ' p1ev r1ev pan tilt rot scale') for t in times: row = [] for s in tg: m = idx[s].get(t) for c in ('corr_x', 'corr_y'): v = m[c] if m else None row.append(f'{v-base[s,c]:+6.3f}' if v is not None else ' R') p = cam.get(t) pe = idx['p1_r'][t]['error_value']; re_ = idx['r1_r'][t]['error_value'] ps = f"{p['pan']:+.4f} {p['tilt']:+.4f} {p['rotation']:+.4f} {p['scale']:.5f}" if p else 'no pose' print(t.strftime('%d %H:%M ') + ' '.join(row) + f' {pe:.2f} {re_:.2f} ' + ps)