Repository navigation
Reject ngmix epochs only when a defect touches the object's own footprint (D0) - #983
Draft
cailmdaley wants to merge 2 commits into
Draft
cailmdaley wants to merge 2 commits into
cailmdaley wants to merge 2 commits into
Conversation
This was referenced Oct 29, 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.
Reject an epoch when a raw defect pixel touches the object's own ISO footprint (
SEG_VIGNET == NUMBER), without dilation.This removes the fixed 7/13-px central veto and its constants, with no configuration flag or radius fallback.
Both interpolated and noise-filled defects count, including unflagged zero-weight pixels, invalid background RMS and off-tile pixels; neighbours and clean symmetry copies do not.
The 10% masked-fraction cut runs first.
Cail decided to remove the fixed veto (25 Oct). D0 is the replacement this PR proposes, chosen from a catalogue-level bias/loss scan of five rules.
The scan combines modeled fixture biases with measured prevalence and multi-epoch dilution on tile 188.307.
These are nominal, unweighted, one-tile estimates, not a survey calibration or a guarantee for every retained defect.
The catalogue limits are 1×10⁻² for m and 5×10⁻⁴ for c.
Every nominal value passes by more than 10×; the keep-everything arm's conservative fixture envelope crosses the additive limit.
What to weigh. The margin is wide at nominal values and narrow under stress. With the unrestricted-size stress fixtures (open diamonds), D0's multiplicative bias reaches about 0.9 of the requirement, whereas the fixed veto (A) stays near 0.01 of it. D0's margin therefore rests on the size-matched fixtures being representative. The trade is about one percentage point of epochs (1.6% lost against 2.2%) for a much thinner worst case. Flag-only (B) is ruled out: its size-matched envelope already crosses the additive limit.
Edge cases and diagnostic contract
A border-touching footprint is tested within the stamp, the same domain used for the fit.
A missing or empty footprint rejects the epoch because overlap cannot be established; an absent object label is an upstream inconsistency, not clean data.
A shape mismatch raises; uberseg also requires the
SEG_VIGNETcolumn before the object loop.These policies need no fixed radius.
The epoch-cut counter is
footprint_defectthroughout ngmix logs, workflow parsing, manifests, aggregation, completeness checks and cleaning.The durable aggregate schema is 2; schema-1 records fail completeness rather than having their counts relabelled.
Affected chunks/manifests need regeneration.
The ASTRA decision, its code markers and the committed universe pin select
shape_measurement.footprint_defect_veto: d0.The #973 defect records and final-catalogue columns stay available.
Complete kept footprints have zero ISO defect hits under D0; clipped footprints retain the
-1unknown sentinel, and never-fit rows retain zero counts.Stamp-wide interpolation counts and minimum defect distances still support stricter downstream cuts.
The fill/weighting shear-recovery fixtures test their stated geometries independently of epoch selection.
Footprint-based selection still needs shear-selection calibration.
188.307 production check
Validation uses the retained survey catalogue, flags, weights, RMS, images, backgrounds, PSFs and WCS stores, with
blend_handling=uberseganddefect_fill=interpolate.It invokes the real
prepare_postage_stampspath without fitting galaxies or modifying input stores.D0 rejects 1,791/115,299 eligible epochs (1.553%) and retains 113,508.
The 120,421 considered epochs and 5,122 masked-fraction rejections match the survey census.
There are zero mismatches with the survey's cached raw-footprint overlap decisions.
D0 rejects 316 eligible border epochs.
The survey's D0 row uses a fixed-radius fallback for clipped footprints and rejects 1,550/115,299 (1.344%).
The production border policy rejects 246 epochs that fallback keeps and keeps 5 it rejects: 251 changed decisions, all at the border, and 241 net extra rejections. The survey's in-stamp sensitivity run (
optimistic_unknown_footprints.D0in the survey'scombined.json) applies the same border policy as production. It rejects the same 1,791 epochs, loses 50 objects (against 15 with the fallback), and gives nominal max |m| ≈ 1.4×10⁻⁵ and max |c| ≈ 5.2×10⁻⁶ within the same transport model.Thus the table's 1.3% and the production 1.553% use different border policies, not different defect definitions.
The fixed-radius arm loses 2,565/115,299 (2.225%).
The eligible denominator is
113,749 kept + 1,550 rejected = 115,299; 113,749 alone is the survey D0 kept count.The reproducible census is committed as
scripts/validation/masked_pixels/d0_prevalence_188307.json; the full output and per-epoch comparison arrays are/scratch/cdaley/veto-d0/188.307.{json,npz}.Reproduction and test receipts
All tests and measurements run in Slurm allocation
25321432, accountdef-waerbeke, 4 CPUs, 16 GiB, nodec647, using/project/6001537/cdaley/containers/shapepipe-develop-240b37e4.sif.From
/scratch/cdaley/wt-veto-d0, withPYTHONPATH=$PWD/src:$PWD:/scratch/cdaley/veto-d0/run-sif.shruns the census with the allocation, SIF, paths and single-threaded BLAS settings.run-local-sif.shruns the suites with the same environment and node-local/tmpfor temporary files.Workflow tests use Snakemake 9.23.1 from
/project/6001537/cdaley/snakemake-env/lib/python3.12/site-packages, appended toPYTHONPATH, withPYTEST_DISABLE_PLUGIN_AUTOLOAD=1.SHAPEPIPE_ON_CANDIDE=1is scoped to the workflow suite so both profile fixtures execute; the generic off-Candide guard otherwise skips the fixture namedcandideeven though it only parses configuration.SHAPEPIPE_ON_CANDIDE=1 PYTEST_DISABLE_PLUGIN_AUTOLOAD=1 \ python -m pytest tests/workflow -o addopts='' -q -rsThe checked-in radius mutant runs only against a private source copy.
It is killed by 9 failing tests (11 pass, 39 deselected), including a close defect outside the footprint, a distant footprint hit, border hits, unavailable footprints and off-tile overlap.
These are assertion failures, not collection failures.
At the pushed head, the full not-slow suite passes 1,160 tests, with 4 skips and 2 slow deselections (229.84 s).
At the same head, the workflow suite passes 50 tests, with no skips, under Snakemake 9.23.1 (19.13 s).
The focused footprint/fill/counter/decision run passes 156 tests.
Logs are
not-slow-clean.log,targeted.log,workflow-final.log,mutant-final.log,prevalence-final.log,decisions-final.logandastra-validation.logunder/scratch/cdaley/veto-d0/.ASTRA Tools 0.2.17 validates both
astra.yamlanduniverses/committed.yaml.Claude (Opus 5.5) on behalf of Cail; implemented by GPT-6.1 Sol.
🤖 Generated with Claude Code
https://claude.ai/code/session_01JK7o9Hh6QZraQK3Vr2diyz