Skip to content

Add scripts to assess reference and difference image creation - #696

Merged
abostroem merged 7 commits into
mainfrom
scripts/reference-coverage-report
Dec 4, 2026
Merged

abostroem merged 7 commits into
mainfrom
scripts/reference-coverage-report

Conversation

@abostroem

Copy link
Copy Markdown
Contributor

For reference coverage scripts/reference_coverage.py will produce two maps:

  1. A summary map showing the full coverage of a run (or dataset) and which references failed
  2. For each reference, the actual coverage vs potential coverage based on the MJD cut off time and all L2 files in the database for a given dataset/run

For difference images, the script scripts/difference_coverage.py plots all pixels in processed difference images, outlining failed difference image foot prints, and showing the outline of reference files (note that this isn’t the same as pixel coverage on those reference files, which may be a better metric)

Azalee Bostroem and others added 7 commits December 3, 2026 09:59
…s references and their coverage

Outside the pipeline, read-only. For a run's reference jobs (every state)
or a dataset's official references, optionally of one program, it writes:

- references.md: one row per reference with its outcome, grade, frames
  coadded beside the candidates it could have, and the real and possible
  fraction at min_coverage_depth; then the fields with rows to difference
  and no reference.
- ref-<field>-<filter>-<job>.png: the published coverage map beside the
  full possible depth, replayed from the l2files corners with
  rapidpipe.products.coverage and no stop at max_frames or
  max_coverage_fraction, less the manifest's skipped frames.
- overview-<filter>.png: the depth of the L2 footprints before the bound
  on the tangent plane about the scope's centre (unit-vector mean, so a
  scope across R.A. 0/360 is one piece), each reference outlined by outcome.

Tested: 18 unit tests (geometry across R.A. 0 and at a pole, possible
depth, records, figures on synthetic maps) and 3 tests/db tests (the run,
dataset and program scopes and the command) pass locally. Not run against
a real run or a real coverage map. The rapid_docs page is not yet updated.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…s well as its RAPID one

Each name goes through rapidpipe.products.filters.rapid_filter_name, so
F062 and R062 select the same filter, in any case. The report's names
stay the RAPID ones, as the filters table has them; a name in neither
spelling is still a usage error (exit 64).

Tested: a new tests/db test (F146, W146 and f146 give the same
references, F062 and R062 none for a W146-only run, F999 exits 64); the
script's 22 tests pass locally. The full suites were not rerun.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…iew-run-<id>-<filter>.png

The overview's file name carries the scope it was drawn for, so two runs
written under one --out directory keep both: run-<id> for a run,
dataset-<name> or dataset-<name>-program-<id> for a dataset, a character
of the dataset's name that is unsafe in a file name written as "_". The
per-reference figures and references.md keep their names.

Tested: the unit and tests/db tests are updated for the new names, with
the dataset and program name checked; the script's 22 tests pass locally.
The full suites were not rerun.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ces' coverage figures only

--max-maps N reads the coverage map and draws the per-reference figure
of the first N references, in the table's order (field, filter, job).
Every reference keeps its row and its outline on the overview; one whose
map is not read takes its real fraction from its manifest, blank when
the manifest has none. It is exclusive with --no-maps, and a negative N
is a usage error (exit 64).

Tested: a new unit test (two references, --max-maps 1: one figure and
one map-read fraction) and two usage-error cases; the script's 25 tests
pass locally. The full suites were not rerun.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ram's difference images were made

One figure per filter, differences-<scope>-<filter>.png: the sky under a
difference image filled, each failed difference job's frame outlined in
red, and the reference footprints outlined (solid bound, dashed not).
A failed job whose frame another job differenced is counted as recovered
and not outlined; one that names no l2files input is counted as unplaced.

reference_coverage.py: the scope's names, the --filter parsing and a
reference's outline are now functions both scripts call; no change in
behaviour.

Tested: 6 unit tests and 3 tests/db tests for the new script, with the
reference script's tests, on a throwaway PostgreSQL 18. Not run against
a real run.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…e's title

With --run the title reads "run N, dataset NAME, filter: ...". File
names are unchanged.

Tested: the script's 6 unit and 3 tests/db tests pass; none reads the
title text.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…un, ref-run-<run>-<field>-<filter>-j<job>.png

The run is the reference job's own, and the job number carries a j.

Tested: the script's unit tests pass (21); its tests/db tests passed
with the run number, before the j was added.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@abostroem
abostroem merged commit 77ca93b into main Dec 4, 2026
5 checks passed
@abostroem
abostroem deleted the scripts/reference-coverage-report branch December 4, 2026 23:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant