From cfa49c001b0725e18d96929d2134e74a10a748ef Mon Sep 17 00:00:00 2001 From: Azalee Bostroem Date: Fri, 13 Nov 2026 15:02:33 -0800 Subject: [PATCH 1/2] decisions: a precomputed reference PSF set named by the run, run create refusing "precomputed" without one, and "measured" falling back to it; difference, foundation, loop, psf, operations and datasets state them (reference-psf-precomputed) Three rulings (Azalee, 2026-11-06, 2026-11-10 and 2026-11-13), amending the measured reference PSF ("no fallback", "not an input chosen at launch") and the PSF key (a reference PSF's key gains psf_set). The flight overlay moves from its interim "science" (Ben, 2026-11-14) to "precomputed" with the 1043 set (2026-11-24). The difference page's inputs, reference PSF text, outputs and settings; foundation's psfs key, the import's set import and kind-from-call (the DETECTOR fallback kept), and the thin chain's stale psf rows and inputs; loop's psf bullet (science PSF only) and the difference bullet's set row; psf's not-decided items; operations' open question answered; the flight overlay's reference PSF row. For rapid's port/comm-reference-psf-precomputed. Co-Authored-By: Claude Opus 5.5 --- system/datasets.md | 1 + system/decisions.md | 9 ++++++++ system/difference.md | 50 +++++++++++++++++++++++++++++++------------- system/foundation.md | 47 ++++++++++++++++++++++++++--------------- system/loop.md | 14 +++++++++---- system/operations.md | 6 +++--- system/psf.md | 13 +++++++----- 7 files changed, 96 insertions(+), 44 deletions(-) diff --git a/system/datasets.md b/system/datasets.md index 8dc1be9..a9748e0 100644 --- a/system/datasets.md +++ b/system/datasets.md @@ -248,6 +248,7 @@ above and their manifest, which the bucket will not let anyone update. | `meta.photometry` is present | the zero point is the file's, ZPTMAG 25.801 | | The file names no pixel area map: `meta.ref_file.area` is `INCOMPLETE` on every file checked to 2026-11-20, though CRDS serves an on-orbit one per detector (WFI16's `roman_wfi_area_0085`, pedigree INFLIGHT, useafter 2026-10-13, spanning 0.982 to 1.015) | the overlay: `[pixel_area_map] lookup = true`, so intake asks CRDS for the map's name by detector and exposure start and records it as the `l2files` row's `pixel_area_map`; `store` names the maps' copies ([intake](intake.md#the-pixel-area-maps-name), {ref}`decisions `) | | The per-frame zero point moves with the calibration context: commissioning's files under an older CRDS context run up to 0.29 mag off the rest | the overlay: `[reference.awaicgen] use_nominal_zptmag = true` scales each reference input by its filter's on-orbit `[intake.nominal_zptmag]` value, commissioning 687c93b2's table (the median over the 18 SCAs of the files' own zero points, 7,283 of 8,453 commissioning files; F062 26.04, F087 25.73, F106 25.78, F129 25.77, F146 27.01, F158 25.80, F184 25.34, F213 25.29); `ZPTMAG` and `zptmag_rms` stay the file's ({ref}`decisions `) | +| A reference PSF measured from ten stars is not reliable, worst in crowded fields | the overlay: `[difference] reference_psf = "precomputed"` with the 1043 per-filter set, `reference_psf_set = "1043_20260928"`, computed for any orientation ({ref}`ruling `); until the set is imported and official, a loop pass that would plan a difference stops and names the missing row | | At Gaia DR3's epoch 2016.0 the intake's Gaia offset reads (−0.08 to +0.16, −0.56 to −0.35) px, proper motion and not WCS | the overlay: `[intake] gaia_proper_motion = true` carries each star to the frame's mid-exposure; the offset reads dx −0.091 to −0.045, dy −0.060 to −0.038 px; no WCS key | | The program number is real, and one flight dataset holds every program | the overlay: `program_id = ""`, so each file's own `PROGRAM` (1049 here), which must be positive, is its `exposures` row's `program_id` ([intake](intake), Settings) | | The dithers, 0.04 deg apart, put the four centres in three tessellation fields | the loop builds e4's field reference from e1 to e3, every row before the bound whose `overlapfields` list the field, as `dev` ({ref}`decisions `) | diff --git a/system/decisions.md b/system/decisions.md index f2c5f81..c5b67c1 100644 --- a/system/decisions.md +++ b/system/decisions.md @@ -69,6 +69,15 @@ A ruling that closes one goes under Rulings and its line leaves. (decision-flight-reference-psf)= **The flight overlay sets `[difference] reference_psf = "science"`; `"measured"` stays the base's default and an option**: with ZOGY and SFFT's cross-convolution off on flight ({ref}`the scope `, {ref}`crossconv `), nothing published reads the reference PSF, and under `"measured"` a field with fewer than ten measurable reference stars would fail its difference with exit 65 ({ref}`ruling `). `"science"` measures nothing and takes the quality metrics' stars from the reference mosaic's catalog, as the GBTDS overlays do. Flight's science PSF is commissioning's `phavg` library until CRDS delivers flight ePSFs, so flight runs on those PSFs wherever a PSF is used. The precomputed reference PSF (port 7A) lands after the cutover, with the reference catalogue (7B), as its storage. To check on the first flight run: the packet gate's bounds were set from measured-star metrics on HLWAS. (Ben, 2026-11-14 07:00 UTC; rapid 497691b7) +(decision-reference-psf-fallback)= +**`"measured"` falls back to the run's reference PSF set on any measurement error, and a PSF's kind comes from the import call only**: with `[difference] reference_psf_set` named, a difference job whose reference PSF measurement raises anything (fewer than ten stars, or any other failure of the measurement) uses the set's bound row exactly as `"precomputed"` does, instead of failing; with no set named there is no fallback and the job fails as before, so the simulations, which name none, are unchanged. The fallback's own checks still apply, and a fallback that fails them fails the job with both errors in its log and reason. The loop binds the set's row to every such difference job, since the job learns only when it runs whether it needs it. Ten stars are too few for a reliable PSF, and a PSF built on the fly may not be reliable, worst in crowded fields. A `psfs` row's kind is the one the import's scope declares: the same file may serve more than one kind, so a `PSFKIND` header keyword is recorded in the manifest as it was and never checked, for both kinds, which retires the import's refusal of a file whose keyword named the other kind. This amends {ref}`the measured reference PSF ` ("there is no fallback"). (Azalee, 2026-11-13) + +(decision-precomputed-needs-set)= +**`run create` refuses `reference_psf = "precomputed"` with an empty `reference_psf_set`**: the run's body is resolved and checked before it is stored, so a run that would read a set names one, whatever else it enables. Before this, `run create` refused only keys the base lacks. (Azalee, 2026-11-10) + +(decision-reference-psf-precomputed)= +**A reference PSF may be precomputed: an imported set, named by the run and found through `psfs`**: `[difference] reference_psf` gains `"precomputed"`, `dev`'s and commissioning's static reference PSF as an option, imported and never written by a stage. The base stays `"measured"` and the flight overlay sets `"precomputed"` with the 1043 set, replacing its interim `"science"` ({ref}`ruling `), which held flight until this landed after the cutover. `[difference] reference_psf_set` names the set (base empty), a name and not a location, so it is committed in a dataset's overlay or given by `--set`, fixed at `run create`; surveys within one dataset can name different sets. `psfs` gains `psf_set`, filled for the `reference` kind and empty for `science`, and a reference PSF's key is `{dataset, psf_set, fid, sca, kind}`, so several sets are official side by side; a science PSF keeps its key. A set is imported in one `import` job, so it becomes official in one change group: each file's filter, and its SCA when the name has one, come from its name (`refimage_psf_fid[_sca].fits`), and a per-filter file, computed for any orientation, becomes one row for each of the 18 SCAs sharing its one copy. `scripts/import_psf_set.py` plans the job and leaves a key already bound alone unless `--force`, as commissioning's registration does; with it, the job's group replaces the old bindings and `official undo` restores them. A new set under a new name replaces nothing; runs move to it by their overlay. This amends {ref}`the measured reference PSF ` ("not an input chosen at launch") and {ref}`the PSF key `, whose reference key gains the set. (Azalee, 2026-11-06; the flight overlay moved to it from `"science"`, 2026-11-24) + (decision-base-1e5a0b6d-rb)= **From `rapid-rebuild:132` the image builds on base `1e5a0b6d` (photutils 3.1.1), and the `rb` scores that base moves are accepted without a bisect**: the pin on base `576304f3` is lifted, and a later change's like-for-like reference is a run on the same base, run 237 the first, never a run across the base change. On run 187's SCA 3 sample, run 237 (`:132`) against run 235 (`:131`, base `576304f3`) has the same 2,537,235 xsources at the same rows and positions, and `rb` differs by more than 1e-6 on 2,488,689 of them, max 0.95. Sources with S/N > 20 rise 3.8 %; scored candidates move +0.005 %, and packets and the sets the gate holds are equal. The xsources' finder does not read `min_separation`, so the cause is the re-locked base, not {ref}`the 3x3 box `; which package moves the scores is unverified. (Ben, 2026-11-12 21:37 UTC; finder-3x3-accept, rapid PR 605) diff --git a/system/difference.md b/system/difference.md index 82ab7b1..9e69b58 100644 --- a/system/difference.md +++ b/system/difference.md @@ -21,21 +21,25 @@ page states the records it works within, and the ## Scope and inputs The scope is `{"expid", "sca", "fid"}`, the epoch's key without the -dataset, which is the run's. The job names exactly three `input` rows, -read in one short transaction and fetched through `prefix.get`: +dataset, which is the run's. The job names three `input` rows, or four +when it may read a reference PSF set, read in one short transaction and +fetched through `prefix.get`: | Product | Which | |---|---| | `l2files` | the epoch's own row | | `refimages` | one reference of the scope's filter, imported or made by the [reference](reference) stage; its coverage and uncertainty maps sit beside the mosaic, and its mosaic catalog (`refimcatalogs`, `cattype` 1) gives the reference FWHM | | `psfs`, kind `science` | the science image's PSF for the scope's filter and SCA | +| `psfs`, kind `reference` | under `reference_psf = "precomputed"`, or `"measured"` with a `reference_psf_set` named: the official row of the run's set for the scope's filter and SCA, key `{dataset, psf_set, fid, sca, kind}` | -Any other product, a second input of one kind, a `psfs` row of another -kind, or an input whose key is not the scope's fails the job before a -manifest is written. +Any other product, a second input of one kind, a `reference` row the +settings do not call for or of another set, a missing one they do, or an +input whose key is not the scope's fails the job before a manifest is +written. -The reference image's PSF is not an input: it is derived data, measured -by the job ({ref}`ruling `). Right after +`[difference] reference_psf` chooses the reference image's PSF. Under +`"measured"`, the base, it is derived data, measured by the job +({ref}`ruling `). Right after the resampled reference's background is subtracted, the job finds its stars (DAOStarFinder at 8σ on the pixels finite and covered at the coverage threshold; peak at least 400 times the clipped noise and at @@ -53,9 +57,12 @@ science PSF's because the ePSF is built on 31-pixel stamps and holds nothing beyond 15 pixels, where the science PSF still holds 3.3% of its flux: given the truncated stamp, ZOGY left a ring 10 to 20 pixels out at every bright star (run 42, pass 4: 190 of 449 sources above S/N 20), and a -sub-pixel resampling kernel leaves the wings unchanged. Fewer than ten stars stops the job with -exit 65 and `refpsf: N stars, 10 needed` on the job row; there is no -fallback. The stamp is published as `refimage_psf.fits.gz`, and the +sub-pixel resampling kernel leaves the wings unchanged. When the run +names a `reference_psf_set`, any measurement error, fewer than ten stars +or another, falls back to the set's bound row, read as under +`"precomputed"` ({ref}`ruling `). With no +set named, fewer than ten stars stops the job with exit 65 and `refpsf: N +stars, 10 needed` on the job row, and any other error fails it too. The stamp is published as `refimage_psf.fits.gz`, and the manifest's `metrics` hold `refpsf_sigma_px`, `refpsf_stars`, `sci_psf_sigma_px` and `psf_centroid_offset_x_px` and `_y_px` (the reference stamp's centroid minus the science stamp's). On run 17's pass 4 @@ -66,6 +73,18 @@ left 8 and 6 stars of 2,100 and 683 detections and failed every difference, so it is stated in units of the noise (fixes task 5, 400σ: 45 and 19 stars on the resampled references). +Under `"precomputed"` the job reads the bound row of the run's set +({ref}`ruling `): it fetches the +row's `filename`, checks its MD5 against `checksum` and that the stamp is +an odd square the science PSF's size, normalises it, and writes it as +`refimage_psf.fits` with `PSFKIND`, `PSFSET` and `PSFID` saying so. A +missing file or one that fails a check stops the job with exit 65, and so +does a `"measured"` job's fallback that fails them, with the measurement's +error beside its own. The manifest's `refpsf` records the mode, the set, +the row (`psfid`, `filename`, `checksum`) and, under `"measured"` with a +set named, `fallback` and `measure_error`. `"science"` writes the science +PSF for both images, measuring nothing. + **Quality numbers.** Beside those, the manifest's `metrics` carry the measurements that would have shown the null test's detections to be artefacts on its first run, each from arrays the job already holds and @@ -74,8 +93,8 @@ absent, never zero, when it cannot be made: the registration offset PSF's stars, before the subpixel shift), the reference stars' width and its ratio to the science PSF's, the core (within 2.5 pixels) and ring (2.5 to 6) fractions of the difference over star flux at the 30 brightest -isolated stars (under `reference_psf = "science"`, which measures no -reference PSF, the residual, ring and registration stars are the reference +isolated stars (when the job measures no reference PSF, under `"science"`, +`"precomputed"` or a fallback, the residual, ring and registration stars are the reference mosaic's SExtractor catalog mapped onto the science grid, the registration stars the residual stars' rule applied to it), the noise correlation, the usable fraction (finite and covered pixels), the candidates before the cap and the sources after it, @@ -202,13 +221,13 @@ and the reader that earns each: | `awaicgen_output_mosaic_cov_map_resampled.fits.gz` | the mask: the resampled reference coverage map the difference is masked with | | `zogy_diffimage_masked_psfcat[_negative].parquet`, `sfftdiffimage_masked_psfcat[_negative].parquet` | the catalogs, uncapped: SFFT's positive and negative ones are the catalogs `sources` is made from ({ref}`ruling `); the other two (ZOGY's two only when `run_zogy` is true) are diagnostics read by no stage; SFFT's two carry the pixel columns | | `sfftdiffpsf.fits.gz` | the difference's PSF, for forced photometry on the difference | -| `refimage_psf.fits.gz` | the reference PSF the job measured and gave the differencers | +| `refimage_psf.fits.gz` | the reference PSF the job measured, or the science PSF or the set's row it copied, and gave the differencers | | `bkg_subbed_science_image.fits.gz` | forced photometry on the science image, and the science cutout | | `awaicgen_output_mosaic_image_resampled_gainmatched.fits.gz` | the template cutout | The difference, its uncertainty, the mask and the published catalog are the trim's. Three of the others are what `packet` reads, the -reference PSF is the job's own measurement, kept for whoever checks +reference PSF is the one the differencers got, kept for whoever checks the subtraction (15 KB), and the three other catalogs are what a comparison of the differencers reads. @@ -360,7 +379,8 @@ value is new with the port or departs from `dev`: | `[difference.xsources_database_prefilter]` | `sumrat_prefilter_threshold` 0.4, `rb_prefilter_threshold` 0.0, `snr_prefilter_threshold` 5.0 | `dev`'s `[DATABASE_PREFILTER]`, the `xsources`' cuts and the selection of the xsources the PSF fits run on; `""` is no such cut | | `[difference.naive_diffimage] naive_diffimage_flag` | true | the naive subtraction runs, a diagnostic; false skips its image and catalogs, as `dev`'s | | `[difference.fake_sources] inject_fake_sources_flag` | false | fake-source injection is not ported; true is refused | -| `reference_psf` | `"measured"` | the reference PSF the differencers are given: `"measured"`, from the resampled reference's stars, or `"science"`, the science PSF for both images, for a field whose reference stars cannot be measured (the GBTDS bulge, [datasets](datasets)) | +| `reference_psf` | `"measured"` | the reference PSF the differencers are given: `"measured"`, from the resampled reference's stars; `"science"`, the science PSF for both images, for a field whose reference stars cannot be measured (the GBTDS bulge, [datasets](datasets)); or `"precomputed"`, the row of the run's `reference_psf_set`, `dev`'s static reference PSF as an option (flight) ({ref}`ruling `) | +| `reference_psf_set` | `""` | the imported reference PSF set the run reads, by name; `"precomputed"` with none is refused at `run create` ({ref}`ruling `), and under `"measured"` a set named is the fallback ({ref}`ruling `) | | `[difference.statistics] clip_correction_seed` | 0 | seeds the clipped-statistics correction's random draw; negative is `dev`'s unseeded draw | With the seed pinned, the same inputs give the same pixels and rows, diff --git a/system/foundation.md b/system/foundation.md index af0a657..d7ac348 100644 --- a/system/foundation.md +++ b/system/foundation.md @@ -276,8 +276,11 @@ in any key: a run has one differencer, and a second differencer is another run. A PSF's kind is in its key, `science` or `reference` ({ref}`ruling `): the science image's PSF and the reference image's PSF of one filter and SCA are different products, -which the key without the kind merged. `dev`'s `psfs` has no such -column; this is the identity rule applied. +which the key without the kind merged. A reference PSF belongs to an +imported set, and its key carries the set, `{dataset, psf_set, fid, sca, +kind}`, so several sets are official side by side in one dataset +({ref}`ruling `); a science PSF's key +has no set. `dev`'s `psfs` has neither column; this is the identity rule applied. ### Inputs are chosen at launch and recorded @@ -720,9 +723,9 @@ image. Each simplification keeps the shape of the full stage. |---|---|---|---| | `intake` | one L2 file under the run's source root, by the dataset's reader (SOC L2 or OpenUniverse ASDF, RimTimSim lite FITS); the science PSF of its filter and SCA | the gzipped 16-HDU FITS converted as `dev` converts it; `l2files`, and `exposures` when the job expects that key, with limiting magnitude, overlapping fields and sky indices computed | nothing for want of a PSF: every filter's is derived by `psf` | | `import` | stored products for one field: L2 files, difference images with SFFT's PSF-fit and SExtractor catalogs, PSFs, the reference and its mosaic catalog, the Gaia mirror's prefix; the cap on sources per image | copies of the image files (the mirror is named, not copied); `exposures`, `l2files`, `diffimages`, `psfs`, `refimages`, `refimcatalogs`, `catalogs`, `sources` (from both PSF-fit catalogs, the brightest N of each sign by flux over its error, every source at the shipped -1) and `xsources` (from both SExtractor catalogs, as `dev`'s loader reads them; {ref}`ruling `), with limiting magnitude, overlapping fields and sky indices computed; the source system's ids kept; provenance marked unknown | other fields and epochs; recovering provenance | -| `psf` | one L2 file's metadata and the CRDS ePSF reference it names (the dataset's overlay names it for RimTimSim; OpenUniverse's is drawn with galsim.roman) | the science and the reference PSF, one stamp twice; two `psfs` rows | a PSF per position on the detector; a reference PSF of the coadd's own | +| `psf` | one L2 file's metadata and the CRDS ePSF reference it names (the dataset's overlay names it for RimTimSim; OpenUniverse's is drawn with galsim.roman) | the science PSF; one `psfs` row | a PSF per position on the detector | | `reference` | the field's `l2files` rows for one filter and SCA, before the run's reference bound when it has one | the awaicgen mosaic with its coverage and uncertainty maps and SExtractor catalog; `refimages`, `refimimages` (one row per coadded L2 row) and `refimcatalogs` | the Photutils catalog, so the grade's bits from it and the PSF | -| `difference` | one epoch's `l2files` row, a `refimages` row with its mosaic catalog, and the science `psfs` row; the dataset's objects and xobjects of every run in the fields its sources fall in and their neighbours, read at execution and recorded | SFFT's gzipped positive difference image, the only one registered, its uncertainty, the mask, both differencers' uncapped catalogs (ZOGY's unless `run_zogy` is false; SFFT's with `dev`'s sumrat, nneg and nbad) and the files `packet` reads beside the image, naive run only for its outcome bits; `diffimages` and the `sources` set, mapped exactly as the import maps `dev`'s, through the run's `[difference.sources_database_prefilter]`; `xsources`, `dev`'s from both SExtractor catalogs, uncapped; `objects` founded here and this epoch's `memberships`; `xobjects` founded here and this epoch's `xmemberships`, from its `xsources`; the RuBR-AT score of both signs' PSF-fit catalogs and the xsources ({ref}`ruling `) | nothing | +| `difference` | one epoch's `l2files` row, a `refimages` row with its mosaic catalog, the science `psfs` row and, when the run names a reference PSF set, that set's reference `psfs` row; the dataset's objects and xobjects of every run in the fields its sources fall in and their neighbours, read at execution and recorded | SFFT's gzipped positive difference image, the only one registered, its uncertainty, the mask, both differencers' uncapped catalogs (ZOGY's unless `run_zogy` is false; SFFT's with `dev`'s sumrat, nneg and nbad) and the files `packet` reads beside the image, naive run only for its outcome bits; `diffimages` and the `sources` set, mapped exactly as the import maps `dev`'s, through the run's `[difference.sources_database_prefilter]`; `xsources`, `dev`'s from both SExtractor catalogs, uncapped; `objects` founded here and this epoch's `memberships`; `xobjects` founded here and this epoch's `xmemberships`, from its `xsources`; the RuBR-AT score of both signs' PSF-fit catalogs and the xsources ({ref}`ruling `) | nothing | | `packet` | the epoch's source set, the science PSF, the dataset's Gaia mirror, the reference and its mosaic catalog; read at execution and recorded: the triggers' xobjects and official xmembers (objects and members under `[packet] alert_catalog = "sources"`), their exposures, the window's difference and science images, the official `forced` rows and the mirror's leaves and row groups under the chip's cone | `packets/--.avro` at schema 00.07, the `packets.parquet` index, `forced.parquet`, `external.parquet`; as its last act, the set on the Kafka topic | NED, NED-LVS and solar-system matches | | reader, outside the pipeline | a packet set's Avro and its official index and forced rows | a validation report | nothing | @@ -748,14 +751,23 @@ the run's `[difference.sources_database_prefilter]`, and the `xsources` its `[difference.xsources_database_prefilter]`, as the difference job's do ({ref}`ruling `). A row's `filename` is the URL of the copy under the job's prefix; every file is reached through its row. -A PSF's `psf` scope declares its kind; the stage reads the file's -`PSFKIND` (`dev` writes `sciimage_psf` and `refimage_psf`) and fails -before any manifest if it names the other kind. A file with no keyword -imports under the declared kind, and the manifest says so. A PSF's SCA -is its file's `SCA` card, else its `DETECTOR` card (`WFI08` is 8), the -only one commissioning's `phavg` science PSFs carry; flight's science -PSF is that library, imported one file at a time, until CRDS delivers -flight ePSFs (Ben, 2026-11-14 06:58 UTC). +A PSF's `psf` scope declares its kind, and the kind comes from that call +only: one file may be imported as more than one kind, so the file's +`PSFKIND` (`dev` writes `sciimage_psf` and `refimage_psf`) is recorded in +the manifest as it was and never checked +({ref}`ruling `). A single file's SCA is +its `SCA` card, else its `DETECTOR` card (`WFI08` is 8), the only one +commissioning's `phavg` science PSFs carry; flight's science PSF is that +library, imported one file at a time, until CRDS delivers flight ePSFs +(Ben, 2026-11-14 06:58 UTC). A reference PSF set +is imported whole in one job, which `scripts/import_psf_set.py` plans +from the set's directory: each file's filter, and its SCA when the name +has one, come from its name (`refimage_psf_fid[_sca].fits`), a +per-filter file is copied once and gives 18 rows, one per SCA, and the +job's expects are its rows one to one, so the set becomes official in one +change group. A key already bound is skipped unless `--force`, whose +group replaces the old bindings and which `official undo` reverts +({ref}`ruling `). ### intake @@ -770,15 +782,16 @@ so a run that starts from intake owns its data from the first stage. The [psf](psf) page states `psf`: its scope (one file of the filter and SCA it serves), the ePSF reference fetched by the name the file -carries, the fixed reduction to a 61-pixel stamp, the two `psfs` rows -it declares, and the `EPSFREF` keyword the intake checks against each +carries, the fixed reduction to a 61-pixel stamp, the science `psfs` +row it declares, and the `EPSFREF` keyword the intake checks against each file's own reference. An OpenUniverse file names no ePSF reference, so for `[intake] reader = "openuniverse"` the stage draws the stamp with galsim.roman, the simulation's own model ([datasets](datasets)). A RimTimSim file names none either, so for `[intake] reader = "rimtimsim"` the stage reduces the CRDS reference the dataset's `[psf.epsf]` names for the filter. The loop submits one for each filter and SCA that -lacks its PSFs, so a dataset needs no PSF imported. +lacks its science PSF, so a dataset needs no science PSF imported; a +reference PSF set, which a run may name, is always imported. ### reference and difference @@ -786,8 +799,8 @@ The [reference](reference) page states `reference`: its scope (field, filter and SCA), the `l2files` rows it coadds in `dev`'s order, the three tables it declares with the `rfid` it draws, and its settings. The [difference](difference) page states `difference`: its scope (one -epoch's key), its four inputs (the L2 row, a reference, and one PSF of -each kind), SFFT's positive difference image and source set with the +epoch's key), its inputs (the L2 row, a reference, the science PSF and, +when the run names a reference PSF set, that set's reference PSF), SFFT's positive difference image and source set with the `pid` it draws, the files it publishes and why each is kept, and its settings. Only SFFT's image is a row ({ref}`ruling `); ZOGY's PSF-fit catalogs are uploaded as diagnostics, and its images and the naive files are not diff --git a/system/loop.md b/system/loop.md index 1702be3..f2dd3ba 100644 --- a/system/loop.md +++ b/system/loop.md @@ -308,10 +308,10 @@ full. Over the HLWAS simulation that is 23,398 keys instead of 272,160. Its order: 1. **psf**: the pass's new files are grouped by filter and SCA, and a - pair without both an official science and an official reference PSF - gets one [psf](psf) job, named by the pair's first new file, unless a - psf job of the run already serves it. That SCA's files are held from - intake until both rows are official; they still count as new, so the + pair without an official science PSF gets one [psf](psf) job, named + by the pair's first new file, unless a psf job of the run already + serves it. That SCA's files are held from intake until the row is + official; they still count as new, so the pass is not drained while they wait. A selection needs no PSF imported: its first pass derives what is missing. 2. **intake**: one job per listed file the selection admits that no @@ -354,6 +354,12 @@ Its order: at or after it. The difference job associates its own sources with the field's objects as they stand ([difference](difference), Association). + Under `[difference] reference_psf = "precomputed"`, and under + `"measured"` with a `reference_psf_set` named (its fallback), the job + also names the official reference PSF of the run's set for its filter + and SCA; with none official the pass stops and names the missing row, + as for a missing science PSF + ({ref}`ruling `). 5. **packet**: one job per official source set of the selection with no official packet set and no packet job of the run pending or failed, in any order. It names the reference, the run's diff --git a/system/operations.md b/system/operations.md index 890ea6e..e927561 100644 --- a/system/operations.md +++ b/system/operations.md @@ -229,8 +229,9 @@ takes the one current reference in the (field, filter) slot, following Later batches use a new reference promoted mid-stream. Existing difference images retain the earlier reference in their identity key -until reprocessing replaces them. Where the reference PSF is resolved -from remains open. +until reprocessing replaces them. The reference PSF is the difference +job's own measurement or the official row of the imported set the run +names ({ref}`ruling `). ## Staged inputs of a production run @@ -271,4 +272,3 @@ bulk; scratch runs use bulk by default, prompt by request. - The team's choice of alert-history order for a late-arriving earlier epoch: observation time or arrival. - Team approval of `rebuild-production@1` and its `scalefacref` bound. -- Where the reference PSF is resolved from. diff --git a/system/psf.md b/system/psf.md index 559e58d..7460c32 100644 --- a/system/psf.md +++ b/system/psf.md @@ -6,7 +6,8 @@ of a dataset, from the CRDS ePSF reference the dataset's own L2 file names, and declares it as the science PSF. The reference image's PSF is not this stage's: the difference job measures it from the resampled -reference it makes ({ref}`ruling `). +reference it makes ({ref}`ruling `), or +reads an imported set's ({ref}`ruling `). Each image's PSF comes from that reference because it is the calibration's PSF and what flight data will carry ({ref}`ruling `); a simulation's rendering PSF @@ -170,10 +171,12 @@ reference per filter and SCA. wider than that (second-moment width 1.10 pixels against the science image's 0.96 on F146 SCA 8), which left the core-and-ring residual at every star, so the difference job now measures the reference PSF - itself ([difference](difference)). -- **A reference-file part in the `psfs` key.** The key is (dataset, - fid, sca, kind), with no reference name, because the simulation names - one ePSF per filter and SCA. A dataset whose files name two + itself, or reads an imported set's ([difference](difference)). +- **A reference-file part in the science `psfs` key.** The science key is + (dataset, fid, sca, kind), with no reference name, because the + simulation names one ePSF per filter and SCA. A reference PSF's key + carries its set's name instead + ({ref}`ruling `). A dataset whose files name two references for one filter and SCA would see its first intake refused on `EPSFREF`, and that refusal is what would earn the key change. - **The fetch.** Each job fetches the whole 178.6 MB reference for a From 120e91e16630bc57b8c7a7b68ecdbd2d5273ad10 Mon Sep 17 00:00:00 2001 From: Azalee Bostroem Date: Fri, 13 Nov 2026 15:50:43 -0800 Subject: [PATCH 2/2] decisions: a status 0 reference published but not official, the reference job's PSF following reference_psf and a measured one stored, and flight's PSF-fit catalog with sharphi 1.8; reference, foundation, loop, tool and datasets state them (reference-psfcat) Three rulings: a status 0 reference is published, its binding refused and its job failed, for every dataset (Azalee, 2026-11-10), reversing the reference page's "a recorded verdict, not a gate"; the reference job's PSF follows [difference] reference_psf, measured on its own mosaic and stored as 18 reference psfs rows of set refimage-- under "measured" (Azalee, 2026-11-13); the flight overlay turns the catalog on with sharphi 1.8, from the OpenUniverse sharpness distribution (Azalee, 2026-11-10, provenance corrected 2026-11-11). The retry policy for a status 0 reference goes under Open questions. The reference page's inputs, steps, grade (bits 5, 6, 7 and 16 live), status 0 paragraph, outputs (cattype 2, refimmeta.npucatsources filled, the psfs rows, refused and unbound), settings and not-decided items; foundation's publish-last (a stage refusing its own binding, unbound tables) and the thin chain's reference row; loop's reference item and failed paragraph; tool's exit 1 row; the flight overlay's row. For rapid's port/comm-reference-psfcat-v2. Co-Authored-By: Claude Opus 5.5 --- system/datasets.md | 1 + system/decisions.md | 16 +++++++ system/foundation.md | 23 ++++++--- system/loop.md | 22 ++++++++- system/reference.md | 110 ++++++++++++++++++++++++++++++++----------- system/tool.md | 2 +- 6 files changed, 138 insertions(+), 36 deletions(-) diff --git a/system/datasets.md b/system/datasets.md index a9748e0..0e1cf4e 100644 --- a/system/datasets.md +++ b/system/datasets.md @@ -249,6 +249,7 @@ above and their manifest, which the bucket will not let anyone update. | The file names no pixel area map: `meta.ref_file.area` is `INCOMPLETE` on every file checked to 2026-11-20, though CRDS serves an on-orbit one per detector (WFI16's `roman_wfi_area_0085`, pedigree INFLIGHT, useafter 2026-10-13, spanning 0.982 to 1.015) | the overlay: `[pixel_area_map] lookup = true`, so intake asks CRDS for the map's name by detector and exposure start and records it as the `l2files` row's `pixel_area_map`; `store` names the maps' copies ([intake](intake.md#the-pixel-area-maps-name), {ref}`decisions `) | | The per-frame zero point moves with the calibration context: commissioning's files under an older CRDS context run up to 0.29 mag off the rest | the overlay: `[reference.awaicgen] use_nominal_zptmag = true` scales each reference input by its filter's on-orbit `[intake.nominal_zptmag]` value, commissioning 687c93b2's table (the median over the 18 SCAs of the files' own zero points, 7,283 of 8,453 commissioning files; F062 26.04, F087 25.73, F106 25.78, F129 25.77, F146 27.01, F158 25.80, F184 25.34, F213 25.29); `ZPTMAG` and `zptmag_rms` stay the file's ({ref}`decisions `) | | A reference PSF measured from ten stars is not reliable, worst in crowded fields | the overlay: `[difference] reference_psf = "precomputed"` with the 1043 per-filter set, `reference_psf_set = "1043_20260928"`, computed for any orientation ({ref}`ruling `); until the set is imported and official, a loop pass that would plan a difference stops and names the missing row | +| Three of the five fatal reference grades (InfoBits 5, 7 and 16) need the PSF-fit catalog, so without it a poor reference cannot be marked bad | the overlay: `[reference.psfcat] enabled = true`, the catalog made with the 1043 set's row, and `sharphi = "1.8"`, set from the OpenUniverse distribution of sharpness values, where 1.0 cut a significant fraction of it; a reference graded status 0 is published but not made official ({ref}`ruling `) | | At Gaia DR3's epoch 2016.0 the intake's Gaia offset reads (−0.08 to +0.16, −0.56 to −0.35) px, proper motion and not WCS | the overlay: `[intake] gaia_proper_motion = true` carries each star to the frame's mid-exposure; the offset reads dx −0.091 to −0.045, dy −0.060 to −0.038 px; no WCS key | | The program number is real, and one flight dataset holds every program | the overlay: `program_id = ""`, so each file's own `PROGRAM` (1049 here), which must be positive, is its `exposures` row's `program_id` ([intake](intake), Settings) | | The dithers, 0.04 deg apart, put the four centres in three tessellation fields | the loop builds e4's field reference from e1 to e3, every row before the bound whose `overlapfields` list the field, as `dev` ({ref}`decisions `) | diff --git a/system/decisions.md b/system/decisions.md index c5b67c1..8cecc16 100644 --- a/system/decisions.md +++ b/system/decisions.md @@ -34,6 +34,13 @@ A ruling that closes one goes under Rulings and its line leaves. default only on false positives per epoch, 102.7 against 101.7 (rapid PRs 485, 486; Ben accepted that row, its reference differing, {ref}`the SFFT default `). +- **A status 0 reference's retry**: whether a reference graded status 0 + is built again. Today a new run plans it again from the frames it has + then, so with the same frames each run rebuilds the same bad reference + and fails again. The alternatives are never to try again until a person + acts (`official change` to accept it, or a reference from other + inputs), or to try again only when its frames change + ({ref}`a status 0 reference `). - **SMDC's resources the rebuild may not need**: whether the alerts bucket, MSK, the bulk lane, unused parameter leaves and authority records are kept or removed. Open until the rebuild's publication and bulk @@ -69,6 +76,15 @@ A ruling that closes one goes under Rulings and its line leaves. (decision-flight-reference-psf)= **The flight overlay sets `[difference] reference_psf = "science"`; `"measured"` stays the base's default and an option**: with ZOGY and SFFT's cross-convolution off on flight ({ref}`the scope `, {ref}`crossconv `), nothing published reads the reference PSF, and under `"measured"` a field with fewer than ten measurable reference stars would fail its difference with exit 65 ({ref}`ruling `). `"science"` measures nothing and takes the quality metrics' stars from the reference mosaic's catalog, as the GBTDS overlays do. Flight's science PSF is commissioning's `phavg` library until CRDS delivers flight ePSFs, so flight runs on those PSFs wherever a PSF is used. The precomputed reference PSF (port 7A) lands after the cutover, with the reference catalogue (7B), as its storage. To check on the first flight run: the packet gate's bounds were set from measured-star metrics on HLWAS. (Ben, 2026-11-14 07:00 UTC; rapid 497691b7) +(decision-reference-psf-stored)= +**The reference job's PSF follows `[difference] reference_psf`, and under `"measured"` it is measured on the job's own mosaic and stored**: with `[reference.psfcat] enabled` the reference job's PSF-fit catalog uses the same kind of reference PSF as differencing. Under `"precomputed"` it reads the run's set's row and under `"science"` the science row of its filter and scope SCA, and neither writes a `psfs` row. Under `"measured"` it measures the PSF with the difference stage's measurement on its own mosaic, after the mosaic and its SExtractor catalog and before the PSF-fit catalog, with the stamp size, width floor and wings of the official science row of its filter and scope SCA, the CRDS-derived PSF the `psf` stage stored, which the loop binds and the job reads. With no such row official the loop plans a `psf` job for the pair from one of the reference's files and holds the reference until the row is official. Any measurement error falls back to the run's set's row when `reference_psf_set` names one, which the loop then binds too; with none there is no catalog, InfoBit 16 is set and the reference is graded status 0. A measured PSF is stored as the reference PSF of its own set, `refimage--` with the filter in Roman's spelling (`refimage-12345-F158`), one `reference` row for each of the 18 SCAs sharing its one file and checksum, so it never collides with an imported set or another field's reference; the rows bind in the reference's own change group, so a status 0 reference's rows stay unbound with it and a rebuilt reference's rows replace them. A measurement that fell back stores none. The difference stage is unchanged: it measures its own reference PSF on each epoch's resampled reference and does not read these rows. (Azalee, 2026-11-13) + +(decision-reference-status-0)= +**A status 0 reference is published but not official, and its job fails**, for every dataset: a reference whose grade sets a fatal InfoBit (2, 5, 7, 8 or 16) loads its `refimages`, `refimimages`, `refimcatalogs` and `refimmeta` rows and its files, and the stage refuses its own binding, its fatal bits the job's refusal. The job is `published` with the refusal, so the loop lists it under `failed`, holds its field and filter in the run, makes no difference against it and exits 1, the path every refused binding takes. Published, not left unpublished: the grade stays queryable in `refimages`, a person can still accept the reference with `official change` without a rerun, and it matches commissioning's status 0 `RefImages` rows, which its science launcher never uses. A status 0 reference is a verdict on a reference that was built, so it is a failure, not a hold. This reverses the reference page's "a recorded verdict, not a gate". Whether it is built again is open ({ref}`decision-open-questions`). (Azalee, 2026-11-10) + +(decision-reference-psfcat-sharphi)= +**The flight overlay makes the reference's PSF-fit catalog, with `sharphi` 1.8**: it sets `[reference.psfcat] enabled = true`, so its references get the catalog and InfoBits 5, 6, 7 and 16, and `[reference.psfcat] sharphi = "1.8"`, set from the OpenUniverse distribution of DAOStarFinder sharpness values, where 1.0 cut a significant fraction of it. The base keeps `enabled` false and `sharphi` 1.0 for the simulations, as `dev`. (Azalee, 2026-11-10; the sharphi provenance corrected 2026-11-11) + (decision-reference-psf-fallback)= **`"measured"` falls back to the run's reference PSF set on any measurement error, and a PSF's kind comes from the import call only**: with `[difference] reference_psf_set` named, a difference job whose reference PSF measurement raises anything (fewer than ten stars, or any other failure of the measurement) uses the set's bound row exactly as `"precomputed"` does, instead of failing; with no set named there is no fallback and the job fails as before, so the simulations, which name none, are unchanged. The fallback's own checks still apply, and a fallback that fails them fails the job with both errors in its log and reason. The loop binds the set's row to every such difference job, since the job learns only when it runs whether it needs it. Ten stars are too few for a reliable PSF, and a PSF built on the fly may not be reliable, worst in crowded fields. A `psfs` row's kind is the one the import's scope declares: the same file may serve more than one kind, so a `PSFKIND` header keyword is recorded in the manifest as it was and never checked, for both kinds, which retires the import's refusal of a file whose keyword named the other kind. This amends {ref}`the measured reference PSF ` ("there is no fallback"). (Azalee, 2026-11-13) diff --git a/system/foundation.md b/system/foundation.md index d7ac348..ca09a0d 100644 --- a/system/foundation.md +++ b/system/foundation.md @@ -344,13 +344,20 @@ and returns. The publisher then, serialised on the job's row: 2. verifies every declared file against its checksum; 3. loads the attempt's declared rows, and writes the job's state, published attempt and manifest; -4. inside a savepoint, attempts the automatic binding: if the job's run +4. inside a savepoint, attempts the automatic binding: if the stage did + not refuse it, the job's run is live for its survey and dataset, and for each output key the open binding is the one the job's `expects` row named, and each expected product's table loaded at least one row (or the manifest's `empty_ok` names it: a difference's `sources`, a packet set with no triggers), it closes those and opens the job's; otherwise it rolls back to the - savepoint and records the refusal on the job; + savepoint and records the refusal on the job. A stage may refuse its + own binding with the manifest's `refused`, a reason: a reference graded + status 0 does, its fatal bits the reason + ({ref}`ruling `). A stage may also leave + out the expected keys of a table it did not produce this attempt with + the manifest's `unbound`, and the rest bind: a reference whose + measured PSF fell back to a set writes no `psfs` rows; 5. commits, all of the above in one short transaction, and runs nothing after it. Autovacuum keeps the tables' statistics: an `ANALYZE` holds its table's self-conflicting lock to the end of its @@ -361,7 +368,9 @@ and returns. The publisher then, serialised on the job's row: statistics (publish-analyze). A refused job's rows stay published as an unbound candidate, visibly, -and a later change group can bind them. A retry finds its job published +and a later change group can bind them. The job counts as failed: the +loop lists it under `failed` and does not submit its key again in the +run. A retry finds its job published and stops; a retry after a failed attempt writes a new attempt, so a published prefix is never rewritten. @@ -724,7 +733,7 @@ image. Each simplification keeps the shape of the full stage. | `intake` | one L2 file under the run's source root, by the dataset's reader (SOC L2 or OpenUniverse ASDF, RimTimSim lite FITS); the science PSF of its filter and SCA | the gzipped 16-HDU FITS converted as `dev` converts it; `l2files`, and `exposures` when the job expects that key, with limiting magnitude, overlapping fields and sky indices computed | nothing for want of a PSF: every filter's is derived by `psf` | | `import` | stored products for one field: L2 files, difference images with SFFT's PSF-fit and SExtractor catalogs, PSFs, the reference and its mosaic catalog, the Gaia mirror's prefix; the cap on sources per image | copies of the image files (the mirror is named, not copied); `exposures`, `l2files`, `diffimages`, `psfs`, `refimages`, `refimcatalogs`, `catalogs`, `sources` (from both PSF-fit catalogs, the brightest N of each sign by flux over its error, every source at the shipped -1) and `xsources` (from both SExtractor catalogs, as `dev`'s loader reads them; {ref}`ruling `), with limiting magnitude, overlapping fields and sky indices computed; the source system's ids kept; provenance marked unknown | other fields and epochs; recovering provenance | | `psf` | one L2 file's metadata and the CRDS ePSF reference it names (the dataset's overlay names it for RimTimSim; OpenUniverse's is drawn with galsim.roman) | the science PSF; one `psfs` row | a PSF per position on the detector | -| `reference` | the field's `l2files` rows for one filter and SCA, before the run's reference bound when it has one | the awaicgen mosaic with its coverage and uncertainty maps and SExtractor catalog; `refimages`, `refimimages` (one row per coadded L2 row) and `refimcatalogs` | the Photutils catalog, so the grade's bits from it and the PSF | +| `reference` | the field's `l2files` rows for one filter and SCA, before the run's reference bound when it has one; with `[reference.psfcat] enabled`, the `psfs` rows `[difference] reference_psf` calls for at its filter and scope SCA | the awaicgen mosaic with its coverage and uncertainty maps and SExtractor catalog; `refimages`, `refimimages` (one row per coadded L2 row) and `refimcatalogs`; with the catalog on, the Photutils PSF-fit catalog (`cattype` 2) and, under `"measured"`, the measured PSF's 18 `psfs` rows of set `refimage--`; a status 0 reference refuses its own binding | the Photutils catalog in the base settings, so there the grade's bits from it and the PSF | | `difference` | one epoch's `l2files` row, a `refimages` row with its mosaic catalog, the science `psfs` row and, when the run names a reference PSF set, that set's reference `psfs` row; the dataset's objects and xobjects of every run in the fields its sources fall in and their neighbours, read at execution and recorded | SFFT's gzipped positive difference image, the only one registered, its uncertainty, the mask, both differencers' uncapped catalogs (ZOGY's unless `run_zogy` is false; SFFT's with `dev`'s sumrat, nneg and nbad) and the files `packet` reads beside the image, naive run only for its outcome bits; `diffimages` and the `sources` set, mapped exactly as the import maps `dev`'s, through the run's `[difference.sources_database_prefilter]`; `xsources`, `dev`'s from both SExtractor catalogs, uncapped; `objects` founded here and this epoch's `memberships`; `xobjects` founded here and this epoch's `xmemberships`, from its `xsources`; the RuBR-AT score of both signs' PSF-fit catalogs and the xsources ({ref}`ruling `) | nothing | | `packet` | the epoch's source set, the science PSF, the dataset's Gaia mirror, the reference and its mosaic catalog; read at execution and recorded: the triggers' xobjects and official xmembers (objects and members under `[packet] alert_catalog = "sources"`), their exposures, the window's difference and science images, the official `forced` rows and the mirror's leaves and row groups under the chip's cone | `packets/--.avro` at schema 00.07, the `packets.parquet` index, `forced.parquet`, `external.parquet`; as its last act, the set on the Kafka topic | NED, NED-LVS and solar-system matches | | reader, outside the pipeline | a packet set's Avro and its official index and forced rows | a validation report | nothing | @@ -796,8 +805,10 @@ reference PSF set, which a run may name, is always imported. ### reference and difference The [reference](reference) page states `reference`: its scope (field, -filter and SCA), the `l2files` rows it coadds in `dev`'s order, the -three tables it declares with the `rfid` it draws, and its settings. +filter and SCA), the `l2files` rows it coadds in `dev`'s order, the PSF +its Photutils catalog uses when the run turns the catalog on, the tables +it declares with the `rfid` it draws, its grade, a status 0 reference +published but not made official, and its settings. The [difference](difference) page states `difference`: its scope (one epoch's key), its inputs (the L2 row, a reference, the science PSF and, when the run names a reference PSF set, that set's reference PSF), SFFT's positive difference image and source set with the diff --git a/system/loop.md b/system/loop.md index f2dd3ba..7dbc031 100644 --- a/system/loop.md +++ b/system/loop.md @@ -346,6 +346,18 @@ Its order: fraction of pixels at `min_coverage_depth` falls below `min_coverage_fraction` less `coverage_estimate_tolerance` gets no job and is held ([The reference bound](#the-reference-bound)). + With `[reference.psfcat] enabled` the job also names the PSF rows its + catalog needs at its filter and scope SCA, as `[difference] + reference_psf` says: the science row under `"measured"` and + `"science"`, the run's set's row under `"precomputed"` and under + `"measured"` with a set named. A missing set row stops the pass and + names it, as for a difference. A missing science row gets one psf job + for the pair, named by one of the reference's files unless a psf job of + the run already serves it, and the reference waits under `held` until + the row is official. Under `"measured"` the job also expects the 18 + `psfs` keys of its own set, `refimage--`, each naming + the binding it replaces, so its measured PSF binds with it + ({ref}`ruling `). With a reference bound set, the rules change as described under [The reference bound](#the-reference-bound). 4. **difference**: one job per official L2 row whose field has an @@ -402,7 +414,15 @@ the host or `job submit --job ` on Batch, and the loop then carries on from it. `job submit --job` marks a failed row `launched` as it records the new Batch id, so a loop restarted at once counts it pending. A failed job holds only the work that depends on it: the loop -keeps passing until the rest of the selection drains around it. A +keeps passing until the rest of the selection drains around it. A job +published with its binding refused counts as failed the same way. A +reference graded status 0 is one: its rows are published, its binding +refused with its fatal bits as the reason, so it is listed under +`failed`, holds its field and filter for the run, gets no difference, +and makes the verb exit 1 once the rest drains +({ref}`ruling `). A new run plans it again +from the frames it has then; whether it should is open +({ref}`decision-open-questions`). A job whose Batch request itself raises (throttled, a queue that does not exist) is marked `failed` with that error in its `refusal`, never left `launched` with nothing on Batch, and the error ends the verb (75 when diff --git a/system/reference.md b/system/reference.md index d547dce..5a112b8 100644 --- a/system/reference.md +++ b/system/reference.md @@ -3,8 +3,9 @@ **Status: current** `reference` coadds the L2 images its job names into one reference image -for a field, filter and SCA, catalogs the mosaic with SExtractor, and -declares three tables for the publisher. It runs `dev`'s reference +for a field, filter and SCA, catalogs the mosaic with SExtractor and, +when the run turns it on, with Photutils, and declares its tables for the +publisher. It runs `dev`'s reference pipeline (`ppid` 12, `pipeline/referenceImageSubs.py`) in `dev`'s order under the foundation's `run(job)` contract: `rapidpipe/stages/reference.py` and `rapidpipe/science/reference/` on the pipeline repository's @@ -15,12 +16,18 @@ stage is. ## Scope and inputs The scope is `{"field", "fid", "sca"}`: the Roman tessellation tile, -the filter id and the first SCA among the frames. Every input is an -`input` row of product `l2files` whose key has the scope's filter, of -any SCA, each row read by its own key's SCA; any other product or -filter fails the job. The launcher chooses the frames and records them; the -stage reads exactly those rows and their files through -`prefix.get`, and never selects frames itself. +the filter id and the first SCA among the frames. The frames are `input` +rows of product `l2files` whose key has the scope's filter, of any SCA, +each row read by its own key's SCA. With `[reference.psfcat] enabled` the +job also names the `psfs` rows of its filter and scope SCA that +`[difference] reference_psf` calls for: the science row under +`"measured"` and `"science"`, the run's set's reference row under +`"precomputed"`, and both under `"measured"` with a `reference_psf_set` +named, the set's row being the measurement's fallback. Any other product, +filter or SCA, or a PSF the settings do not call for, fails the job. The +launcher chooses the frames and the rows and records them; the stage reads +exactly those rows and their files through `prefix.get`, and never +selects frames itself. Frames are coadded in order of `mjdobs`. Fewer than `min_frames` fails the job; frames past `max_frames` are left out and named in the @@ -65,15 +72,41 @@ Each step is a module of `rapidpipe.science.reference`: ({ref}`ruling `), and gives the catalog's FWHM statistics: the mode over point sources and the `fwhm_percentile` percentile of the same sample. -5. **The grade**: `dev`'s reference InfoBits and status (`dev` cb53d2c7, +5. **The reference PSF and the PSF-fit catalog**, with + `[reference.psfcat] enabled` only. The PSF follows `[difference] + reference_psf`, so the catalog uses the same kind of reference PSF as + differencing ({ref}`ruling `). + `"precomputed"` takes the set's row, its MD5 checked against the row, + its stamp an odd square with a positive sum; a per-filter set is + computed for any orientation, so it fits awaicgen's north-up mosaic. + `"science"` takes the science row. `"measured"` measures the PSF on the + mosaic's covered pixels with the difference stage's measurement, the + science row giving the stamp's size, the floor of a star's width and + the wings; any measurement error falls back to the set's row when the + run names one, and otherwise leaves no PSF and so no catalog. The + science PSF is in the detector frame and the mosaic north up, and it is + not rotated: under `"measured"` its width floor does not depend on the + roll, but its wings do, and under `"science"` the whole stamp does. A + set file that fails its checks, or a fallback that does, fails the job + with exit 65. The catalog is `dev`'s Photutils PSF-fit catalog, the + difference stage's catalog code run on the mosaic with its uncertainty + map under `[reference.psfcat]`: a text catalog, its finder catalog, the + joined Parquet and the fit's residual. With the PSF the stage also + computes the two limiting magnitudes at `maglim_snr` on the mosaic's + zero point, one from the median `flux_err` of the catalog's sources and + one from the mosaic's clipped background noise and the PSF's noise + pixels. +6. **The grade**: `dev`'s reference InfoBits and status (`dev` cb53d2c7, fdc7fa79), the bits defined in `cdf/infobitsref.txt` and their thresholds in `[reference.infobits]`. A bit is set when its condition holds; a metric that could not be computed sets none. Status is 0 - when a fatal bit (2, 5, 7, 8, 16) is set, else 1. The bits of the - Photutils catalog and the PSF (5, 6, 7, 16) are never set, because - this build makes neither: a catalog not attempted is not one that - failed. -6. **The header stamp** on the mosaic and its uncertainty map: `dev`'s + when a fatal bit (2, 5, 7, 8, 16) is set, else 1. With the catalog + attempted, its bits are live: 5 and 6 the two limiting magnitudes, 7 + its source count, which is 0 when it was not made, and 16 a catalog not + made, because there was no PSF or no source survived its finder. With + `[reference.psfcat] enabled` false the four bits are never set: a + catalog not attempted is not one that failed. +7. **The header stamp** on the mosaic and its uncertainty map: `dev`'s `BUNIT`, `FIELD`, `FILTER`, `COV5PERC`, `NFRAMES`, `JDSTART`, `JDEND`, `MAGZP`, `TOTEXPTM`, `INFOBITS` (its comment listing the set bits), `STATUS`, the `BIT`*nn* definitions in use and one @@ -104,25 +137,40 @@ job fails when awaicgen or SExtractor leaves no output, or when the catalog has no source with a usable FWHM, where `dev` checks no exit code. -A status-0 reference is published and differenced against. `dev`'s -science pipeline differences against the reference it has just built, -whatever its status, and never reuses a status-0 reference -(`get_best_reference_image` selects `status > 0`); the loop builds a -field's reference once, so here the status is a recorded verdict, not a -gate. +A status 0 reference is published with its grade but not made +official: its rows load, the stage refuses its own binding, and the job +fails with its fatal bits as the reason. No difference is made against +it, as `dev` and commissioning never use a status 0 reference +(`get_best_reference_image` selects `status > 0`). A person may still +accept it with `official change`, without a rerun +({ref}`ruling `). Whether a later run +builds it again is open; today a new run plans it again from the frames +it has then ({ref}`decision-open-questions`). ## Declared outputs The files go under `ref/` in the attempt's prefix: the mosaic, its coverage and uncertainty maps under awaicgen's names, and the -SExtractor catalog. The manifest declares four tables: +SExtractor catalog. With the PSF-fit catalog on, they also hold the PSF +the catalog used, `refimage_psf.fits`, and the catalog's +`refimage_psfcat.txt`, `refimage_psfcat_finder.txt`, +`refimage_psfcat.parquet` and `refimage_psfcat_residual.fits`. The +manifest declares these tables: | Table | Rows | |---|---| | `refimages` | one, keyed (dataset, field, fid); `nframes`, `cov5percent`, the grade's `status` and `infobits`, and the stamped mosaic's MD5 | | `refimimages` | one per coadded L2 row, (`rfid`, `rid`) | -| `refimcatalogs` | one, the mosaic catalog, `cattype` 1, which `packet` reads for reference-star matches | -| `refimmeta` | one, keyed by `rfid`: `dev`'s quality measurements under `dev`'s names, `hp6` and `hp9` of the reference's centre, `mjdobsmin` and `mjdobsmax` of the coadded frames, the mosaic's statistics, the catalog's FWHM and source count; `npucatsources` null, since no Photutils catalog of the reference is made ({ref}`ruling `) | +| `refimcatalogs` | the mosaic catalog, `cattype` 1, which `packet` reads for reference-star matches; and the PSF-fit catalog, `cattype` 2, when it was made | +| `refimmeta` | one, keyed by `rfid`: `dev`'s quality measurements under `dev`'s names, `hp6` and `hp9` of the reference's centre, `mjdobsmin` and `mjdobsmax` of the coadded frames, the mosaic's statistics, the catalog's FWHM and source count; `npucatsources` the PSF-fit catalog's source count, 0 when it could not be made and null with the catalog off ({ref}`ruling `) | +| `psfs` | under `"measured"`, when the measurement succeeded: 18 `reference` rows, one per SCA, sharing `refimage_psf.fits` and its MD5, with `psf_set` `refimage--` in Roman's filter spelling ({ref}`ruling `) | + +The `psfs` rows bind with the reference in one change group. The loop +expects their 18 keys of every `"measured"` reference, so a measurement +that fell back to the set writes none and the manifest's `unbound` +leaves those keys out of the binding. A status 0 reference's manifest +carries `refused` with its fatal bits, and its whole binding, `psfs` keys +included, is refused. The stage draws `rfid` from the `refimages` identity sequence while it reads its inputs, so the child rows carry it before publication. An @@ -131,7 +179,11 @@ value, and no `refimmeta` row. The manifest also records `dev`'s `refimmeta` mea JD range, the total exposure time, the zero point and `zptmag_source` (`header` or `nominal`, as `ZPSOURCE`), and under coverage selection `coverage`: the selected and skipped `rid`s, the estimate, its -decision and the measured fraction. +decision and the measured fraction. With the catalog on it also records +the catalog's source count, `npsfcatsources`, its `psfcat_flag`, and the +reference PSF's record `refpsf`: the mode, the set and row it read, and +under `"measured"` the stars it was built from, whether it fell back and +the measurement's error. ## Settings @@ -146,7 +198,7 @@ holds one subtable per `dev` ini section, with `dev`'s values: | `[reference.awaicgen]` | every awaicgen option `dev`'s launcher passes, the output names, and `zprefimg_` per filter with the scalar `zprefimg` 17.0 as fallback; `use_nominal_zptmag` false, commissioning's flag (8a4a172d): true scales each input by its filter's `[intake.nominal_zptmag]` value instead of its own `ZPTMAG` ([datasets](datasets): true in `flight.toml`); a run body stored before the flag has none and scales by `ZPTMAG` | | `[reference.sextractor_refimage]` | `dev`'s `SEXTRACTOR_REFIMAGE` section verbatim; its `sextractor_mag_zeropoint` 0.0 is replaced in the job's copy by `MAGZP` at run time ({ref}`ruling `) | | `[reference.paths]` | the repository and tool configuration paths of the pipeline image, the tools on `PATH`, and `work_subdirectory` `ref` | -| `[reference.psfcat]` | `enabled` false: `dev`'s Photutils reference catalog needs a reference PSF input and is not produced; true is refused | +| `[reference.psfcat]` | `enabled` false in the base, so the simulations' references are unchanged; true makes the PSF-fit catalog with the PSF `[difference] reference_psf` chooses. The finder's values are `dev`'s `PSFCAT_REFIMAGE`, `min_separation` 1.5 as the difference stage's; the flight overlay turns it on with `sharphi` 1.8 ({ref}`ruling `) | | `[reference.fake_sources]` | `inject_fake_sources_flag` false; fake-source injection is not ported, and true is refused | | `[reference.infobits]` | `dev`'s `REFIMAGE_INFOBITS` thresholds `t00` to `t10` (provisional, "loose enough that a normal reference image raises no bit"), `fwhm_percentile` 90, `maglim_snr` 5, `fatalinfobits` 2, 5, 7, 8, 16 | | `[reference.statistics]` | `clip_correction_seed` 0, pinned as the difference stage's so the same frames give the same catalog; a negative value reproduces `dev`'s unseeded draw for the clipped-statistics correction | @@ -192,8 +244,10 @@ all-source median under `fwhmmedpix`, status 1 and infobits 0. - When a reference is rebuilt. The loop never rebuilds a published one, and a reference job that failed, a coadd short of its coverage among them, holds its field's key until a person reruns it. -- The Photutils reference catalog, and where its PSF would come from. - `dev`'s reference pipeline makes one from a per-filter reference PSF - file; without it the grade's bits 5, 6, 7 and 16 stay unset. +- Whether a status 0 reference is built again, and when + ({ref}`decision-open-questions`). +- A reference PSF for a mosaic at a fixed position angle (a GBTDS + reference with a per-SCA set at that angle): the `psfs` rows per set, + filter and SCA allow it, but no overlay or set builds one. - The imported reference has no `refimimages` rows, since the source system's rows do not name its members. diff --git a/system/tool.md b/system/tool.md index 0692d69..628fdd9 100644 --- a/system/tool.md +++ b/system/tool.md @@ -54,7 +54,7 @@ the [stage contract](stage-contract) page lists what `job run` returns. | Code | Meaning | |---|---| | 0 | Success; also a job published under a run that is not live, the refusal on its row and on standard error | -| 1 | A refused change group or a job published with its binding refused; `job wait` when a job failed; `loop`, `--once` included, when a job of the run failed or was published with its binding refused | +| 1 | A refused change group or a job published with its binding refused; `job wait` when a job failed; `loop`, `--once` included, when a job of the run failed or was published with its binding refused (a status 0 reference among them) | | 2 | `job wait`'s `--timeout` passed first | | 64 | Usage: every argparse parse failure (help exits 0), a missing run, job or group (the foundation's `NotFound`, no other lookup error), an unreadable file, `RAPIDPIPE_OUTPUTS_ROOT` unset, a database configuration error, and `loop` when its first pass finds no stem of the selection under the source root | | 65 | A declared input rejected by the stage reading it: difference, reference or import (`CommandExit: ` on the row) |