Etiqueteur: October labels for 8 stations; its folder moves to labeling/auto/etiqueteur/, analyses and scripts versioned (D-126)
Labels for CLARIDEN, FLORIDA, JUNGFRAU (gaps 06-20.10, 26.10-01.11), LENZSPITZE, NIEDERHORN, NORDEND, SNCF01, WILDSTRUBEL. Figures and tool outputs stay out of git. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
2bba388290
commit
6fbd7510b7
112 files changed
+8951
-6
No files matched your search
@@ -0,0 +1,31 @@
|
||||
"""Écarts brefs de la médiane des cibles au-dessus de la dérive lente, face aux écarts brefs des températures.
|
||||
Lit temp_corr.tsv (écrit par temp_corr.py). Fond lent : médiane glissante de +-36 h.
|
||||
Lancer depuis la racine : python3 labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/ecarts.py [k]
|
||||
"""
|
||||
import csv, sys, statistics as st
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
OUT = "labeling/auto/etiqueteur/MICHIGAN_2026-10-01"
|
||||
K = float(sys.argv[1]) if len(sys.argv) > 1 else 3
|
||||
R = list(csv.DictReader(open(f"{OUT}/temp_corr.tsv"), delimiter="\t"))
|
||||
T = [datetime.fromisoformat(r["instant"][:-1]) for r in R]
|
||||
COLS = ["cx_med", "cy_med", "sepx", "sepy", "A0", "CPU", "GPU", "PLL", "thermal"]
|
||||
|
||||
|
||||
def resid(col):
|
||||
v = [float(r[col]) for r in R]
|
||||
out = []
|
||||
for i, t in enumerate(T):
|
||||
w = [v[j] for j, u in enumerate(T) if abs(u - t) <= timedelta(hours=36)
|
||||
and (u >= datetime(2026, 10, 9, 12)) == (t >= datetime(2026, 10, 9, 12))]
|
||||
out.append(v[i] - st.median(w))
|
||||
return out
|
||||
|
||||
|
||||
res = {c: resid(c) for c in COLS}
|
||||
mad = {c: st.median(abs(x) for x in res[c]) for c in COLS}
|
||||
print("MAD des résidus :", {c: round(mad[c], 3) for c in COLS})
|
||||
print("instant " + " ".join(f"{c:>8}" for c in COLS) + " (en MAD)")
|
||||
for i, t in enumerate(T):
|
||||
if abs(res["cx_med"][i]) > K * mad["cx_med"] or abs(res["cy_med"][i]) > K * mad["cy_med"]:
|
||||
print(f"{t:%Y-%m-%dT%H:%MZ} " + " ".join(f"{res[c][i] / mad[c]:8.1f}" for c in COLS))
|
||||
@@ -0,0 +1,23 @@
|
||||
"""Températures horaires sur une fenêtre, avec la médiane des cibles aux instants de mesure.
|
||||
Lancer depuis la racine : python3 labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/heures.py DEBUT FIN
|
||||
"""
|
||||
import csv, glob, sys
|
||||
from datetime import datetime
|
||||
|
||||
D, OUT = "data/MICHIGAN", "labeling/auto/etiqueteur/MICHIGAN_2026-10-01"
|
||||
A, B = datetime.fromisoformat(sys.argv[1]), datetime.fromisoformat(sys.argv[2])
|
||||
SENS = ["A0", "CPU", "GPU", "PLL", "thermal"]
|
||||
tab = {}
|
||||
for s in SENS:
|
||||
for f in sorted(glob.glob(f"{D}/metrics/MICHIGAN_sensor_{s}_deg_c_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
t = datetime.fromisoformat(r["time_utc"][:19].replace(" ", "T"))
|
||||
if A <= t <= B:
|
||||
tab.setdefault(t, {})[s] = r["metric"]
|
||||
cor = {datetime.fromisoformat(r["instant"][:-1]): r
|
||||
for r in csv.DictReader(open(f"{OUT}/temp_corr.tsv"), delimiter="\t")}
|
||||
print("heure " + " ".join(f"{s:>7}" for s in SENS) + " cx_med cy_med sepx sepy")
|
||||
for t in sorted(set(tab) | {k for k in cor if A <= k <= B}):
|
||||
c = cor.get(t)
|
||||
print(f"{t:%d.%m %H:%M} " + " ".join(f"{tab.get(t, {}).get(s, '-'):>7}" for s in SENS)
|
||||
+ (f" {c['cx_med']:>6} {c['cy_med']:>6} {c['sepx']:>6} {c['sepy']:>6}" if c else ""))
|
||||
@@ -0,0 +1,93 @@
|
||||
"""Températures des composants (metrics/) face à corr_x, corr_y des cibles, MICHIGAN octobre 2026.
|
||||
Lancer depuis la racine du dépôt : .venv/bin/python labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/temp_corr.py
|
||||
"""
|
||||
import csv, glob, statistics as st
|
||||
from datetime import datetime
|
||||
import matplotlib
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
D = "data/MICHIGAN"
|
||||
OUT = "labeling/auto/etiqueteur/MICHIGAN_2026-10-01"
|
||||
T0, T1 = "2026-10-03", "2026-11-01T00:00"
|
||||
SENS = ["A0", "CPU", "GPU", "PLL", "thermal"]
|
||||
|
||||
|
||||
def t(s):
|
||||
return datetime.fromisoformat(s.replace(" ", "T")[:19])
|
||||
|
||||
|
||||
temps = {}
|
||||
for s in SENS:
|
||||
pts = []
|
||||
for f in sorted(glob.glob(f"{D}/metrics/MICHIGAN_sensor_{s}_deg_c_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
if r["metric"]:
|
||||
pts.append((t(r["time_utc"]), float(r["metric"])))
|
||||
temps[s] = [p for p in pts if T0 <= p[0].isoformat() <= T1]
|
||||
|
||||
rows = []
|
||||
for f in sorted(glob.glob(f"{D}/displacement/MICHIGAN_advanced_*.csv")):
|
||||
rows += list(csv.DictReader(open(f)))
|
||||
rows = [r for r in rows if T0 <= r["time_utc"][:16].replace(" ", "T") <= T1]
|
||||
by = {}
|
||||
for r in rows:
|
||||
by.setdefault(t(r["time_utc"]).replace(second=0, microsecond=0), []).append(r)
|
||||
inst = sorted(by)
|
||||
cx, cy, sep_x, sep_y, rpx, rpy = [], [], [], [], [], []
|
||||
for k in inst:
|
||||
tg = [r for r in by[k] if r["pattern_type"] == "target" and r["corr_x"]]
|
||||
cx.append(st.median(float(r["corr_x"]) for r in tg))
|
||||
cy.append(st.median(float(r["corr_y"]) for r in tg))
|
||||
ref = {r["sensor_name"]: r for r in by[k] if r["pattern_type"] == "global_ref"}
|
||||
sep_x.append(float(ref["REFG43N"]["x"]) - float(ref["REF42"]["x"]))
|
||||
sep_y.append(float(ref["REFG43N"]["y"]) - float(ref["REF42"]["y"]))
|
||||
|
||||
# tableau : instant, corr médianes, température A0 la plus proche
|
||||
def near(s, k):
|
||||
return min(temps[s], key=lambda p: abs((p[0] - k).total_seconds()))[1]
|
||||
|
||||
with open(f"{OUT}/temp_corr.tsv", "w") as fo:
|
||||
fo.write("instant\tcx_med\tcy_med\tsepx\tsepy\t" + "\t".join(SENS) + "\n")
|
||||
for i, k in enumerate(inst):
|
||||
fo.write(f"{k:%Y-%m-%dT%H:%MZ}\t{cx[i]:.3f}\t{cy[i]:.3f}\t{sep_x[i]:.2f}\t{sep_y[i]:.2f}\t"
|
||||
+ "\t".join(f"{near(s, k):.1f}" for s in SENS) + "\n")
|
||||
|
||||
# corrélation après la perte de REFPOU22 (>= 09.10 12:00)
|
||||
idx = [i for i, k in enumerate(inst) if k >= datetime(2026, 10, 9, 12)]
|
||||
for s in SENS:
|
||||
tv = [near(s, inst[i]) for i in idx]
|
||||
print(s, "r(cx)=%.2f r(cy)=%.2f" % (st.correlation(tv, [cx[i] for i in idx]),
|
||||
st.correlation(tv, [cy[i] for i in idx])))
|
||||
tv = [near("A0", inst[i]) for i in idx]
|
||||
print("A0 r(sepx)=%.2f r(sepy)=%.2f" % (st.correlation(tv, [sep_x[i] for i in idx]),
|
||||
st.correlation(tv, [sep_y[i] for i in idx])))
|
||||
print("r(sepx,cx)=%.2f r(sepy,cy)=%.2f r(sepx,cy)=%.2f r(sepy,cx)=%.2f" % (
|
||||
st.correlation([sep_x[i] for i in idx], [cx[i] for i in idx]),
|
||||
st.correlation([sep_y[i] for i in idx], [cy[i] for i in idx]),
|
||||
st.correlation([sep_x[i] for i in idx], [cy[i] for i in idx]),
|
||||
st.correlation([sep_y[i] for i in idx], [cx[i] for i in idx])))
|
||||
# moyennes journalières de A0
|
||||
days = {}
|
||||
for p in temps["A0"]:
|
||||
days.setdefault(p[0].date(), []).append(p[1])
|
||||
print("A0 par jour (min / médiane / max) :")
|
||||
for d in sorted(days):
|
||||
v = days[d]
|
||||
print(d, min(v), st.median(v), max(v))
|
||||
|
||||
fig, ax = plt.subplots(4, 1, figsize=(14, 12), sharex=True)
|
||||
for s in SENS:
|
||||
ax[0].plot([p[0] for p in temps[s]], [p[1] for p in temps[s]], label=s, lw=0.8)
|
||||
ax[0].set_ylabel("°C"); ax[0].legend(ncol=5, fontsize=8)
|
||||
ax[1].plot(inst, cx, ".-", lw=0.8); ax[1].set_ylabel("corr_x médiane cibles")
|
||||
ax[2].plot(inst, cy, ".-", lw=0.8, color="C1"); ax[2].set_ylabel("corr_y médiane cibles")
|
||||
ax[3].plot(inst, [v - sep_x[-1] for v in sep_x], ".-", lw=0.8, label="x REFG43N - REF42")
|
||||
ax[3].plot(inst, [v - sep_y[-1] for v in sep_y], ".-", lw=0.8, label="y REFG43N - REF42")
|
||||
ax[3].set_ylabel("écart brut des 2 réf. [px]"); ax[3].legend(fontsize=8)
|
||||
for a in ax:
|
||||
a.axvline(datetime(2026, 10, 9, 12), color="r", ls=":", lw=0.8)
|
||||
a.grid(alpha=.3)
|
||||
fig.suptitle("MICHIGAN : températures des composants et corr des cibles (UTC) ; pointillé rouge : perte de REFPOU22")
|
||||
fig.tight_layout(); fig.savefig(f"{OUT}/temp_corr.png", dpi=90)
|
||||
print(f"{OUT}/temp_corr.png")
|
||||
@@ -0,0 +1,37 @@
|
||||
"""Zoom : températures horaires et médiane des cibles (corr_x, corr_y), écart des deux références.
|
||||
Lancer depuis la racine : .venv/bin/python labeling/auto/etiqueteur/MICHIGAN_2026-10-01/outils/zoom.py DEBUT FIN NOM
|
||||
"""
|
||||
import csv, glob, sys
|
||||
from datetime import datetime
|
||||
import matplotlib
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pyplot as plt
|
||||
import matplotlib.dates as mdates
|
||||
|
||||
D, OUT = "data/MICHIGAN", "labeling/auto/etiqueteur/MICHIGAN_2026-10-01"
|
||||
A, B, NOM = datetime.fromisoformat(sys.argv[1]), datetime.fromisoformat(sys.argv[2]), sys.argv[3]
|
||||
SENS = ["A0", "CPU", "GPU", "PLL", "thermal"]
|
||||
fig, ax = plt.subplots(4, 1, figsize=(15, 11), sharex=True)
|
||||
for s in SENS:
|
||||
pts = []
|
||||
for f in sorted(glob.glob(f"{D}/metrics/MICHIGAN_sensor_{s}_deg_c_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
t = datetime.fromisoformat(r["time_utc"][:19].replace(" ", "T"))
|
||||
if A <= t <= B and r["metric"]:
|
||||
pts.append((t, float(r["metric"])))
|
||||
ax[0].plot([p[0] for p in pts], [p[1] for p in pts], ".-", ms=3, lw=0.8, label=s)
|
||||
ax[0].legend(ncol=5, fontsize=8); ax[0].set_ylabel("°C (horaire)")
|
||||
R = list(csv.DictReader(open(f"{OUT}/temp_corr.tsv"), delimiter="\t"))
|
||||
R = [r for r in R if A <= datetime.fromisoformat(r["instant"][:-1]) <= B]
|
||||
T = [datetime.fromisoformat(r["instant"][:-1]) for r in R]
|
||||
ax[1].plot(T, [float(r["cx_med"]) for r in R], "o-", ms=3, label="corr_x médiane cibles")
|
||||
ax[2].plot(T, [float(r["cy_med"]) for r in R], "o-", ms=3, color="C1", label="corr_y médiane cibles")
|
||||
ax[3].plot(T, [float(r["sepx"]) for r in R], "o-", ms=3, label="x REFG43N - REF42")
|
||||
ax[3].plot(T, [float(r["sepy"]) - float(R[0]["sepy"]) + float(R[0]["sepx"]) for r in R], "o-", ms=3,
|
||||
label="y REFG43N - REF42 (décalé)")
|
||||
for a in ax:
|
||||
a.grid(alpha=.3); a.legend(fontsize=8)
|
||||
a.xaxis.set_major_locator(mdates.HourLocator(byhour=[0, 12]))
|
||||
a.xaxis.set_major_formatter(mdates.DateFormatter("%d.%m\n%H:%M"))
|
||||
fig.suptitle(f"MICHIGAN {A:%d.%m %H:%M} - {B:%d.%m %H:%M} UTC")
|
||||
fig.tight_layout(); p = f"{OUT}/zoom_{NOM}.png"; fig.savefig(p, dpi=85); print(p)
|
||||
Reference in new issue
Block a user