auto: labels requalified under the 5-noise rules (only what stands out from the noise): 32 analyses refined, the 6 paused periods verified, the long labels requalified with the fixes the period analysts found; 1153 -> 961 labels

- 32 analyses: each label kept, rewritten or removed by its analyst (section Requalification of the report; mm magnitudes where the targets have them)
- SNCF01 x3, WILDSTRUBEL 2026-09-01 -> 2026-10-06 x3: verified from their existing labels under the new rules
- long labels (no analysis): auto/analyses/long-labels/<STATION>/; NORDEND-169 and -195 run to 07/11, so NORDEND-283 and -284 (their continuation) are removed
- reading-rules.md, stations.md: the citations of removed or rewritten labels point to their successor, or to [expert]

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
maximeandClaude Opus 5.5 committed 2026-11-17 23:58:00 +01:00
1 parent c779de7720
commit ddb17c2189
321 files changed
+18464 -3426

No files matched your search

@@ -0,0 +1,22 @@
"""Writes labels.jsonl from work/requalify_input.jsonl: removed labels dropped, rewritten ones replaced (review field
dropped), the others kept exactly; the id field removed."""
import json, sys
D = sys.argv[1]
REMOVED = {"NORDEND-183", "NORDEND-188", "NORDEND-191", "NORDEND-194", "NORDEND-199", "NORDEND-201", "NORDEND-207",
"NORDEND-274", "NORDEND-277"}
NEW = {
"NORDEND-186": "In mid-afternoon, the sun lights the rock behind the references CTR02 and CTR03 and the local reference CTR01 (zone thumbnails of 14:30, 15:30 and 16:15: the rock bright around them at 15:30, back in shadow at 16:15), the wall of the targets staying in shadow. The error_value of CTR03 rises markedly without it being discarded, CTR01 (read as a target) is rejected; the references move apart a little on corr_y and the corr_y of PR13, PR12 and PR11 drop clearly together for a measurement or two, then come back. Cause seen on the thumbnails: the sun on the rock behind the references, which disturbs the base. Not a movement; ignore the points of the range.",
"NORDEND-208": "Weak thermal cycle of the camera: overcast day, the housing temperature barely rises (highest around 14:00); the pan barely drops, the tilt rises barely more; the camera comes back in the evening and at night, when the housing cools down below its morning level, and the pan goes beyond its level of the day before. By day the compensation absorbs it, the corrected curves staying close to their night level; but in the evening the corr_y of PR06, PR05, PR01, PR11 and PR12 drop a little together and stay low all night, until the start of the next morning: what the compensation leaves of the night overshoot of the camera. The jumps of the faint targets by day are labelled separately. Deduced cause: the pose follows the housing temperature, and the rock face of the quarry does not move with the temperature. The structure does not move, nothing to do.",
"NORDEND-210": "Weak thermal cycle of the camera: overcast day, the housing temperature only rises a little (highest around 14:00); the pan drops a little, the tilt rises a little less; but the camera does not come back at night: on the morning of the 23rd, before the rain, the pan is still lower than the day before, by almost its whole drop of the day. The compensation does not absorb it all: in the morning the corr_y of PR01, PR12, PR05, PR10, PR11 and PR06 rise a little together and stay up all afternoon and night, like the pan, and the corr_x of PR18 drops a little in the afternoon and evening. The jumps of the morning and of midday are labelled separately. Deduced cause: the pose follows the housing temperature, and the rock face of the quarry does not move with the temperature. The structure does not move, nothing to do.",
"NORDEND-214": "Weak thermal cycle of the camera: overcast day, the housing temperature only rises a little (highest around 12:00); the pan drops a little, the tilt rises as much; the camera comes back in the afternoon, until the night of rain (separate label). The compensation does not absorb it all: from late morning the corr_y of PR13 rises clearly, those of PR06, PR12 and PR18 a little, and they are not yet back at their night level when the label ends. The two one-measurement jumps of the afternoon are labelled separately. Deduced cause: the pose follows the housing temperature, and the rock face of the quarry does not move with the temperature. The structure does not move, nothing to do.",
}
with open(f"{D}/labels.jsonl", "w") as out:
for line in open(f"{D}/work/requalify_input.jsonl"):
d = json.loads(line)
i = d.pop("id")
if i in REMOVED:
continue
if i in NEW:
d["description"] = NEW[i]
d.pop("review", None)
out.write(json.dumps(d, ensure_ascii=False) + "\n")
@@ -0,0 +1,77 @@
"""Requalification of the labels of the analysis: for each label, runs tools/scripts/ranges.py at --k 5 on corr_x, corr_y
and keeps the ranges of the targets (global references CTR02, CTR03, CTR04 excluded) that fall inside the label.
- movement labels (Visibility, Displacement, Obstruction): window = label +- 3 h, --outside label (level and noise
of the hours around); labels longer than 4 h: window = the label, --rolling 8 (local level under the thermal cycle).
- Thermal displacement: window = 5 h before the start (end of night) + label, --outside label: level and noise of the
night that precedes; instants covered by a non-thermal label are not counted; ranges of >= 3 measurements reported.
- No data, and the labels of missing points: their ranges are listed too (what the other curves do meanwhile).
Usage: python3 <this> <labels.jsonl> <out.txt>
"""
import json, re, subprocess, sys
from datetime import datetime, timedelta, timezone
REFS = {"CTR02", "CTR03", "CTR04"}
F = "%Y-%m-%dT%H:%MZ"
def p(s):
return datetime.strptime(s, F).replace(tzinfo=timezone.utc)
def f(t):
return t.strftime(F)
def ranges(start, end, extra):
cmd = ["python3", "tools/scripts/ranges.py", "data/NORDEND", "--columns", "corr_x,corr_y", "--k", "5",
"--start", f(start), "--end", f(end)] + extra
out = subprocess.run(cmd, capture_output=True, text=True).stdout
res, col = [], None
for line in out.splitlines():
m = re.match(r"(corr_[xy]): ranges more than", line)
if m:
col = m.group(1)
continue
if line.startswith("=="):
col = None
if col:
tok = line.split()
if len(tok) >= 7 and re.match(r"\d{4}-", tok[1]):
res.append(dict(col=col, s=tok[0], a=p(tok[1]), b=p(tok[2]), n=int(tok[3]), v=float(tok[4]),
k=float(tok[5]), at=tok[6]))
return cmd, res
labels = [json.loads(l) for l in open(sys.argv[1])]
other = [(p(l["start"]), p(l["end"])) for l in labels if l["family"] not in ("Thermal displacement", "No data")]
out = open(sys.argv[2], "w")
for l in labels:
s, e = p(l["start"]), p(l["end"])
fam = l["family"]
if fam == "Thermal displacement":
cmd, rs = ranges(s - timedelta(hours=5), e, ["--outside", f"{f(s)}/{f(e)}"])
keep = []
for r in rs:
if r["s"] in REFS or r["b"] <= s or r["a"] >= e:
continue
# measurements of the range outside the non-thermal labels: approximated by the range span
inside_other = any(a < r["a"] and r["b"] < b for a, b in other)
if not inside_other and r["n"] >= 3:
keep.append(r)
else:
long = e - s > timedelta(hours=4)
if long:
cmd, rs = ranges(s, e, ["--rolling", "8"])
else:
cmd, rs = ranges(s - timedelta(hours=3), e + timedelta(hours=3), ["--outside", f"{f(s)}/{f(e)}"])
keep = [r for r in rs if r["s"] not in REFS and r["a"] < e and r["b"] > s]
keep.sort(key=lambda r: -abs(r["k"]))
best = keep[0] if keep else None
out.write(f"{l.get('id')} {l['start']} {l['end']} {fam}\n cmd: {' '.join(cmd[1:])}\n")
out.write(f" max: {best['s']} {best['col']} {best['k']:+.1f} noises ({best['v']:+.4f}) at {best['at']} n={best['n']}\n"
if best else " max: none beyond 5 noises\n")
for r in keep[:8]:
out.write(f" {r['s']:6} {r['col']} {f(r['a'])}..{f(r['b'])} n={r['n']} {r['k']:+.1f} at {r['at']}\n")
out.write("\n")
out.flush()
@@ -0,0 +1,60 @@
"""Thermal labels: does a target keep the camera cycle beyond 5 noises from its night level?
Per target (global references CTR02-04 out; PR04, PR17, CTR01 out: their curves carry their own Target issue /
Obstruction labels): night level = median of the accepted corr over the 5 h before the label start (end of the night
that precedes); noise = own noise (median |difference| between consecutive accepted measurements) over the label;
deviation = median of 3 consecutive measurements minus the night level, in noises; instants inside a non-thermal,
non-No-data label are skipped. Prints, per label, the targets beyond 5 noises: the extreme, its instant, and how many
measurements (smoothed) are beyond.
Usage: python3 <this> <labels.jsonl>
"""
import json, statistics, sys
from datetime import timedelta
sys.path.insert(0, "tools/scripts")
import data, common
EXCL = {"CTR02", "CTR03", "CTR04", "PR04", "PR17", "CTR01"}
by = data.load("data/NORDEND")
labels = [json.loads(l) for l in open(sys.argv[1])]
other = [(data.parse_time(l["start"]), data.parse_time(l["end"])) for l in labels
if l["family"] not in ("Thermal displacement", "No data")]
def covered(t):
return any(a < t < b for a, b in other)
for l in labels:
if l["family"] != "Thermal displacement":
continue
s, e = data.parse_time(l["start"]), data.parse_time(l["end"])
print(f"{l['id']} {l['start']} {l['end']}")
rows = []
for name, ms in by.items():
if name in EXCL:
continue
for col in ("corr_x", "corr_y"):
night = [m[col] for m in ms if s - timedelta(hours=5) <= m["t"] <= s and m[col] is not None]
lab = [(m["t"], m[col]) for m in ms if s <= m["t"] <= e and m[col] is not None]
if len(night) < 5 or len(lab) < 5:
continue
lvl = statistics.median(night)
nz = common.own_noise([v for _, v in lab])
if not nz:
continue
dev = []
for i in range(1, len(lab) - 1):
t = lab[i][0]
if covered(t):
continue
v = statistics.median([lab[i - 1][1], lab[i][1], lab[i + 1][1]])
dev.append((t, (v - lvl) / nz, v - lvl))
big = [d for d in dev if abs(d[1]) > 5]
if big:
x = max(big, key=lambda d: abs(d[1]))
rows.append((abs(x[1]), f" {name:5} {col} extreme {x[1]:+.1f} noises ({x[2]:+.4f} px, noise {nz:.4f}) at "
f"{data.iso(x[0])}; {len(big)} measurements beyond, "
f"{data.iso(big[0][0])} .. {data.iso(big[-1][0])}"))
rows.sort(reverse=True)
for _, r in rows[:6]:
print(r)
print(f" targets beyond 5 noises: {len(rows)}\n")