Repository navigation
reference: scale inputs by photmjsr, not photmjsr x pixel area; awaicgen -sf 0 - #683
Open
jjencson91 wants to merge 1 commit into
Open
jjencson91 wants to merge 1 commit into
jjencson91 wants to merge 1 commit into
Conversation
…gen -sf 0 Each reference input was scaled by 10^(0.4 (zprefimg - ZPTMAG)). ZPTMAG is a point-source zero point that includes the SCA's pixel area, and awaicgen's simple coadd averages surface brightness, so the area was counted twice. The factor now also takes that area out and the 0.11" mosaic pixel's in: 10^(0.4 (zprefimg - ZPTMAG)) * A_mosaic / A, with A the frame's WCS pixel area (|det CD|, equal to meta.photometry.pixel_area to 0.02% on flight files) or, under use_nominal_zptmag, the new [reference.awaicgen] nominal_pixel_area (base: the 0.11" pixel, so nominal scaling is unchanged for zero points made for it; flight: 2.7185e-13 sr, the median over the 18 SCAs). awaicgen_pixelflux_scale_flag goes to 0 in the base: -sf 1 multiplied the coadd by (0.11")^2 over the first input's CDELT1 * CDELT2 only, so the mosaic's zero point depended on input order. A run body without nominal_pixel_area keeps dev's factor (and the -sf 1 it stored). Implements rapid_docs#251 (system/reference.md, decision reference-surface-brightness). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jjencson91
requested review from
RussLaher,
abostroem,
eramey16 and
rusholme
as code owners
December 4, 2026 03:32
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.
Implements Caltech-IPAC/rapid_docs#251 (
system/reference.md, Preparation and awaicgen steps; new rulingdecision-reference-surface-brightness).What changed
rapidpipe/science/reference/prep.py: the per-frame factor is10 ** (0.4 * (zprefimg - ZPTMAG)) * A_mosaic / A.Ais the frame's WCS pixel area (|det CD|of HDU 1, newpixel_area_deg2) for the headerZPTMAG, or the run'snominal_pixel_areafor the nominal one;A_mosaicisawaicgen_pixelscale_absolutesquared. In effect inputs are scaled byphotmjsrinstead ofphotmjsrx pixel area.FrameHeaderandPreparedFramerecord the area.rapidpipe/stages/reference.py: passesnominal_pixel_area(sr -> deg^2) underuse_nominal_zptmag; a run body without the key keepsdev's factor.rapidpipe/settings/foundation-thin.toml:awaicgen_pixelflux_scale_flag = 0(was 1); new[reference.awaicgen] nominal_pixel_area = 2.8440e-13sr (the 0.11" pixel, so nominal scaling is unchanged for zero points made for it).rapidpipe/settings/datasets/flight.toml:nominal_pixel_area = 2.7185e-13sr, the medianmeta.photometry.pixel_areaover the 18 SCAs.tests/unit/test_reference_science.py: test frames carry a 0.11" WCS; scaling tests include the area factor; new tests for the area swap, the nominal area being required, the pre-key run body, andpixel_area_deg2.Why
ZPTMAG = -2.5 log10(photmjsr * 1e6 * pixel_area / 3631)is a point-source zero point. awaicgen's simple coadd is an overlap-weighted mean of its inputs (awaicgen_compute_simpcoadd.c), i.e. it treats them as surface brightness, so each SCA's pixel area (about 2.63 / 2.72 / 2.80e-13 sr on flight) was counted twice.-sf 1multiplies the coadd by (0.11")^2 over the first input file'sCDELT1 * CDELT2(awaicgen_store_img_fnames.c,i == 0;awaicgen_compute_results_simple.c), 1.015 to 1.081 across flight SCAs, so the mosaic's real zero point differed from itsMAGZPdepending on input order. With the area in the inputs and-sf 0,MAGZP = zprefimgholds for any order.Effect on runs
use_nominal_zptmag = true): still one factor per filter; the absolute level shifts by a few percent and no longer depends on input order.use_nominal_zptmag = false(e.g. run 302): the per-SCA pixel-area patches go away.CDELT1 * CDELT2.Review: touches
rapidpipe/settings/, so it needs one approval from a team member (CONTRIBUTING.md, Review and Acceptance).Tests:
tests/unit/test_reference_science.py,test_reference_stage.py,test_layers.pypass locally (138). The full unit suite is left to CI (the local environment's photutils is older than requirements.txt).🤖 Generated with Claude Code