Repository navigation
Line neighbour masks up with each exposure's own pixels - #985
Open
cailmdaley wants to merge 1 commit into
Open
cailmdaley wants to merge 1 commit into
cailmdaley wants to merge 1 commit into
Conversation
cailmdaley
added a commit
to cailmdaley/shapepipe
that referenced
this pull request
Nov 1, 2026
cailmdaley
added a commit
to cailmdaley/shapepipe
that referenced
this pull request
Nov 1, 2026
cailmdaley
added a commit
that referenced
this pull request
Nov 6, 2026
Conflicts: only tests/workflow/params_pin.json and params_pin_noisefill.json, both generated digests. Took neither side: regenerated both with --update-params-pin on the merged tree. tile_vignets, tile_ngmix and tile_make_cat move from edge's values, the three rules whose prologue carries #985's mktemp WCS staging; every other rule keeps edge's digest, so #994's and #997's exposure and tile-store changes stand as they were. Everything else merged cleanly and needed no adaptation. #997's Snakefile tile_store_root bind and #985's tile_local() edit touch separate lines, and the vignetmaker configs #985 changed are not the exposure configs #994 changed. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01JK7o9HXHK2JHphJN9p7BYu
ngmix fits each galaxy on single-exposure stamps at native pixels, but its neighbour, footprint and off-tile masks come from detection on the tile. They were the tile's VIGNET markers and SEG_VIGNET stamp, rotated for upside-down CCDs and laid on the exposure stamp. The tile and exposure grids differ by subpixel offsets and small rotations (median 0.56 px, P95 1.1 px, up to 1.8 deg on tile 188.307), so the masks were misplaced. - Tile detection writes SEG_LABEL, each object's check-image label, which the catalogue join keeps. - The multi-epoch vignetmaker takes the segmentation check image as a fourth input. For every image epoch, register_categories maps each stamp pixel centre through the exposure and tile WCSs, takes the nearest tile label (relabelled to NUMBER through SEG_LABEL), and stores SEG_VIGNET, NEIGHBOUR and OFF_TILE beside the stamp. - ngmix reads those maps instead of flipping tile stamps; it no longer reads the tile VIGNET, and Postage_stamp loses its megacam_flip switch. - astra.yaml records preparation.categorical_registration and drops megacam_ccd_flip. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
cailmdaley
force-pushed
the
fix/seg-exposure-grid
branch
from
December 6, 2026 02:42
fb4755a to
ba0c242
Compare
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.
Closes #984.
ngmix now masks neighbours, off-tile pixels and the object's own footprint on each exposure's own pixels, not on a flipped copy of the tile stamp.
ngmix fits every galaxy on single-exposure stamps at native pixels, but those masks come from detection on the coadded tile. On develop the tile's VIGNET markers and
SEG_VIGNETstamp are rotated for upside-down CCDs and pasted onto the exposure stamp. The tile and exposure grids are offset and slightly rotated relative to each other, so the pasted masks are misplaced: on tile 188.307 by 0.56 px at the median and 1.1 px at P95, with up to 1.8° of rotation. UberSeg masks differ in about half of all stamps.The misplacement also mis-assigns defects. Here a bad column 2 px from the centre of object 5422 lies inside its footprint, but the flipped overlay puts it outside:
What changes
SEG_LABEL, each object's label in the SExtractor segmentation check image. The catalogue join renumbersNUMBERbut keepsSEG_LABEL, so the check image can be relabelled to the finalNUMBER(−1 for detections the join drops).make_catdrops it with the other stamp columns.segmentation.fitsas a fourth input. For each image epoch,register_categoriesmaps every stamp pixel centre through the exposure WCS and the tile WCS, takes the nearest tile pixel's label, and storesSEG_VIGNET(int32),NEIGHBOURandOFF_TILE(bool) beside the stamp. Only integer labels are sampled; image, weight and flag stamps are untouched.Postage_stamploses itsmegacam_flipargument. Neighbours are every other nonzero label; UberSeg computes its partition on the registered labels.preparation.categorical_registrationand dropsshape_measurement.megacam_ccd_flip.tests/module/test_register_categories.pychecks the lookup against known answers: an exposure WCS shifted by whole pixels gives an exact slice of the tile segmentation, and a 180° WCS gives the rotated tile stamp. Subpixel offsets, a 17° rotation, a flipped CCD with SIP distortion and a stamp hanging over a rotated tile edge are checked against a per-pixel astropy round trip, and an end-to-end vignetmaker case checks theSEG_LABELrelabelling.Effect on shapes
On 188.307 every object passing
FLAGS=0,10≤SNR_WIN≤500was fitted twice, with the flipped overlay and registered, with identical seeds. For the 7,923 resolved, well-measured objects the response-only m-like shift is −1.9×10⁻³ ± 0.9×10⁻³, and the calibrated mean shifts are consistent with zero (−2.2×10⁻⁵ ± 3.4×10⁻⁵ and +3.9×10⁻⁵ ± 3.8×10⁻⁵ for the two components). Requirements are |m| < 10⁻² and |c| < 5×10⁻⁴. All 5,506 objects whose masks don't change reproduce all five metacal shapes bit for bit. This is one tile without known shear, so it measures how much shapes move, not a calibrated bias; treat it as a working number.The study and a full
sprun of 188.307 (tile detection totile_make_cat;tile_vignets6m26s, 14.1 GiB peak) used an earlier revision of this branch with the same lookup arithmetic. That revision also checked that tile and exposure celestial frames agree, which never changes a coordinate; this revision drops the check. The two operational bugs that run exposed are fixed separately in #1016.Adoption
This belongs at a campaign boundary, including the calibration image simulations. Rerun from tile detection: image vignette stores made before this lack the three maps, and ngmix stops on them with a
KeyError. The maps add about 1.9 GB per 120k epochs to the image vignette store.Claude (Opus 5.5) on behalf of Cail; implemented and measured by GPT-6.1 Sol.
🤖 Generated with Claude Code