# Modification **Verdict**: changed **Changed**: scripts/ranges.py **data.py**: unchanged ## What the analyst used - Tools: `ranges.py` (`--k 5 --outside`, plain and `--rolling 12`), `inventory.py`, and `data.load` imported directly by its scripts. Earlier in the reading it also used `overview.py`, `days.py --bounds`, `quality.py`, `plot.py` and `thumbnails.py`. - Its scripts: `requalify.py` runs `ranges.py` once per label (100 runs, each on a window around the label with the noise taken outside it) and parses the range tables. `neighbours.py` takes the rolling deviation at a label's instant and counts how many instants in a window around reach at least as far. `thermal.py` takes the hourly median of corr inside each thermal label against the night before. `bounds.py`, `scan.py`, `win.py` and `build.py` are left over from the earlier reading and only served this range. - What got in its way: 100 runs of `ranges.py` took more than ten minutes. Each run reads the whole station (about 5 s here), whatever `--start`/`--end` say. Also, whether a one-measurement event counts as "beyond 5 noises" depended on the window the noise was computed over (LENZSPITZE-81 at 4.8 against 82 at 5.7). To settle it, the analyst wrote `neighbours.py`: does the instant stand out from the instants around it? ## Diagnosis - Measuring a set of labels: `ranges.py --labels` already measures every label in one run (12 s for the whole week here), but its per-label line only gives the largest deviation in noises of the whole window. It does not say whether that deviation stands out from the surroundings of the label. That is why the analyst fell back on one `--outside` run per label plus `neighbours.py`. Cause: the `--labels` section of `ranges.py` lacks a measure that does not depend on the noise scale. - The noise-window ambiguity (81 against 82): a count of the measurements around that reach as far is the same whatever window the noise comes from. Adding that count to the per-label line removes the dependence. - The slow loop: the cost is `data.load` reading all files. Fixing that would mean touching `data.py`, which is allowed only for a reading error. With the count above, one `--labels` run replaces the loop. - `thermal.py` (night level against hourly median): `days.py` already gives night levels and the day cycle. Not needed. ## What I decided - `ranges.py`: changed (S1, commit e03d911). In the `--labels` section, each label's line ends with `as far around`: n/m, where m is the number of measurements of the same sensor-column within `--margin` before the start and after the end (outside the label), and n is how many of them deviate from the level at least as much as the largest deviation inside. This is `neighbours.py` made general, inside an existing option, as values with no threshold. Existing options and outputs are unchanged. - `neighbours.py`: not added as a script, superseded by the option above. - `requalify.py`: not added. Once the count exists, the loop is one `ranges.py --labels F --rolling 12 --margin 3h` run. - `thermal.py`, `bounds.py`, `scan.py`, `win.py`, `build.py`: left in the analysis. They are specific to this range or covered by `days.py`, `ranges.py --labels` and `quality.py`. - No removal. ## What changed - S1, e03d911, `scripts/ranges.py`: in the per-label line of `--labels`, after `instants > k`, a new column `as far around` (n/m) for the sensor-column of the largest deviation inside. It follows the same level (window median, or rolling with `--rolling`) and covers the measurements within `--margin` on both sides, outside the label. The heading lines and the docstring (item 4) explain it. Nothing else changes. ## Why - A brief label's deviation in "noises" depends on the window the noise comes from, so a label near the threshold falls on one side or the other depending on the window. The count of measurements around that reach as far does not depend on that scale. It tells an instant that stands out from a sensor that already moves that much around it, and it comes in the same single run that measures all the labels. ## Checks - `python3 tools/scripts/ranges.py data/LENZSPITZE --columns corr_x,corr_y --k 5 --rolling 12 --labels labeling/auto/analyses/LENZSPITZE_2026-10-16T0235_2026-10-23T2355/work/requalify_input.jsonl --margin 3h --start 2026-10-15T20:00Z --end 2026-10-24T06:00Z`: 12 s for the 50 labels. Before: `work/tools/ranges-labels-before.txt`. After: `work/tools/ranges-labels-after.txt`. The only differences are the per-label heading and the new column, for example: - LENZSPITZE-79: 1013.cy −7.5, as far around 0/75 - LENZSPITZE-81: 8002.cx +6.0, 1/74 - LENZSPITZE-82: 8017.cy −5.0, 0/77 - LENZSPITZE-85: 102H.cy −15.8, 0/75 - LENZSPITZE-88: 1003.cx +4.1, 25/75 - On the same command, the old `ranges.py` (HEAD before S1) and the new one give byte-identical output outside `--labels`. - `python3 tools/scripts/quality.py --self-test`: ok. - No PNG: `ranges.py` writes none. - Report commands rerun: 3 (`requalify.py … plain`, `requalify.py … 12`, `ranges.py … --k 3 --rolling 12 … --outside 2026-10-19T12:55Z/2026-10-19T13:05Z`), outputs in `work/`. No failure. - The two requalify outputs differ from the analysis's files in a few counts (for example, targets>5 31 → 30 on LENZSPITZE-1). The cause is commits to the tools made after the analysis, not S1: the old and new `ranges.py` give identical output on these commands. - The background job showed as "failed" only because `diff` exits 1 when files differ. ## For the user to decide - GUIDE.md was not touched, because the request says to neither commit nor revert it, but `CLAUDE.md` wants a new output in the guide in the same change. Two sentences are proposed for the `--labels` bullet of `### ranges`: - "the line of each label ends with `as far around` n/m: of the m measurements of that sensor-column within `--margin` around the label, n reach at least as far (it does not depend on the window the noise comes from: a brief label near the threshold is read with it)." - "To measure all the labels of a range, one run with `--labels` over the range widened by `--margin` (each run reads the whole station), not one run per label." - The count is given for the largest sensor-column only, not for each of the `--top` rows. Those rows measure against the level before the label, and a count against a different level would be confusing. ## Not fixed - The time to read the station on each run (about 5 s per run here, whatever the window): `data.load` reads every file. Restricting it to a window would mean changing `data.py`, which the rules allow only for a reading error. - The rule for which window the noise is computed over is a labelling rule (labeling-rules.md), outside the tools. ## Limits none ## Tools none. No script written. The edit was applied once with an inline Python replacement, then with Edit. ## Difficulties - The request forbids committing GUIDE.md (already modified), while the target's `CLAUDE.md` wants the guide updated in the same change. I followed the narrower request and put the guide sentences under "For the user to decide". - `ranges.py` has no `--out`, so the trial outputs are text files in `work/tools/`. - My first edit of `ranges.py` was an inline Python heredoc rather than the Edit tool. It made no other change.