Skip to content

Lose the PSF light that falls off the frame - #4

Merged
jacotay7 merged 1 commit into
mainfrom
fix/psf-edge-flux
Oct 7, 2026
Merged

jacotay7 merged 1 commit into
mainfrom
fix/psf-edge-flux

Conversation

@jacotay7

@jacotay7 jacotay7 commented Oct 7, 2026

Copy link
Copy Markdown
Owner

Problem

MoffatPSF, EllipticalGaussianPSF and AiryPSF clipped their sampled stamp to the frame, then divided by the sum of what was left. A source near the edge therefore deposited all of its flux on the detector. A Moffat star centred on column 0 kept 100%, where GaussianPSF, which integrates exactly, keeps about half. This breaks the stack convention that light lost at a detector edge is lost, not renormalised (aocore CONVENTIONS 3.3). It was found while migrating getframes onto aocore (#3).

Fix

A shared _deposit_sampled helper evaluates the profile on the full (2r+1)² stamp, normalises it over that stamp, and then adds only the part that lands on the frame. Sources wholly inside the frame give the same images as before, to rounding.

Tests

  • New test_psf_loses_the_flux_that_falls_off_the_frame, for Gaussian, Moffat, EllipticalGaussian and Airy: an edge source must deposit exactly the x >= 0 part of a fully captured image (rel 1e-9), and less than 75% of the flux. Moffat, EllipticalGaussian and Airy fail it on main; all four pass with the fix.
  • Full suite: 523 passed. ruff and mypy (strict) are clean.

🤖 Generated with Claude Code

MoffatPSF, EllipticalGaussianPSF and AiryPSF clipped their stamp to the frame
and then normalised what was left, so a source on the edge kept its full
flux. They now normalise the whole stamp first and deposit only the part on
the detector, as GaussianPSF already did. A new test compares an edge source
with the x >= 0 half of a fully captured image.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jacotay7
jacotay7 merged commit 84766e2 into main Oct 7, 2026
14 checks passed
@jacotay7
jacotay7 deleted the fix/psf-edge-flux branch October 7, 2026 02:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant