Files
aimsight-labeling/auto/analyses/WYOMING_2026-11-06T0805_2026-11-16T0627/scripts/figure.py
T

31 lines
1.5 KiB
Python

"""Figure for the report: housing temperature, raw sideways shift of the nearest prism (RD, target_01) against the far
prisms, and corr_x of target_02, target_14, target_15, target_01, hourly medians from table.py's output.
usage: .venv/bin/python figure.py TABLE OUT.png
"""
import sys
from datetime import datetime
import matplotlib
matplotlib.use("Agg")
import matplotlib.pyplot as plt
rows = [l.rstrip("\n").split("\t") for l in open(sys.argv[1])]
head, rows = rows[0], [r for r in rows[1:] if r[0] >= "11-06T08"]
col = {h: i for i, h in enumerate(head)}
t = [datetime.strptime("2026-" + r[0], "%Y-%m-%dT%H:%M") for r in rows]
def v(name):
return [float(r[col[name]]) if r[col[name]] != "-" else None for r in rows]
fig, ax = plt.subplots(3, 1, figsize=(13, 9), sharex=True)
ax[0].plot(t, v("temp"), "k"); ax[0].set_ylabel("camera housing\ntemperature [°C]")
ax[1].plot(t, v("dx_RD"), label="RD (reference, same prism as target_01)"); ax[1].plot(t, v("dx_01"), label="target_01")
for s in ("02", "14", "15"):
ax[1].plot(t, v("dx_" + s), label="target_" + s)
ax[1].set_ylabel("sideways shift in the image,\nagainst the far prisms [px]"); ax[1].legend(fontsize=8)
for s in ("02", "14", "15", "01"):
ax[2].plot(t, v("cx" + s), label="target_" + s)
ax[2].set_ylabel("corrected curve in x [px]"); ax[2].legend(fontsize=8)
for a in ax:
a.grid(alpha=.3)
fig.suptitle("WYOMING: the nearest prism shifts with the temperature, and the targets between the references take the shift (hourly, UTC)")
fig.tight_layout(); fig.savefig(sys.argv[2], dpi=90); print(sys.argv[2])