Autostronomy / AstroPhot

A fast, flexible, automated, and differentiable astronomical image 2D forward modelling tool for precise parallel multi-wavelength photometry
https://astrophot.readthedocs.io
GNU General Public License v3.0
78 stars 9 forks source link

Sersic model with oversampled center #190

Closed Bhavesh012 closed 2 months ago

Bhavesh012 commented 2 months ago

One of the problems which arises with Sérsic modelling is that as the Sérsic index (n) increases, the model becomes very steep at the centre. Therefore, modelling on the same grid as the rest of the function often underestimates the flux in the centre.

Ideally, the model must be estimated on an oversampled grid in the center.[1] This has been implemented in GALFIT[2] but not in the Astropy models3, and I wonder if this functionality exists in AstroPhot or not.

[1]: Section 2.1 of https://iopscience.iop.org/article/10.1086/518836 [2]: Section 2.3.1 of https://iopscience.iop.org/article/10.1086/340952

ConnorStoneAstro commented 2 months ago

@Bhavesh012 Great question! AstroPhot handles this automatically. You can see the details in section 2.1.2 in the AstroPhot paper: https://ui.adsabs.harvard.edu/abs/2023MNRAS.525.6377S/abstract

But the gist is that AstroPhot detects problematic pixels, then performs recursive Gaussian quadrature integration until it determines the pixel flux accurately to within 1% (by default, you can set stricter requirements). We put a ton of work into finding and integrating complex pixels since AstroPhot is designed for arbitrary 2D profiles, a user may design a profile which has complex behavior somewhere other than the center (say a model for diffraction spikes) and we want AstroPhot to perform properly in all such cases.

As a final point, you can in fact do the modelling at higher resolution than the fitted image, but this is only necessary for PSF modelling. If you provide AstroPhot with a PSF that is at higher resolution than the model, it will supersample the model, perform the PSF convolution, then downsample back to the regular image resolution to do fitting. This can be necessary when say an image is sampled bellow the nyquist limit and naive PSF convolution would cause artifacts.

I hope that answers your question! Let me know if you're curious about anything else.

Bhavesh012 commented 2 months ago

Oh, wow, that is amazing! Thanks for clearing it out!