Skip to content

feat(psf): opt-in colour purification of PSF training stars - #1013

Open
cailmdaley wants to merge 3 commits into
developfrom
feat/psf-star-purification
Open

cailmdaley wants to merge 3 commits into
developfrom
feat/psf-star-purification

Conversation

@cailmdaley

Copy link
Copy Markdown
Contributor

Gemini 4 Neon on behalf of Cail.

Add an opt-in colour-purification step for PSF training stars before PSFEx (star_colour_runner, enabled via inputs.star_colours), while keeping the PSFEx model achromatic and the default unset path bit-identical to run 1.

Related: #792, #950.

Measured effect

External colour purification (a Gaia-seeded stellar locus with unWISE W1 and dereddened PhotoPipe GAaP g−i) flags 3–4% of run-1 PSF stars across the survey as contaminants (5% of training stars in the 80-exposure test set), on average 1.9% larger than the PSF model.

We tested four PSFEx configurations on 80 exposures stratified by seeing (20 per quartile, 0.51–0.94″; 31,082 clean reserve stars, 4,273 in the galaxy-colour window 0.8 < g−i < 1.4), with exposure-bootstrap errors:

  • Purification shifts the reserve size residual (T★ − T_model) / T_model at galaxy colours by +0.08% (+0.07 to +0.10% in every seeing quartile, moving the overall residual from −0.02 ± 0.04% to +0.05 ± 0.04%).
  • A linear g−i term in PSFEx was tested and dropped. The r-band chromatic size trend is flat near +0.3% below g−i ≈ 1 and falls steeply above 1.5 (to −1.5% at 2.9). A per-CCD linear fit (PSFVAR_GROUPS 1,1,2, PSFVAR_DEGREES 2,1, 12 terms) follows the many red stars and over-corrects at galaxy colours (−0.02% → −0.27% purified, −0.35% unpurified), while raising reserve dT/T scatter (2.02% → 2.18%) and ellipticity residual RMS (0.0088 → 0.0093).
  • The achromatic production model is unbiased at galaxy colours on average (−0.02 ± 0.04%). The remaining galaxy-colour error is a seeing trend (−0.24 ± 0.05% at 0.51–0.64″ to +0.13 ± 0.07% at 0.82–0.94″).
Reserve (T★ − T_model) / T_model at 0.8 < g−i < 1.4 [%] Production + g−i term Purified (this PR) Purified + g−i
All (4,273 stars) −0.02 ± 0.04 −0.35 ± 0.04 +0.05 ± 0.04 −0.27 ± 0.04
0.51–0.64″ −0.24 ± 0.05 −0.63 ± 0.06 −0.13 ± 0.05 −0.49 ± 0.07
0.65–0.72″ −0.05 ± 0.06 −0.41 ± 0.06 +0.02 ± 0.06 −0.32 ± 0.05
0.73–0.81″ +0.04 ± 0.06 −0.28 ± 0.08 +0.12 ± 0.06 −0.19 ± 0.07
0.82–0.94″ +0.13 ± 0.07 −0.13 ± 0.07 +0.18 ± 0.07 −0.11 ± 0.08

Reserve star size residual against g−i for four PSFEx variants, and the colour term's change to galaxy PSF size by seeing

Reserve star size residual at galaxy colours (0.8 < g−i < 1.4) by seeing quartile across the four variants

Changes

  • src/shapepipe/modules/star_colour_package/star_colour.py, src/shapepipe/modules/star_colour_runner.py: match training and reserve PSF stars within MATCH_RADIUS (0.5″) to an external FITS table (RA, DEC, GI, REMOVE), drop flagged training stars while keeping the 20% reserve whole, and attach GI_COLOR (filled with the CCD's kept-training median where missing). When COLOUR_CATALOGUE is empty, pass both splits through unchanged (checked on exposure 2116301: all 40 PSFEx models bit-identical to run 1).
  • src/shapepipe/modules/psfex_interp_package/psfex_interp.py, src/shapepipe/modules/psfex_interp_runner.py: generalize PSFEx polynomial evaluation to N-D contexts (psfex_monomials) and add DEFAULT_COLOUR (1.1) for objects without a colour column when evaluating a colour-dependent model.
  • workflow/Snakefile, workflow/config.yaml, workflow/config/cfis/config_exp_psfex.ini, workflow/config/cfis/config_tile_PiViVi_psfex.ini, workflow/scripts/completeness.py, workflow/scripts/persist_exp.py: expose optional inputs.star_colours as SP_STAR_COLOURS, wire star_colour_runner between setools_runner and psfex_runner, and scope persist_exp's star_train/star_test globs to rand_split/ to avoid colliding with the rewritten splits.
  • tests/unit/test_persist_exp_props.py, astra.yaml, universes/committed.yaml: update the persist property test for path-scoped globs and record psf_colour_purification and the colour-term test result. Unit tests pass (656 passed, 1 skipped).

Note: each CCD process currently loads the full COLOUR_CATALOGUE FITS table into memory, so a survey-wide production run will need a footprint-sliced or per-exposure table once the full-footprint purity table is built.

The r-band PSF is chromatic: at fixed magnitude, star size falls by 0.69% per
magnitude of g-i, and the achromatic per-CCD PSFEx model cannot follow it. This
fits PSFEx linear in g-i (PSFVAR_KEYS XWIN_IMAGE,YWIN_IMAGE,GI_COLOR; groups
1,1,2; degrees 2,1; 12 terms), the form DES Y6 fits with Piff.

- star_colour_runner (new, between setools and psfex): matches each PSF star
  to an external per-object catalogue ($SP_STAR_COLOURS: RA, DEC, GI, REMOVE)
  within 0.5", drops training stars the purity verdict rejects, and adds
  GI_COLOR to the training and reserve splits (CCD median where no colour).
  The reserve is kept whole so it stays comparable with an achromatic run.
- psfex_interp: the coefficient build enumerates PSFEx's terms for any
  context (psfex_monomials), so it reads 2-D and 3-D models alike. Objects are
  evaluated at their GI_COLOR when the catalogue has one (reserve stars), else
  at DEFAULT_COLOUR (galaxies; 1.1, DES Y6's median galaxy colour).
- astra.yaml: psf_model_complexity selects the colour model;
  new decision psf_colour_purification.
On 80 exposures stratified in seeing, the per-CCD g-i term over-corrects the
colour slope (-0.69 to +0.08 %/mag), leaves the model 0.38% too large at
g-i = 1.1, and raises reserve ellipticity residual scatter by 6%. Colour
purification of the training stars alone moves the reserve residual at
g-i = 1.1 from -0.13% to -0.05%. This keeps star_colour_runner and the N-D
psfex_interp context, and restores the 2-D default.psfex.
…star splits

- inputs.star_colours (run config) is exported as SP_STAR_COLOURS by every
  unit prologue; apptainer's --cleanenv kept a caller's variable from
  reaching the jobs. Unset, star_colour_runner passes the star splits
  through unchanged (checked on one exposure: all 40 PSFEx models
  bit-identical to run 1's).
- star_train/star_test persist globs name setools' rand_split copies:
  star_colour_runner rewrites the splits under the same names, which
  collided in the flat tar. The property test matches member names against
  the glob's filename part and sources against the whole glob.

This branch has not been deployed

No deployments
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