Keep signed photon weights in Sum._shoot (#1352) - #1364
Open
shaneraphel wants to merge 2 commits into
Open
shaneraphel wants to merge 2 commits into
shaneraphel wants to merge 2 commits into
Conversation
After each component _shoot, Sum was assigning fluxPerPhoton from the unsigned (positive+negative) weight. ChromaticSum already keeps the component fluxes, which OpticalPSF InterpolatedImage needs because of ringing. Fixes GalSim-developers#1352. Co-authored-by: Cursor <cursoragent@cursor.com>
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.
Fixes #1352.
Sum._shootassigns each photon to a component, calls that component's_shoot, then overwritestemp.fluxwith the unsigned weight(positive_flux + negative_flux) / n.ChromaticSum._shootalready copies the component array without that assignment.That overwrite is an identity for profiles with
negative_flux = 0(Gaussian, Moffat).OpticalPSFis anInterpolatedImagewith ringing, sopositive_flux + negative_fluxis larger thanflux(here 1.584 on GalSim 2.8.5, Roman J129). Used as aphoton_opsPSF, the unsigned overwrite inflates the drawn flux.Labeled check on GalSim 2.8.5, Roman J129,
n_photons=1000,nx=51,poisson_flux=False, seed 42,Add([OpticalPSF, OpticalPSF])/2:Sum(current)ChromaticSumofChromaticOpticalPSFA Gaussian
Sumdrawn as the object (method='phot') stays flux-faithful with or without the line (0.955 vs 0.956 on a 33² stamp). Existing Gaussiando_shootcoverage should keep passing.This is a software routing identity with
ChromaticSum, not a claim about telescope optics.AI: a compiled language model drafted the one-line dest (0 gradient-descent training steps). I reviewed the source sibling and the flux lattice before opening this PR.