Files
aimsight-labeling/auto/analyses/FLORIDA_2026-10-11T0945_2026-10-22T0315/scripts/native.py
T

33 lines
1.6 KiB
Python

"""Print native corr_x/corr_y/error_value of chosen sensors and the pose between two instants."""
import sys, csv, glob
sys.path.insert(0, 'tools/scripts')
start, end = sys.argv[1], sys.argv[2]
sensors = sys.argv[3].split(',')
cols = sys.argv[4].split(',') if len(sys.argv) > 4 else ['corr_x', 'corr_y', 'error_value']
rows = {}
for f in sorted(glob.glob('data/FLORIDA/displacement/FLORIDA_advanced_*.csv')):
for r in csv.DictReader(open(f)):
t = r['time_utc'][:16].replace(' ', 'T') + 'Z'
if not (start <= t <= end): continue
if r['sensor_name'] in sensors:
rej = r['error_value'] and r['error_threshold'] and float(r['error_value']) > float(r['error_threshold'])
rows.setdefault(t, {})[r['sensor_name']] = (r, rej)
pose = {}
for f in sorted(glob.glob('data/FLORIDA/camera/FLORIDA_camera_*.csv')):
for r in csv.DictReader(open(f)):
t = r['time_utc'][:16].replace(' ', 'T') + 'Z'
if start <= t <= end: pose[t] = r
def fm(v):
try: return f"{float(v):8.3f}"
except: return " -"
print('time ' + ' | '.join(f"{s[:10]:>10} " + ' '.join(c[:6] for c in cols) for s in sensors) + ' | pan tilt scale')
for t in sorted(rows):
out = []
for s in sensors:
if s not in rows[t]: out.append(' missing'); continue
r, rej = rows[t][s]
out.append(('R' if rej else ' ') + ' '.join(fm(r[c]) if not (rej and c.startswith('corr')) else ' rej' for c in cols))
p = pose.get(t)
ps = f"{float(p['median_pan']):.4f} {float(p['median_tilt']):.4f} {float(p['median_scale']):.5f}" if p else 'no pose'
print(t, ' | '.join(out), '|', ps)