Files
aimsight-labeling/auto/analyses/CLARIDEN_2026-10-11T0000_2026-10-20T0400/scripts/fig_tilt.py
T

20 lines
1.2 KiB
Python

"""Figure: camera tilt and corr_y of the targets that follow it, 2h medians, from tilt_vs_targets.py output."""
import sys, matplotlib; matplotlib.use('Agg'); import matplotlib.pyplot as plt
from datetime import datetime
rows=[l.split() for l in open(sys.argv[1]) if l[:2]=='10' and '-' in l[:6]]
t=[datetime.strptime('2026-'+r[0],'%Y-%m-%dT%H:%M') for r in rows]
def col(i): return [float(r[i]) if r[i] != '-' else float('nan') for r in rows]
fig,ax=plt.subplots(2,1,figsize=(11,6),sharex=True)
ax[0].plot(t,col(1),'k.-'); ax[0].set_ylabel('camera tilt\n(thousandths of a degree)')
names=['D-302-B','D-303-B','D-304-B','P-301-B','D-306-B']
for j,n in enumerate(names):
v=col(3+j); m=sorted(x for x in v if x==x)[len(v)//2]
ax[1].plot(t,[x-m for x in v],'.-',label=n)
ax[1].set_ylabel('corrected vertical curve\nminus its median (px)'); ax[1].legend(ncol=5,fontsize=8)
for a in ax:
for s,e in [('2026-10-11T14:00','2026-10-13T02:00'),('2026-10-17T16:00','2026-10-20T00:30')]:
a.axvspan(datetime.fromisoformat(s),datetime.fromisoformat(e),color='0.9')
a.grid(alpha=.3)
fig.suptitle('CLARIDEN: the camera tilt and the targets that follow it (2 h medians, UTC)')
fig.tight_layout(); fig.savefig(sys.argv[2],dpi=90); print(sys.argv[2])