Repository navigation
feat(psf): opt-in colour purification of PSF training stars - #1013
Open
cailmdaley wants to merge 3 commits into
Open
cailmdaley wants to merge 3 commits into
cailmdaley wants to merge 3 commits into
Conversation
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.
cailmdaley
added a commit
that referenced
this pull request
Nov 24, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Gemini 4 Neon on behalf of Cail.
Add an opt-in colour-purification step for PSF training stars before PSFEx (
star_colour_runner, enabled viainputs.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 window0.8 < g−i < 1.4), with exposure-bootstrap errors:(T★ − T_model) / T_modelat galaxy colours by+0.08%(+0.07to+0.10%in every seeing quartile, moving the overall residual from−0.02 ± 0.04%to+0.05 ± 0.04%).g−iterm in PSFEx was tested and dropped. The r-band chromatic size trend is flat near+0.3%belowg−i ≈ 1and falls steeply above1.5(to−1.5%at2.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 reservedT/Tscatter (2.02%→2.18%) and ellipticity residual RMS (0.0088→0.0093).−0.02 ± 0.04%). The remaining galaxy-colour error is a seeing trend (−0.24 ± 0.05%at0.51–0.64″to+0.13 ± 0.07%at0.82–0.94″).(T★ − T_model) / T_modelat0.8 < g−i < 1.4[%]g−itermg−i−0.02 ± 0.04−0.35 ± 0.04+0.05 ± 0.04−0.27 ± 0.040.51–0.64″−0.24 ± 0.05−0.63 ± 0.06−0.13 ± 0.05−0.49 ± 0.070.65–0.72″−0.05 ± 0.06−0.41 ± 0.06+0.02 ± 0.06−0.32 ± 0.050.73–0.81″+0.04 ± 0.06−0.28 ± 0.08+0.12 ± 0.06−0.19 ± 0.070.82–0.94″+0.13 ± 0.07−0.13 ± 0.07+0.18 ± 0.07−0.11 ± 0.08Changes
src/shapepipe/modules/star_colour_package/star_colour.py,src/shapepipe/modules/star_colour_runner.py: match training and reserve PSF stars withinMATCH_RADIUS(0.5″) to an external FITS table (RA,DEC,GI,REMOVE), drop flagged training stars while keeping the 20% reserve whole, and attachGI_COLOR(filled with the CCD's kept-training median where missing). WhenCOLOUR_CATALOGUEis empty, pass both splits through unchanged (checked on exposure2116301: 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 addDEFAULT_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 optionalinputs.star_coloursasSP_STAR_COLOURS, wirestar_colour_runnerbetweensetools_runnerandpsfex_runner, and scopepersist_exp'sstar_train/star_testglobs torand_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 recordpsf_colour_purificationand the colour-term test result. Unit tests pass (656 passed, 1 skipped).Note: each CCD process currently loads the full
COLOUR_CATALOGUEFITS 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.