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,49 @@
|
||||
"""Par capteur : variation de x, y bruts, relative, corr entre deux instants ; corrélation corr_x / température A0."""
|
||||
import csv, glob, statistics, sys
|
||||
from datetime import datetime, timedelta
|
||||
|
||||
D = "data/NEBRASKA"
|
||||
rows = []
|
||||
for f in sorted(glob.glob(f"{D}/displacement/*.csv")):
|
||||
rows += list(csv.DictReader(open(f)))
|
||||
by = {}
|
||||
for r in rows:
|
||||
by.setdefault(r["sensor_name"], {})[r["time_utc"][:16]] = r
|
||||
temp = {}
|
||||
for f in glob.glob(f"{D}/metrics/NEBRASKA_sensor_A0_deg_c_*.csv"):
|
||||
for r in csv.DictReader(open(f)):
|
||||
if r["metric"]:
|
||||
temp[r["time_utc"][:16]] = float(r["metric"])
|
||||
|
||||
pairs = [a.split("/") for a in sys.argv[1:]]
|
||||
for t0, t1 in pairs:
|
||||
print(f"\n{t0} -> {t1}")
|
||||
print("capteur x0 y0 dx dy drelx drely dcorrx dcorry err0 err1")
|
||||
for s in sorted(by):
|
||||
a, b = by[s].get(t0), by[s].get(t1)
|
||||
if not a or not b:
|
||||
continue
|
||||
f = lambda r, k: float(r[k]) if r[k] else float("nan")
|
||||
print(f"{s:10s} {f(a,'x'):7.1f} {f(a,'y'):7.1f} {f(b,'x')-f(a,'x'):+7.3f} {f(b,'y')-f(a,'y'):+7.3f} "
|
||||
f"{f(b,'relative_x')-f(a,'relative_x'):+7.3f} {f(b,'relative_y')-f(a,'relative_y'):+7.3f} "
|
||||
f"{f(b,'corr_x')-f(a,'corr_x'):+7.3f} {f(b,'corr_y')-f(a,'corr_y'):+7.3f} {f(a,'error_value'):.3f} {f(b,'error_value'):.3f}")
|
||||
|
||||
# corrélation corr_x / température (moyenne des 12 h avant), depuis 2026-10-09T12:00
|
||||
def moy12(t):
|
||||
d = datetime.fromisoformat(t)
|
||||
v = [temp.get((d - timedelta(hours=h)).isoformat(sep=" ")[:16]) for h in range(12)]
|
||||
v = [x for x in v if x is not None]
|
||||
return statistics.mean(v) if v else None
|
||||
print("\ncorrélation corr_x, corr_y / A0 (moyenne 12 h), mesures depuis 2026-10-09 12:00 ; puis lot seul")
|
||||
for deb, fin in [("2026-10-09 12:00", "2026-11-02 12:00"), ("2026-10-20 00:00", "2026-10-31 20:00")]:
|
||||
print(deb, fin)
|
||||
for s in sorted(by):
|
||||
xs, ys, ts = [], [], []
|
||||
for t, r in by[s].items():
|
||||
if deb <= t <= fin and r["corr_x"]:
|
||||
m = moy12(t)
|
||||
if m is not None:
|
||||
xs.append(float(r["corr_x"])); ys.append(float(r["corr_y"])); ts.append(m)
|
||||
if len(xs) > 10 and statistics.pstdev(xs) > 1e-9:
|
||||
print(f" {s:10s} r(corr_x,T) {statistics.correlation(xs, ts):+.2f} pente {statistics.linear_regression(ts, xs).slope:+.4f}/°C"
|
||||
f" r(corr_y,T) {statistics.correlation(ys, ts):+.2f}")
|
||||
@@ -0,0 +1,70 @@
|
||||
"""Température (metrics/sensor_*) face aux corr des cibles, NEBRASKA, toute la période."""
|
||||
import csv, glob, statistics, sys
|
||||
from datetime import datetime
|
||||
import matplotlib
|
||||
matplotlib.use("Agg")
|
||||
import matplotlib.pyplot as plt
|
||||
|
||||
D = "data/NEBRASKA"
|
||||
OUT = "labeling/auto/etiqueteur/NEBRASKA_2026-10-20/"
|
||||
|
||||
def t(s):
|
||||
return datetime.fromisoformat(s[:19])
|
||||
|
||||
temps = {}
|
||||
for nom in ["A0", "CPU", "thermal"]:
|
||||
pts = []
|
||||
for f in sorted(glob.glob(f"{D}/metrics/NEBRASKA_sensor_{nom}_deg_c_*.csv")):
|
||||
for r in csv.DictReader(open(f)):
|
||||
if r["metric"]:
|
||||
pts.append((t(r["time_utc"]), float(r["metric"])))
|
||||
temps[nom] = pts
|
||||
|
||||
rows = []
|
||||
for f in sorted(glob.glob(f"{D}/displacement/*.csv")):
|
||||
rows += list(csv.DictReader(open(f)))
|
||||
cibles = sorted({r["sensor_name"] for r in rows if r["pattern_type"] == "target"})
|
||||
series = {}
|
||||
for r in rows:
|
||||
if r["corr_x"] == "":
|
||||
continue
|
||||
series.setdefault(r["sensor_name"], []).append((t(r["time_utc"]), float(r["corr_x"]), float(r["corr_y"]), float(r["error_value"])))
|
||||
inst = sorted({p[0] for c in cibles for p in series[c]})
|
||||
med = {}
|
||||
for c in cibles:
|
||||
m = statistics.median(p[1] for p in series[c]); my = statistics.median(p[2] for p in series[c])
|
||||
for p in series[c]:
|
||||
med.setdefault(p[0], []).append((p[1] - m, p[2] - my))
|
||||
mx = [statistics.median(v[0] for v in med[i]) for i in inst]
|
||||
my = [statistics.median(v[1] for v in med[i]) for i in inst]
|
||||
|
||||
fig, ax = plt.subplots(4, 1, figsize=(16, 13), sharex=True)
|
||||
for nom, pts in temps.items():
|
||||
ax[0].plot([p[0] for p in pts], [p[1] for p in pts], label=nom, lw=0.8)
|
||||
ax[0].set_ylabel("°C"); ax[0].legend()
|
||||
ax[1].plot(inst, mx, "k.-", lw=0.8, label="médiane corr_x cibles")
|
||||
for c in ["COLJ20", "POUJ20", "COLH19"]:
|
||||
s = series[c]; m = statistics.median(p[1] for p in s)
|
||||
ax[1].plot([p[0] for p in s], [p[1] - m for p in s], lw=0.6, label=c)
|
||||
ax[1].legend(); ax[1].set_ylabel("corr_x - niveau")
|
||||
ax[2].plot(inst, my, "k.-", lw=0.8, label="médiane corr_y cibles")
|
||||
for c in ["COLH19", "COLH20", "POUH19", "COLJ20"]:
|
||||
s = series[c]; m = statistics.median(p[2] for p in s)
|
||||
ax[2].plot([p[0] for p in s], [p[2] - m for p in s], lw=0.6, label=c)
|
||||
ax[2].legend(); ax[2].set_ylabel("corr_y - niveau")
|
||||
for c in ["COLH19", "COLH20", "POUH19", "COLJ20"]:
|
||||
s = series[c]
|
||||
ax[3].plot([p[0] for p in s], [p[3] for p in s], lw=0.7, label=c)
|
||||
ax[3].legend(); ax[3].set_ylabel("error_value")
|
||||
for a in ax:
|
||||
a.axvspan(datetime(2026, 10, 20), datetime(2026, 11, 1), color="0.93")
|
||||
a.grid(alpha=.3)
|
||||
fig.tight_layout(); fig.savefig(OUT + "temp_corr.png", dpi=80)
|
||||
# table journalière : temp A0 moyenne et min, médiane corr_x
|
||||
jours = sorted({p[0].date() for p in temps["A0"]})
|
||||
for j in jours:
|
||||
v = [p[1] for p in temps["A0"] if p[0].date() == j]
|
||||
vx = [mx[k] for k, i in enumerate(inst) if i.date() == j]
|
||||
vy = [my[k] for k, i in enumerate(inst) if i.date() == j]
|
||||
print(j, f"A0 moy {statistics.mean(v):5.1f} min {min(v):5.1f} max {max(v):5.1f}",
|
||||
f"corr_x med {statistics.median(vx):+.3f}" if vx else "", f"corr_y med {statistics.median(vy):+.3f}" if vy else "")
|
||||
Reference in new issue
Block a user