Files
aimsight-optimizer/sessions/WILDSTRUBEL_2026-09-24T0230_2026-10-06T1945_20261118T1119Z/modification.md
T

169 lines
18 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# Modification
**Verdict**: changed
**Changed**: scripts/thermal_displacement.py, scripts/visibility.py, thresholds.md
## Diagnosis
WILDSTRUBEL, 2026-09-24 → 2026-10-07 (UTC), cadence 15 min (7 targets, 6 references). The station is off every night from 29/09 on.
Range score before, per instant (wrongly = flagged instants that no label puts in the family):
| Family | labelled | found | flagged | wrongly |
|---|---|---|---|---|
| Displacement | 500 | 0 | 0 | 0 |
| No data | 19 | 15 | 21 | 6 |
| Obstruction | 694 | 72 | 201 | 129 |
| Perturbation | 44 | 1 | 4 | 3 |
| Target issue | 975 | 957 | 958 | 1 |
| Thermal displacement | 204 | 144 | 249 | 105 |
| Visibility | 96 | 94 | 486 | 392 |
- **Missed, Thermal displacement** (WILDSTRUBEL-138 02/10, WILDSTRUBEL-169 06/10): no wave at all from 02/10 on. Cause: `thermal_displacement._wave` only emits the daily episodes on the days that go into the profile, the days measured at least `MIN_HOURS` (20 h). Every day cut by the night outage is dropped, even though its morning is measured. Fixed (S1).
- **Missed or not as Obstruction, one-measurement passages in front of R1/R2 (two references), sometimes with one or two targets** (WILDSTRUBEL-86, 94, 103, 116, 123, 125, 127, 147, 160, 165, 171, 172): only a jump back, absorbed into the day's Heat shimmer (so Visibility), or nothing. Cause: the single-instant Brief obstruction rule of `visibility.py` allowed "at most one reference" and "fewer than `BRIEF_MIN` sensors" (in practice 3 or 4 sensors, two of them references), and required the sensors not to be rejected at the neighbouring instants. Fixed by removing these conditions (S2, S3, then S5 and S6 through pruning).
- **Missed, long obstructions** (WILDSTRUBEL-96 and 144, cars parked in front of a group; WILDSTRUBEL-141, PA1_2 partly covered for 7 h): the sensors were rejected for hours, which the neighbouring-instants condition excluded. Found after S5.
- **Wrong family, Visibility read as Obstruction after S5/S6** (WILDSTRUBEL-135, 148, 228: PA_8 too faint in daylight for hours; 223 to 225: PA_8 lost at sunrise; 175: very dark capture): a reference rejected with nothing in front of it. The labels' cause comes from the images; the detector only sees a reference strongly rejected. An alternative reading (see "For the user to decide").
- **Extra, Visibility (Heat shimmer), every day 04:00-15:00 on 11 to 13 sensors** (392 wrongly flagged instants, the largest defect of the range): the re-check removed the daily shimmer labels (wiggles under 5 noises). Cause: `visibility.heat_shimmer` compares the agitation to the sensor's own calm hours (`RATIO` 1.5×), and the daytime agitation is always above the night. Not fixed: the same station still has daily shimmer labels outside the re-checked range (1-9/09, 22-23/09, 08-09/10) with the same deviations (7 to 13 noises against 9 to 16 on the removed days, `tools/shimmer_stats.py`), so no rule separates them.
- **Extra, Thermal displacement (Camera thermal), every day on 13 sensors**: the labels only keep the days and targets (PB1_2, PB2_2) where the corrected curves keep the camera wave. Cause: the camera branch of `_wave` emits every day on every sensor. Not fixed: on every station, the deviation of the corrected curves during the wave does not separate labelled from unlabelled days (`tools/thermal_days.py`, `tools/thermal_split.py`). The jumps from lost references drive it as much as the wave.
- **Missed, Obstruction WILDSTRUBEL-81** (PB2_2, 24/09 → 01/10, about 650 of the 694 labelled instants): a partly covered spot, known from the thumbnails. The curve shifts and partly comes back (below `K` = 20 noises; it would be a Displacement anyway). See "Limits".
- **Missed, Displacement WILDSTRUBEL-89** (PB1_2 slow drift 25-29/09, about 0.5 mm, "at the threshold" according to the report), **WILDSTRUBEL-120** (change of level of PB_5 and PA3_2 after the night stop, about 0.7 mm), **WILDSTRUBEL-173** (PB1_2 step of about 1 mm on 06/10): all below `K` = 20 noises and the slow-drift `SIZE`/`PIECE`. In the benchmark, which runs the detectors over the whole two-month window, a window-wide Slow drift on one target covers WILDSTRUBEL-89 (500/534 found). On the range with 3 days of history it does not.
- **Missed, Perturbation WILDSTRUBEL-136, 153** (common shift of all targets in y, then its return over a day): slow, below the jump thresholds; `_together` leaves out slower moves on purpose (the thermal wave).
- **Correct**: Target issue (R3, WILDSTRUBEL-46/130); No data (the night outages, 4 of 19 instants at the gaps' bounds); Visibility found 94/96 (the shimmer covers the labelled moments, not a real detection of them).
## What changed
- **S1** (`3d3c7d4`), `scripts/thermal_displacement.py`, `_wave`: the daily expansion and contraction episodes are emitted for every day the targets with a cycle are measured (`{m["t"].date() for s in concerned targets for m in measurements[s]}`). Before, only the days in the profile were used (≥ `MIN_HOURS` measured). The profile itself still uses full days only. Docstring step 4 updated.
- **S2** (`3bda184`), `scripts/visibility.py`, Brief obstruction rule (2): condition `len(few & refs) <= 1` (at most one reference) removed. Docstring updated.
- **S3** (`44fa7c3`), `scripts/visibility.py`, same rule: condition `len(few) < BRIEF_MIN` (fewer than 3 rejected sensors) removed. Docstring updated.
- **S4** (`eeaf726`), pruning, `scripts/thermal_displacement.py`: the check `if e[peak] < WARM: return []` and the constant `WARM = 0.3` removed, with its line in `thresholds.md`. Docstring step 4 updated. No figure changes.
- **S5** (`7973839`), pruning, `scripts/visibility.py`: the condition "not rejected at the neighbouring instants" removed, with the `rejected` dict it alone used. Docstring updated: a sensor rejected at an instant or over a long time is an Obstruction; its instants make one event through `categories.MERGE`.
- **S6** (`75276f9`), pruning, `scripts/visibility.py`: the condition `n(t) < BRIEF_MIN` of the same branch removed. The rule is now: a salient instant (≥ `BRIEF_MIN` high, `SALIENCE` × the neighbours), otherwise the sensors rejected at `FACTOR` × their median.
## Why
- S1: a station that stops at night loses its full days. The thermal wave of its mornings, still measured, disappeared with them. Only the profile needs full days; emitting the wave does not.
- S2, S3: something passing in front of two references at once (plus one or two targets) makes all targets jump for one measurement. The rule excluded it because of its reference count and its sensor count, so it was left to the jump-back logic (Visibility or Perturbation).
- S5, S6: the remaining conditions of that branch only excluded true obstructions: long ones (parked cars, a covered target) and ones that come with a few high sensors. Removing them adds found Obstruction on five stations with an unchanged overall "correct", and simplifies the code.
- S4: the WARM threshold never decided anything on the benchmark (the median gap at the peak is always above it).
## Checks
- events: see "Before / after on the range"; no `skipped` line in any output.
- sensors: the new events carry the rejected sensors (e.g. 26/09 04:00-07:00, 10 sensors; 02/10 13:00-20:15, PA1_2 with one target); the thermal days of 02/10 → 06/10 carry the 13 sensors of the camera branch (`sensors-S6.txt`).
- range: Obstruction found 72/694 (10 %) → 138/694 (20 %), correct 72/201 (36 %) → 138/285 (48 %); Thermal displacement found 144/204 (71 %) → 196/204 (96 %), correct 144/249 (58 %) → 196/387 (51 %); other families unchanged.
- benchmark: 0 regression at each step (`benchmark-S1.txt` … `benchmark-S6.txt`); complexity 606 code lines, 46 constants → 602, 45.
## Pruning
Rules of `visibility.py` (Brief obstruction) and `thermal_displacement.py` (`_wave`), each tried without it on a copy, against the last committed state:
- `visibility`, "not rejected at the neighbouring instants": removed, S5 `7973839`.
- `visibility`, `n(t) < BRIEF_MIN` in the second branch: removed, S6 `75276f9` (no regression both before and after S5).
- `visibility`, `x > FACTOR * med` for a rejected sensor (strong): kept; without it, Total Obstruction correct 27 → 25 % (632 instants), REGRESSION; before S5, WILDSTRUBEL Obstruction found 26 → 21 % too.
- `visibility`, `SALIENCE` (salient instant, `n(t) >= SALIENCE × the neighbours`): kept; without it (or at 1), REGRESSION on Visibility found: Total 56 → 48-50 %, LENZSPITZE 66 → 53-56 %, NORDEND 44 → 32-36 %, NIEDERHORN 42 → 21 %.
- `thermal_displacement`, `WARM`: removed, S4 `eeaf726`.
- `thermal_displacement`, `RETURN` replaced by `EDGE`: kept; REGRESSION Thermal found Total 82 → 74 %, JUNGFRAU 100 → 68 %, ALASKA 71 → 50 %, WILDSTRUBEL 100 → 68 %.
- `thermal_displacement`, `EDGE` replaced by `RETURN`: kept; REGRESSION SNCF01 Thermal correct 89 → 82 % (159 instants).
- `thermal_displacement`, the 24 h sinusoid check (`R2_MIN`): kept; REGRESSION NIEDERHORN Thermal correct 87 → 67 %, WILDSTRUBEL 25 → 19 %.
- `thermal_displacement`, the `REPRO` likeness check: kept; REGRESSION Total Thermal correct 69 → 58 % (4186 instants), NIEDERHORN 87 → 71 %.
- `thermal_displacement`, the `slides` fallback (Camera thermal movement): kept; REGRESSION Thermal found Total 82 → 66 %, LENZSPITZE 92 → 0 %, WYOMING 51 → 0 %.
## Before / after on the range
Events check, changed lines (full diff: `events-diff.txt`; 47 lines added, 11 removed). Removed: the single-instant Brief obstructions of 28/09 06:00, 30/09 13:45, 01/10 08:00, 02/10 06:15, 03/10 08:45, 10:30, 12:30, 04/10 05:30, 11:30, 05/10 08:45, 06/10 10:45. Each one is absorbed into a longer Obstruction event below.
```
> 2026-09-24T05:30Z → 2026-09-24T06:15Z Obstruction | Brief obstruction | 3 sensors
> 2026-09-24T09:15Z → 2026-09-24T10:00Z Obstruction | Brief obstruction | 5 sensors (WILDSTRUBEL-86)
> 2026-09-25T12:15Z → 2026-09-25T12:15Z Obstruction | Brief obstruction | 2 sensors (WILDSTRUBEL-94)
> 2026-09-26T04:00Z → 2026-09-26T07:00Z Obstruction | Brief obstruction | 10 sensors (WILDSTRUBEL-96)
> 2026-09-27T04:30Z → 2026-09-27T06:00Z Obstruction (two events) | 1 and 4 sensors (WILDSTRUBEL-224, Visibility)
> 2026-09-27T07:00Z → 2026-09-27T07:00Z Obstruction | Brief obstruction | 4 sensors (WILDSTRUBEL-103)
> 2026-09-28T04:30Z, 05:15Z → 06:30Z Obstruction | 1 and 5 sensors (WILDSTRUBEL-225 Visibility, 107)
> 2026-09-29T05:15Z → 2026-09-29T06:45Z Obstruction | 4 sensors
> 2026-09-29T10:15Z → 2026-09-29T11:00Z Obstruction | 4 sensors (WILDSTRUBEL-116)
> 2026-09-30T07:45Z → 08:00Z, 09:30Z, 11:00Z → 11:15Z Obstruction | 2 sensors (WILDSTRUBEL-123, 125, 127)
> 2026-10-01T05:15Z → 08:45Z, 09:00Z → 12:45Z Obstruction | 8 and 4 sensors (WILDSTRUBEL-135, Visibility)
> 2026-10-02T04:00Z → 12:00Z Thermal displacement | Camera thermal expansion/contraction (WILDSTRUBEL-138)
> 2026-10-02T04:45Z → 07:15Z, 08:45Z → 12:15Z Obstruction | 3 sensors (WILDSTRUBEL-228, Visibility)
> 2026-10-02T12:45Z, 13:00Z → 20:15Z Obstruction | 4 and 2 sensors (WILDSTRUBEL-141)
> 2026-10-03T04:00Z → 12:00Z Thermal displacement (no label)
> 2026-10-03T05:00Z → 2026-10-03T12:30Z Obstruction | 12 sensors (WILDSTRUBEL-144, 147, 148, 150, 229, 230)
> 2026-10-04T04:00Z → 12:00Z Thermal displacement (no label)
> 2026-10-04T04:42Z → 07:00Z, 08:00Z, 11:00Z → 11:30Z, 13:45Z Obstruction (WILDSTRUBEL-157, 231, 160)
> 2026-10-05T04:00Z → 12:00Z Thermal displacement (no label)
> 2026-10-05T06:00Z → 06:15Z, 08:15Z → 08:45Z, 10:30Z → 10:45Z Obstruction (WILDSTRUBEL-165, 166, 232)
> 2026-10-06T04:00Z → 12:00Z Thermal displacement (WILDSTRUBEL-169)
> 2026-10-06T05:45Z → 06:45Z, 07:45Z, 10:30Z → 11:00Z, 14:30Z Obstruction (WILDSTRUBEL-235, 171, 172, 174, 175)
```
Range score, before → after:
| Family | found | correct |
|---|---|---|
| Displacement | 0/500 (0 %) → same | — |
| No data | 15/19 (79 %) → same | 15/21 (71 %) → same |
| Obstruction | 72/694 (10 %) → 138/694 (20 %) | 72/201 (36 %) → 138/285 (48 %) |
| Perturbation | 1/44 (2 %) → same | 1/4 (25 %) → same |
| Target issue | 957/975 (98 %) → same | 957/958 (100 %) → same |
| Thermal displacement | 144/204 (71 %) → 196/204 (96 %) | 144/249 (58 %) → 196/387 (51 %) |
| Visibility | 94/96 (98 %) → same | 94/486 (19 %) → same |
## Benchmark
```
BREITHORN Obstruction found 92 → 100 %
BREITHORN Obstruction correct 53 → 55 %
CLARIDEN Obstruction correct 20 → 11 % (4 instants lost)
FLORIDA Thermal displacement correct 43 → 41 % (52 instants lost)
JUNGFRAU Thermal displacement found 97 → 100 %
LENZSPITZE Obstruction found 32 → 43 %
LENZSPITZE Obstruction correct 6 → 4 % (473 instants lost)
NIEDERHORN Obstruction found 43 → 55 %
NIEDERHORN Obstruction correct 35 → 38 %
NIEDERHORN Thermal displacement found 86 → 89 %
NIEDERHORN Thermal displacement correct 86 → 87 %
NORDEND Obstruction found 31 → 40 %
SNCF01 Thermal displacement found 78 → 87 %
SNCF01 Thermal displacement correct 92 → 89 % (59 instants lost)
Total Obstruction found 31 → 40 %
Total Obstruction correct 27 → 28 %
Total Thermal displacement found 80 → 82 %
Total Thermal displacement correct 70 → 69 % (385 instants lost)
WILDSTRUBEL Obstruction found 24 → 35 %
WILDSTRUBEL Obstruction correct 35 → 41 %
WILDSTRUBEL Thermal displacement found 72 → 100 %
0 regression(s); complexity: 606 code lines, 46 constants → 602 code lines, 45 constants
```
## For the user to decide
- A reference rejected with nothing in front of it is now an Obstruction (S5, S6). The labels say Visibility (WILDSTRUBEL-135 01/10 08:15-13:15, WILDSTRUBEL-148 03/10 08:00-13:45, WILDSTRUBEL-228 02/10 05:15-13:00: PA_8 too faint in daylight; WILDSTRUBEL-223/224/225, 25, 27 and 28/09 at sunrise: PA_8 in the low sun; WILDSTRUBEL-175 06/10 14:30: a dark capture). The detector reads "a few sensors strongly rejected, the rest intact". Only the images separate an object from a faint reference (families.md, "A hindered reference"). The benchmark counts these instants against Obstruction correct (LENZSPITZE 6 → 4 %, CLARIDEN 20 → 11 %, 4 instants). Overall it stays 27 → 28 %.
- The variety stays "Brief obstruction", and its text says "for a single measurement" even when the event, merged by `categories.MERGE`, spans hours (e.g. 02/10 13:00-20:15). The text is what the client sees. A "Target obscured"-like text for multi-instant events would be a small change in `categories.py` or `visibility.py`, not made here (it changes no figure).
- Thermal displacement now covers the days cut by an outage (S1). On this station, it covers them on all sensors through the camera branch, including the unlabelled days 03/10, 04/10, 05/10 (Thermal correct on the range 58 → 51 %; Total correct 70 → 69 %, FLORIDA 43 → 41 %, SNCF01 92 → 89 %, all under the regression threshold).
## Not fixed
- Daily Heat shimmer (392 wrongly flagged instants on the range). The re-checked labels removed it, but the same station's other labels keep it with the same amplitude. Fitting either reading would cost the other. The re-check's rule (agitation under 5 noises is not labelled) would have to be applied to the older WILDSTRUBEL labels before a rule can be tuned.
- Camera thermal wave flagged every day on every sensor, while the labels keep only the days and targets where the corrected curves keep it. No per-day measure tried separates them on the benchmark: the reference-loss jumps dominate the corrected deviation.
- Small displacements below `K` = 20 noises (WILDSTRUBEL-120, 173) and the slow common shift and its return (WILDSTRUBEL-136, 153). Lowering `K` was tuned against E-001 (healthy targets at 17-18 noises), so it was not tried.
## Limits
- WILDSTRUBEL-81 (2026-09-24T02:30 → 2026-10-01T00:00, Obstruction, PB2_2): a spot partly covered, seen on the thumbnails (smaller spot). The measurements show a shift and a partial return, below the jump threshold. Telling it from a Displacement would take the spot size or the image.
- WILDSTRUBEL-89 (2026-09-25T02:30 → 2026-09-29T23:00, Displacement): a drift "at the threshold" according to the report. On a 13-day range with 3 days of history, the slow-drift test cannot see it; over two months it can.
- The Obstruction or Visibility cause of a rejected reference (above) comes from the images.
- The report notes that PB1_2's step of 06/10 (WILDSTRUBEL-173) and drift (WILDSTRUBEL-89) are not established as movements.
## Tools
- `sessions/WILDSTRUBEL_2026-09-24T0230_2026-10-06T1945_20261118T1119Z/tools/labels_in_range.py <labels.jsonl> FROM TO [width]`: the labels touching a range. Worth keeping.
- `.../tools/shimmer_stats.py <detectors> <labels dir> <data dir> [STATIONS]`: per Heat shimmer episode of each benchmark station, the share labelled Visibility and the targets' largest deviation from their local level, in noises. Worth keeping for the shimmer question. Output: `shimmer_stats.out`.
- `.../tools/thermal_days.py <detectors> <labels dir> <data dir> [STATIONS]`: per Thermal episode, the share labelled and the corrected curves' deviation from the level before. Output: `thermal_days.out`. `thermal_split.py <thermal_days.out> K...`: the labelled and unlabelled instants a threshold would drop. Kept for the camera-wave question.
- `.../tools/instants.py <detectors> <station folder> T...`: per sensor at given instants (and around them), error_value in MAD (r if rejected) and corr_x/corr_y deviation in noises. Worth keeping.
- `.../tools/variant.py <detectors> <dest> <scripts/file.py> <old> <new>`: a copy of the detectors with one exact substitution, for pruning. Worth keeping.
## Difficulties
- The range score runs the detectors with 3 days of history, the benchmark over each station's whole labelled window. A window-wide Slow drift that covers WILDSTRUBEL-89 in the benchmark (500/534 found) is absent from the range (0/500). I judged the range on its own output and the regressions on the benchmark.
- S4 was amended once, before any other commit, to rewrap a docstring line (same fix, unpushed).