Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EPSFbuilder doesn't seem to be re-centering sources properly resulting in "dotted" PSF centers #1404

Open
mfloyd21 opened this issue Aug 22, 2022 · 2 comments

Comments

@mfloyd21
Copy link

We're attempting to use the epsfbuilder function to extract, re-sample, re-center, and combine psf stars in our galaxy pointings to output an empirically determined psf.

  • When the oversampling is set to 2, the psfs do have a believable shape and distribution (attached)
    Oversample2_PSF

  • When the oversampling is set any higher, the re-centering of the sources seems to fail. In the example I'm attaching, we have set the oversampling to 4, and we get a psf with 4 centers.
    Oversample4_PSF

    • the stars objects before and after the re-centering seem unchanged, I will be attaching the stars before and after being re-centered, as well as their subtraction. The subtraction results in a grid of zeros, so nothing seems to be shifting

Pre-Fitted

Fitted_Stars

Subtracted

So our questions are:

  • what is the reason the re-centering doesn't seem to be working properly (centroid measurement failing? Centroids measured but not used?)
  • Since we know the stars sub-pixel positions, is there a way to force those values through instead of epsfbuilder estimating the centroids itself

This is my first time coming to a forum, so please let me know if I left anything vital off of my explanation and I would be happy to include it.

@larrybradley
Copy link
Member

The ePSF builder algorithm generally requires a (very) large number of stars to build a PSF. And more stars are needed as you increase the oversampling factor. For example, with an oversampling factor of 4, in a perfect scenario you would need at least 16 stars that happen to have centers on each 4x4 subpixel (but even then the resulting PSF would be quite noisy). That's unlikely for a real sampling of stars. Typically you would need hundreds of stars for this to work. Without a good sampling of stars over the oversampled pixel grid, you'll end up with many "holes" in the grid, which will throw off the algorithm.

@emirkmo
Copy link

emirkmo commented Nov 11, 2022

Hi @larrybradley @mfloyd21, please see our Wrapped implementation in the FLOWS photometry pipeline FlowsEPSFBuilder, where these requirements are not met yet we achieve a good fit. It has been tested on thousands of images. Obviously, EPSF is overkill when the stars are few but in a pipeline we had to be robust to input stellar density.

FlowsEPSFBuilder:

https://github.com/SNflows/flows/blob/c7e98d25e6b5c84248c8cb1ae9dad7013837178a/flows/epsfbuilder/epsfbuilder.py#L17-L56
The function to make the epsf with defaults:
https://github.com/SNflows/flows/blob/c7e98d25e6b5c84248c8cb1ae9dad7013837178a/flows/photometry.py#L105-L123

Be aware that currently the pipline is semver locked to photutils == 1.1.0. We only update when we're going to re-run the entire database for consistent results and I haven't had the chance to test the dependency upgrade path.

Details

We use oversampling = 1 by default as most fields are not crowded and most images are not oversampled. We also keep a small fitting & recentering boxsize since that works well with the default weights in the init Gaussian shape. We have maxiters high to ensure convergence and to test for a now fixed bug where sometimes iterations were diverging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants