70 lines
7.6 KiB
Markdown
70 lines
7.6 KiB
Markdown
# Modification
|
|
|
|
**Verdict**: changed
|
|
**Changed**: scripts/thumbnails.py
|
|
**data.py**: unchanged
|
|
|
|
## What the analyst used
|
|
|
|
- Tools: `inventory.py` (range, then for distances and mm/px), `overview.py` (range and 24-26/10, common, residuals, `--rigid` on 29/10), `days.py --bounds --night 22-4 --smoothing 5`, `metrics.py`, `quality.py --common --step 1d` and `--labels … --outside`, `ranges.py --columns corr_x,corr_y --rolling 12 --merge 0min` (requalification), `thumbnails.py` (sensors, and `--zone` over the whole image), whole images through `ls | grep`.
|
|
- Its own scripts (`scripts/`): `scan.py` (per instant: rejections, retained references, pose, low flux, sensors off their rolling median by more than K own noises), `edges.py`, `amp.py`, `drift.py` (15-min medians against a base window), `forgotten.py` (instants where at least N sensors jump, outside the non-thermal labels), `requal_instant.py` (deviation of every target from its ±12 local level at an instant, in own noise), `requal_hourly.py` / `requal_thermal.py` (hourly median against a level window), `requal_measure.py`, `build_labels.py`, `report_table.py`, `requal_write.py`.
|
|
- What got in its way ("Difficulties"): `thumbnails.py --sensors` with a sensor whose `x`, `y` are empty stopped on a Python traceback (`min() iterable argument is empty`); `quality.py --outside` lists only image-metric drops, so it found the shifts of a far reference and the jumps with a whole flux with its own scan (`forgotten.py`).
|
|
|
|
## Diagnosis
|
|
|
|
- `thumbnails.py`: a requested sensor with no filled `x`, `y` anywhere in the export makes `measurement()` call `min()` on an empty sequence, and the tool crashes. This happens in sensor mode and also in `--zone` mode (the crosses). `check()` only catches unknown names. On today's data the case cannot be reproduced on LENZSPITZE, because the re-pump of 2026-11-18 dropped 1023 and 8019 from the exports, so the tool now reports them as unknown sensors. The defect is still in the code for any station whose export leaves `x`, `y` empty for a sensor. I reproduced it on a test copy (below).
|
|
- `quality.py --outside` only covers the image metrics, which is its job. To list the instants where several `corr` jump outside the labels, `ranges.py --rolling N --instants 2` already does most of what `forgotten.py` / `scan.py` did. The guide does not point from one to the other. The fix would be one sentence in `GUIDE.md`, which I could not commit (see "Not fixed").
|
|
|
|
## What I decided
|
|
|
|
- `thumbnails.py`: changed. A sensor without any `x`, `y` is left out with a printed line that names it and points to `--zone`. If no sensor is left and there is no `--zone`, the tool exits with a clear message. `measurement()` also needs `y` to be filled, not only `x`. One sentence is added to the docstring. Options and outputs are unchanged.
|
|
- `quality.py`: left. Making it report `corr` jumps would duplicate `ranges.py --instants`.
|
|
- `ranges.py`: left. `--rolling` with `--instants` already covers `forgotten.py`, `scan.py` and `requal_instant.py`, except for filtering by a labels file. The pointer belongs in the guide (proposed below).
|
|
- Analyst scripts `requal_hourly.py`, `requal_thermal.py`, `drift.py`, `edges.py`, `amp.py`: left where they are. They are hard-coded to this station and range, and mostly covered by `summary.py --step 1h`, `days.py --bounds` and `ranges.py`. Adding a tool for them would be a contraption for one range.
|
|
- Nothing removed.
|
|
|
|
## What changed
|
|
|
|
- S1, commit `9900604`, `scripts/thumbnails.py`:
|
|
- After `check("sensors", …)`, a new rule. Sensors with no measurement carrying both `x` and `y` are printed (`No x, y for … in the export: not placed (--zone X,Y,W,H looks at the scene around them).`) and dropped from the sensor list. With no sensor left and no `--zone`, the tool exits with `No sensor left to centre a thumbnail on.`
|
|
- `measurement()`: the filter goes from `m["x"] is not None` to `m["x"] is not None and m["y"] is not None`.
|
|
- Docstring: one more sentence saying such a sensor is left out and said so.
|
|
|
|
## Why
|
|
|
|
- Asking for thumbnails of a sensor that has no position in the export crashed the whole sheet with a traceback, including the other sensors and the `--zone` mode. Now the sensor is named and skipped, the sheet of the others is drawn, and the analyst is pointed to `--zone`.
|
|
|
|
## Checks
|
|
|
|
Checks: none. Trials, on the range, outputs in `sessions/LENZSPITZE_2026-10-23T2355_2026-11-01T1140_20261118T1049Z/work/tools/`:
|
|
- Test copy built by `tools/blank_xy.py data/LENZSPITZE 20261025 1006 <tmp>/LENZSPITZE`: the 25/10 export with `x`, `y` of 1006 emptied, images linked. It lives in a temporary folder, now deleted.
|
|
- Before (HEAD version) on the test copy, `--sensors 1006,1018`: `ValueError: min() iterable argument is empty`.
|
|
- After, `--sensors 1006,1018 --times 2026-10-25T05:01Z,2026-10-25T06:01Z --radius 40`: one `No x, y for 1006` line, then the 1018 sheet (`LENZSPITZE_thumbnails_1018_250501-250601.png`, checked with Read: two thumbnails, spot centred). rc 0.
|
|
- After, `--sensors 1006` alone: the line, then `No sensor left to centre a thumbnail on.`, rc 1, no traceback.
|
|
- After, `--sensors 1006,1018 --zone 1200,1000,600,400`: the line, then the zone sheet with only 1018 crossed (`LENZSPITZE_thumbnails_zone1200-1000-600-400_1018_250601.png`, checked with Read). rc 0.
|
|
|
|
Report commands rerun: 3, no failure. `report.md` cites no command. These are the analyst's `thumbnails.py` sheets, rebuilt from the names of the PNGs in its `work/thumbs/`, run on the real station with `--out …/work/`: sensors 1006,1018,1002,1009 on 25/10 05:01-07:00 (checked with Read, identical layout), sensors 1011,1017,1012,1006 at six times, and the whole-image `--zone 0,0,3088,2064` at four times.
|
|
|
|
## For the user to decide
|
|
|
|
- A sentence for `GUIDE.md`, "quality" section, after the `--outside` bullet: "It sees only the image metrics: jumps of `corr` with a whole flux (a far reference that shifts, the basis that changes) come from `ranges.py --rolling N --instants 2` on the same range." I did not write it. `GUIDE.md` carries another session's uncommitted change, which I was told neither to commit nor to revert.
|
|
|
|
## Not fixed
|
|
|
|
- The guide pointer above, from `quality.py --outside` to `ranges.py --rolling --instants`, for the same reason.
|
|
- The restriction to instants outside the labels of a file (what `forgotten.py` added) has no equivalent in `ranges.py`. A `--labels F` option for `--instants` would need its guide entry in the same change, so it is blocked for the same reason. It may also not be worth a new option, since `--outside T1/T2` already exists for one episode.
|
|
|
|
## Limits
|
|
|
|
- The original crash (1023) cannot be reproduced on today's LENZSPITZE data: the re-pump dropped 1023 and 8019 from the exports. The fix was tried on a test copy with one sensor's `x`, `y` emptied.
|
|
|
|
## Tools
|
|
|
|
- `sessions/LENZSPITZE_2026-10-23T2355_2026-11-01T1140_20261118T1049Z/tools/blank_xy.py`: builds a test station folder from one day's export, with `x`, `y` emptied for chosen sensors and the images linked. Arguments: `<station folder> <YYYYMMDD> <SENSOR,…> <new folder>`. Run it with `python3 -I`. Worth keeping to test any tool against a sensor without a position.
|
|
|
|
## Difficulties
|
|
|
|
- `GUIDE.md` was already modified by another session and must not be committed. Every fix that needs a guide sentence (the `CLAUDE.md` rule: a new option enters the guide in the same change) was therefore out of reach. I kept to a fix that needs no guide change and put the rest under "For the user to decide".
|
|
- The case in the evidence (1023) no longer exists in the data after the re-pump, so I built a test copy to reproduce it.
|
|
- The output folder already holds files from the detectors upgrader (`tools/`, `modification.md`). My script sits next to theirs in `tools/`.
|