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:
1 parent
c779de7720
commit
ddb17c2189
321 files changed
+18464
-3426
No files matched your search
@@ -0,0 +1,44 @@
|
||||
"""Requalification: for each input label, the targets whose ranges.py ranges (k 5) intersect the label,
|
||||
in each mode (static, rolling ±3, ±6, ±12 measurements), with the largest |deviation| in noises.
|
||||
Usage: python3 requalify.py <analysis folder>"""
|
||||
import json, re, sys
|
||||
from datetime import datetime
|
||||
|
||||
D = sys.argv[1]
|
||||
P = lambda s: datetime.strptime(s, "%Y-%m-%dT%H:%MZ")
|
||||
LINE = re.compile(r"^(\S+?)\s*(\d{4}-\d\d-\d\dT\d\d:\d\dZ)\s+(\S+)\s+(\d+)\s+(\S+)\s+(\S+)\s+(\S+)\s+(\d+)")
|
||||
|
||||
|
||||
def parse(path):
|
||||
out, col = [], None
|
||||
for l in open(path):
|
||||
if ": ranges more than" in l:
|
||||
col = l.split(":")[0]
|
||||
continue
|
||||
if l.startswith("Instants"):
|
||||
col = None
|
||||
m = LINE.match(l.strip()) if col else None
|
||||
if m:
|
||||
s, a, b, n, d, k, at, rej = m.groups()
|
||||
out.append((col, s.strip(), P(a), P(b), float(k), P(at), int(n), int(rej)))
|
||||
return out
|
||||
|
||||
|
||||
modes = {m: parse(f"{D}/work/requal/ranges_{m}.txt") for m in ("static", "r3", "r6", "r12")}
|
||||
for l in open(f"{D}/work/requalify_input.jsonl"):
|
||||
lab = json.loads(l)
|
||||
a, b = P(lab["start"]), P(lab["end"])
|
||||
print(f"\n{lab['id']} {lab['start']} -> {lab['end']} {lab['family']}")
|
||||
for m, rs in modes.items():
|
||||
hits = {}
|
||||
for col, s, ra, rb, k, at, n, rej in rs:
|
||||
if "REF" in s:
|
||||
continue
|
||||
# the extreme must fall strictly inside the label (between its bounds, bounds excluded)
|
||||
if a < at < b:
|
||||
key = (s, col)
|
||||
if key not in hits or abs(k) > abs(hits[key][0]):
|
||||
hits[key] = (k, at, n)
|
||||
top = sorted(hits.items(), key=lambda kv: -abs(kv[1][0]))[:6]
|
||||
txt = ", ".join(f"{s.replace('PWD_', '').replace('_C09', '')} {c[-1]} {v[0]:+.1f}@{v[1]:%dT%H}({v[2]})" for (s, c), v in top)
|
||||
print(f" {m:6} n={len(hits):2} {txt}")
|
||||
@@ -0,0 +1,51 @@
|
||||
"""Thermal labels: per target, deviation of corr_x / corr_y from the night level (median of the accepted
|
||||
measurements of the N hours before the label start), in the target's own noise (ranges.py: median of
|
||||
|consecutive differences| over the batch). Instants under another Visibility or Obstruction label (not the plant labels, which touch one target) are skipped, so a passage
|
||||
or the sun does not count for the thermal. Prints, per label, the targets beyond 5 noises on at least two
|
||||
measurements, with the largest deviation, and the largest deviation overall.
|
||||
Usage: python3 thermal_night.py <analysis folder> [hours before, default 6]"""
|
||||
import json, sys, statistics
|
||||
from datetime import timedelta
|
||||
sys.path.insert(0, "tools/scripts")
|
||||
import data
|
||||
from common import own_noise
|
||||
|
||||
D = sys.argv[1]
|
||||
H = int(sys.argv[2]) if len(sys.argv) > 2 else 6
|
||||
by = data.load("data/NIEDERHORN")
|
||||
B0, B1 = data.parse_time("2026-10-10T17:00Z"), data.parse_time("2026-10-21T12:00Z")
|
||||
labels = [json.loads(l) for l in open(f"{D}/work/requalify_input.jsonl")]
|
||||
others = [(data.parse_time(l["start"]), data.parse_time(l["end"])) for l in labels
|
||||
if l["family"] in ("Obstruction", "Visibility") and "PWD_IMP_B07_016_C09 alone" not in l["description"]]
|
||||
covered = lambda t: any(a < t < b for a, b in others)
|
||||
# the plant labels concern PWD_IMP_B07_016_C09 alone: that target is left out of the thermal test instead
|
||||
targets = [s for s in by if "REF" not in s and s != "PWD_IMP_B07_016_C09"]
|
||||
noise = {}
|
||||
for s in targets:
|
||||
for c in ("corr_x", "corr_y"):
|
||||
v = [m[c] for m in data.filter_window(by[s], B0, B1) if not data.rejected(m) and m[c] is not None]
|
||||
noise[(s, c)] = own_noise(v) if len(v) > 2 else None
|
||||
for lab in labels:
|
||||
if lab["family"] != "Thermal displacement":
|
||||
continue
|
||||
a, b = data.parse_time(lab["start"]), data.parse_time(lab["end"])
|
||||
rows = []
|
||||
for s in targets:
|
||||
ms = [m for m in data.filter_window(by[s], a - timedelta(hours=H), b) if not data.rejected(m)]
|
||||
for c in ("corr_x", "corr_y"):
|
||||
n = noise[(s, c)]
|
||||
night = [m[c] for m in ms if m["t"] <= a and m[c] is not None]
|
||||
inside = [(m["t"], m[c]) for m in ms if a < m["t"] < b and m[c] is not None and not covered(m["t"])]
|
||||
if not n or len(night) < 3 or not inside:
|
||||
continue
|
||||
lvl = statistics.median(night)
|
||||
dev = [((v - lvl) / n, t) for t, v in inside]
|
||||
big = [d for d in dev if abs(d[0]) > 5]
|
||||
ext = max(dev, key=lambda d: abs(d[0]))
|
||||
rows.append((abs(ext[0]), s, c, ext, len(big), len(inside)))
|
||||
rows.sort(reverse=True)
|
||||
many = [r for r in rows if r[4] >= 2]
|
||||
print(f"\n{lab['id']} {lab['start']} -> {lab['end']}: {len(many)} target-columns beyond 5 noises on >= 2 measurements")
|
||||
for r in (many or rows)[:6]:
|
||||
_, s, c, (d, t), k, n = r
|
||||
print(f" {s.replace('PWD_', '').replace('_C09', ''):12} {c[-1]} {d:+6.1f} at {t:%dT%H} ({k}/{n} measurements beyond 5)")
|
||||
@@ -0,0 +1,22 @@
|
||||
"""Requalified labels: kept as they are (id dropped), 61 and 169 rewritten (review dropped), 6 removed."""
|
||||
import json, sys
|
||||
D = sys.argv[1]
|
||||
REMOVED = {"NIEDERHORN-59", "NIEDERHORN-64", "NIEDERHORN-65", "NIEDERHORN-80", "NIEDERHORN-83", "NIEDERHORN-86"}
|
||||
NEW = {
|
||||
"NIEDERHORN-61": "At night and in the morning, for several hours: the recognition error of many targets rises and many are rejected at times (especially PWD_IMP_B07_017_C09, PWD_RMP_B12_017_C09, PWD_RMP_B12_018_C09, PWD_RMP_B15_018_C09, PWD_RMP_B15_019_C09, e06, e09 and the targets on the left), and the corrected curves of the targets still measured move far beyond their noise: from 09:00 to 12:00 the corr_x of PWD_RMP_B15_020_C09, PWD_IMP_B08_025_C09, PWD_RMP_B16_026_C09, e15 and e14 drops strongly, deepest between 10:00 and 12:00, then comes back; at 12:00 PWD_RMP_B12_017_C09 jumps up on corr_x, PWD_RMP_B12_018_C09 and PWD_RMP_B15_018_C09 on corr_y; at 14:00 the corr_x of e06 and e09 drops for one measurement and the corr_y of e14 jumps up, before the return to normal in late morning. The references hold, higher up on the road. The train of 13:00 and the plant in front of PWD_IMP_B07_016_C09 are labelled apart. Probable cause: rain or mist (smaller and weaker spots on the 11:00 thumbnails, without any obstacle). The structure does not move: do not trust the curves over the range.",
|
||||
"NIEDERHORN-169": "When measurements resume after the night gap, in the early morning: many targets are rejected at the first measurements (PWD_IMP_B07_017_C09, PWD_IMP_B07_018_C09, the PWD_RMP_B12 row, PWD_RMP_B15_018_C09, PWD_RMP_B15_019_C09, e02, e06, e09), and the corrected curves of the targets still measured move far beyond their noise: at the first two measurements the corr_x of PWD_IMP_B08_025_C09 drops strongly, that of PWD_RMP_B15_020_C09, PWD_RMP_B17_026_C09, PWD_IMP_B08_024_C09 and e14 clearly, and they only come back at 14:00; at 13:00 PWD_RMP_B15_019_C09 jumps up on corr_y and PWD_RMP_B17_026_C09 drops again on corr_x; until the afternoon, PWD_RMP_B16_026_C09 and e10, on the left edge, stay unsettled and jump on corr_x from one measurement to the next, on top of the level change of the left-edge targets labelled apart. The references hold. The trains of 17:00 and 19:00 are labelled apart. Weaker spots on the 12:00 image, without any obstacle: probable cause, a night of rain or mist like the others, not established. The structure does not move: do not trust the curves over the range.",
|
||||
}
|
||||
out = []
|
||||
for l in open(f"{D}/work/requalify_input.jsonl"):
|
||||
lab = json.loads(l)
|
||||
i = lab.pop("id")
|
||||
if i in REMOVED:
|
||||
continue
|
||||
if i in NEW:
|
||||
lab["description"] = NEW[i]
|
||||
lab.pop("review", None)
|
||||
out.append(lab)
|
||||
with open(f"{D}/labels.jsonl", "w") as f:
|
||||
for lab in out:
|
||||
f.write(json.dumps(lab, ensure_ascii=False) + "\n")
|
||||
print(len(out), "labels")
|
||||
Reference in new issue
Block a user