"""Build labels.jsonl from work/existing.jsonl: kept as they are (review kept), corrected (review dropped), removed, added. Usage: python3 build_labels.py (from the repository root) """ import json, os D = "labeling/auto/analyses/WILDSTRUBEL_2026-09-24T0230_2026-10-06T1945" old = [json.loads(l) for l in open(os.path.join(D, "work/existing.jsonl"))] W = "WILDSTRUBEL-" REMOVED = { # daily heat shimmer: the daytime agitation stays under 5 own noises outside the moments labelled apart 82: "shimmer", 90: "shimmer", 97: "shimmer", 101: "shimmer", 105: "shimmer", 114: "shimmer", 122: "shimmer", 134: "shimmer", 139: "shimmer", 146: "shimmer", 156: "shimmer", 164: "shimmer", 170: "shimmer", # daily camera cycle that the corrected curves do not keep beyond 5 noises (single agitated points only) 91: "thermal", 98: "thermal", 102: "thermal", 145: "thermal", 155: "thermal", 163: "thermal", # PB1_2 alone by day: the same dip as the camera wave, merged into the thermal labels 83 and 113 84: "merged", 112: "merged", # passages and one-measurement losses whose effect on the other curves stays under 5 noises 87: "sub", 88: "sub", 92: "sub", 93: "sub", 95: "sub", 99: "sub", 100: "sub", 104: "sub", 108: "sub", 109: "sub", 110: "sub", 115: "sub", 117: "sub", 124: "sub", 126: "sub", 128: "sub", 129: "sub", 149: "sub", 158: "sub", 159: "sub", 167: "replaced by the R1 label of 05/10 10:15", } CORR = {} CORR[83] = dict(description=( "At sunrise, the camera nods down: its tilt rises, with its scale and its rotation, and all the raw positions, " "references included, move together in the image; the tilt peaks in early morning, goes below its night level in " "late morning, then comes back to it in early afternoon, while the housing temperature rises; the scale and the pan " "come back more slowly, until mid-afternoon. The compensation follows most of it, but not at the bottom of the " "image: the two targets closest to the camera, PB1_2 and PB2_2, keep part of the wave. The corr_y of PB2_2 (whose " "spot is partly covered, separate label) rises clearly from early morning to late morning, that of PB1_2 a little; " "the corr_x of PB1_2 dips at sunrise and in the morning, then comes back. Their raw positions move slightly away " "from the overall movement of the targets: a remainder of the camera movement that the compensation does not take " "at the nearest targets. The other targets keep nothing beyond the noise. Deduced cause: the mount or the lens of " "the camera heats up in the sun; according to the expert, the road hardly moves with temperature and the system " "compensates this movement well. Normal, nothing to do; the small morning wave of PB1_2 and PB2_2 is not a " "movement.")) CORR[113] = dict(description=( "At the restart at sunrise, after the night outage, the camera nods down: its tilt rises, with its scale and its " "rotation, and all the raw positions, references included, move together in the image; the tilt is highest in early " "morning, goes below its night level in late morning and comes back to it in early afternoon, while the housing " "temperature rises. The compensation follows most of it, but the target closest to the camera, PB1_2, at the bottom " "of the image, keeps part of the wave: its corr_x goes down clearly just after sunrise, the most in early morning, " "and comes back in mid-morning; PB2_2, the next closest, goes down a little on corr_x in the middle of the morning. " "At the same hours their raw positions move away from the overall movement of the targets, the others do not: a " "remainder of the camera movement that the compensation does not take at the nearest targets. The sunlit kerb shows " "as a bright band next to PB1_2 on the 07:15 thumbnail, but it is still lit on the 10:00 one, when the curve is " "back: it does not explain the dip; the error_value of PB1_2 rises by day like those of PB2_2 and PB4, not more. " "Deduced cause: the mount or the lens of the camera heats up in the sun; according to the expert, the road hardly " "moves with temperature. Normal, nothing to do; the morning dip of PB1_2 is not a movement.")) CORR[140] = dict(start="2026-10-02T05:15Z", description=( "At the restart at sunrise, after the night outage, the references PA1_2 and PA_8 are rejected together, then PA_8 " "alone at the next measurement: the basis changes and the corr_y of PA2_2, PB1_2, PB2_2 and PB_5 jump, PA2_2 " "strongly, then PA2_2 and PB2_2 on corr_x. PA_8 is then set aside at times in early morning, and continuously from " "08:00 to 12:45: PA_9 rises on corr_x, PB1_2 too, PA2_2 a little, in steps that follow the entries and exits of " "PA_8; at 12:45, all the references are lost together, PA3_2 and PB4 rejected, with no obstacle visible on the " "image. Everything comes back when PA_8 is taken again at 13:00. Cause: PA_8 poorly seen in daylight, like the day " "before, and at sunrise PA1_2 with it. The steps are not a movement: curves of PA_9, PB1_2, PA2_2, PB2_2 and PB_5 " "not to be trusted over the range.")) CORR[151] = dict(description=( "A vehicle passes on the road, headlights and bodywork translucent on the 11:00 thumbnails: PA3_2 and PA_9 are " "rejected for the time of one measurement, with the reference R2, while PA_8 is set aside (separate label): the " "basis changes and PB2_2 and PB1_2 jump on corr_x, PA2_2 on corr_y. Everything comes back at the next measurement. " "The structure is not moving: point to ignore.")) CORR[152] = dict(description=( "For the time of one measurement, PB1_2 and PB2_2 are rejected together: on their 12:00 thumbnails, a light " "silhouette passes translucent on the pavement, probably a passer-by. At the same measurement the reference PA1_2 is " "rejected too, while PA_8 is set aside (separate label): the basis changes and PA3_2 and PA2_2 jump a little on " "corr_y. Everything comes back at the next measurement. The structure is not moving: point to ignore.")) CORR[168] = dict(end="2026-10-06T05:45Z", description=( "No measurement for any sensor during the night, until the first measurement of the morning. The station shuts down " "for lack of energy: just before the outage, the battery is at its lowest and the voltage below its usual night " "level, and the metrics stop with the measurements; it comes back at the end of the night with the compute board " "still cold (metrics), the first images a little before the first measurement. The curves are missing; nothing moves " "on the structure, but the station does not have enough energy to last the night: to be checked (battery, panel).")) SUN = ("Cause seen: the low sun lights the background behind PA_8, as on the other mornings. The structure is not " "moving: {}.") NEW = [ ("2026-09-24T04:45Z", "2026-09-24T05:15Z", "Visibility", "At sunrise, the reference PA_8 is rejected for the time of one measurement, with its neighbour PA_9: on the 05:00 " "thumbnail, its spot is drowned in bright streaks, the low sun on the background behind it. Without PA_8 the basis " "changes: PA2_2, its neighbour, jumps on corr_x, the other targets barely. Everything comes back at the next " "measurement. " + SUN.format("point to ignore")), ("2026-09-25T04:15Z", "2026-09-25T05:00Z", "Visibility", "At sunrise, the reference PA_8 and its neighbour PA_9 are rejected for two measurements: on the 04:30 thumbnail, " "the spot of PA_8 is drowned in the bright streaks of the low sun on the background. Without PA_8 the basis " "changes: PA2_2 jumps on corr_x, PB1_2 and PB_5 a little, then PB2_2 on corr_x and PA3_2 on corr_y. Everything " "comes back when PA_8 is taken again. " + SUN.format("points to ignore")), ("2026-09-27T04:15Z", "2026-09-27T05:30Z", "Visibility", "At sunrise, the reference PA_8 is rejected for four measurements, PA_9 for three: on the 04:45 and 05:00 " "thumbnails, the spot of PA_8 is drowned in bright streaks of the low sun on the background, which fade by 05:30. " "Without PA_8 the basis changes: PA2_2 jumps on corr_x and corr_y, PA3_2 and PB_5 on corr_x. Everything comes back " "when PA_8 is taken again. " + SUN.format("points to ignore")), ("2026-09-28T04:15Z", "2026-09-28T05:15Z", "Visibility", "At sunrise, the reference PA_8 is rejected for two measurements and PA_9 until 05:15: the basis changes and PA2_2, " "PA3_2, PB1_2 and PB2_2 shift a little on corr_x, PA2_2 on corr_y; at 04:30, PB4, left under its threshold, jumps " "clearly on corr_x and corr_y for that measurement alone; at 05:00, with PA_8 back just under its threshold, PA2_2 " "jumps the other way on corr_y. Everything comes back at 05:15. Cause deduced from the signature of the other " "mornings: PA_8 drowned in the low sun on its background at the same hour (thumbnails of 24/09, 25/09 and 27/09). " "The structure is not moving: points to ignore."), ("2026-10-01T13:45Z", "2026-10-01T14:15Z", "Visibility", "The reference PA_8 is set aside again for the time of one measurement, after its long loss of the late morning " "(separate label): its spot is faint on the 14:00 thumbnail. The basis changes: PA2_2 and PB1_2 jump on corr_x, " "PA_9 and PA3_2 a little. Everything comes back at the next measurement. Cause: PA_8 poorly seen in daylight, as " "the same morning. The structure is not moving: point to ignore."), ("2026-10-04T11:45Z", "2026-10-04T12:15Z", "Visibility", "The reference PA_8 is rejected for the time of one measurement: its spot is faint on the light background of the " "12:00 thumbnail. The basis changes: PA2_2 and PB1_2 jump on corr_x, PB_5 and PB2_2 a little. Everything comes back " "at the next measurement. Cause: PA_8 poorly seen in daylight, as on the previous days. The structure is not " "moving: point to ignore."), ("2026-10-05T10:15Z", "2026-10-05T11:15Z", "Visibility", "The reference R1 is rejected for two measurements: its spot is fainter, under a dark band that thickens just above " "it (10:30 and 10:45 thumbnails, compared with 10:15); no vehicle is seen in front of it. Without R1 the basis " "changes: PB4 jumps on corr_x at 10:30, the other targets barely. At 11:00, R1 is back and a vehicle passes in " "front of PB4 and PA3_2, seen translucent with its lights on their thumbnails: they are rejected with PA_9 for that " "measurement, without effect on the other curves. Everything comes back at 11:15. Cause: R1 less well seen, of a " "nature not established (a shadow on its background is possible). The structure is not moving: points to ignore."), ("2026-10-05T13:15Z", "2026-10-05T13:45Z", "Visibility", "The reference R1 is rejected alone for the time of one measurement: on the 13:30 thumbnail, its spot is much " "brighter and larger than at the other measurements, like that of R2: a capture brighter than usual, with no " "obstacle. Without R1 the basis changes: PB4 and PB_5 jump a little on corr_x. Everything comes back at the next " "measurement. The structure is not moving: point to ignore."), ("2026-10-06T05:45Z", "2026-10-06T06:00Z", "Visibility", "At the first measurement after the night outage, at sunrise, the reference R2 is rejected with PB4: on the 05:45 " "thumbnail, bright streaks of the low sun surround R2. Without R2 the basis changes and PB_5 jumps on corr_x; it " "is back at the next measurement, R2 and PB4 still rejected there, as every morning at this hour. Cause seen: the " "low sun on the background of R2. The structure is not moving: point to ignore."), ("2026-10-06T06:00Z", "2026-10-06T06:30Z", "No data", "The 06:15 measurement is missing for all the sensors, two measurements after the restart from the night outage " "(labelled separately). The station is running: an image exists at 06:17 and the metrics continue, the voltage " "normal for the hour. Cause not established. The curves miss one measurement; nothing to do."), ("2026-10-06T08:00Z", "2026-10-06T08:30Z", "Visibility", "The reference PA_8 is rejected for the time of one measurement: its spot is very faint on the 08:15 thumbnail, " "sharp again at 08:30. Without PA_8, and with R3 taken at that measurement although usually rejected by day, the " "basis changes: PB1_2 jumps strongly on corr_x, PA2_2 and PA_9 clearly, PA_9 and PB1_2 a little on corr_y. " "Everything comes back at the next measurement. Cause: PA_8 poorly seen in daylight. The structure is not moving: " "point to ignore."), ("2026-10-06T08:45Z", "2026-10-06T09:45Z", "Visibility", "The reference R1 is rejected for the time of one measurement: its spot is faint on the 09:00 thumbnail, without " "an obstacle. The basis changes: PB1_2 jumps strongly on corr_x, PB2_2 on corr_y and corr_x, PA3_2, PA2_2 and PB_5 " "on corr_x, PB1_2 and PA2_2 on corr_y. Everything comes back at 09:15, except PA3_2 and PA2_2, a little high on " "corr_x for one or two more measurements, back at 09:45. It falls just after the step of PB1_2 (separate label), " "which it does not change. Cause: R1 less well seen in daylight. The structure is not moving: points to ignore."), ] out = [] for L in old: n = int(L["id"].replace(W, "")) if n in REMOVED: continue L = dict(L) L.pop("id") if n in CORR: L.update(CORR[n]) L.pop("review", None) out.append(L) for s, e, f, d in NEW: out.append({"start": s, "end": e, "family": f, "description": d}) out.sort(key=lambda L: (L["start"], L["end"])) with open(os.path.join(D, "labels.jsonl"), "w") as fh: for L in out: fh.write(json.dumps(L, ensure_ascii=False) + "\n") print(len(old), "old;", len(REMOVED), "removed;", len(CORR), "corrected;", len(NEW), "added;", len(out), "written")