Sat, 12/29/2018 - 09:05
I’m building a batch differential photometry app in Python using astropy and affiliated packages such as photutils. This is mainly a learning exercise - I know there are apps already out there that do batch photometry.
I’m stuck on how to automatically calculate the aperture / annulus sizes. I’m intending to set these as multiples of the max FWHM of the comp star ensemble but can’t find a Python function to calculate FWHM (in pixels) of a star, given a FITS image and the centroid (x,y in pixels) of the star concerned.
Can anyone point me to a function that does that.
Many thanks
Nigel
To find stars, use DAOStarFinder with 0 order approximation for FWHM. To estimate actual FWHM, you can fit found sources that have good SNR by e.g. 2-D Gaussians.
One of my students did that in this spring, however I did conclude to myself that pyraf and IRAF would work much better for stellar photometry... ;-)
Best wishes,
Tõnis
“you can fit found sources that have good SNR by e.g. 2-D Gaussians.”
Thanks but how do I do that? Sorry my math is limited so I was hoping for a function that would take as input the FITS image (or a numpy array corresponding to the image ADU values), together with the x,y pixel location of the star and would return the FWHM.
Identifying the stars and getting their centroids isn’t a problem - I have functions that do that.
Nigel
After a bit more research I’ve found Numpy and Scipy functions that will do a 2D Gaussian fit or an spline interpolation to give me a FWHM estimate but I really need a 3D solution so am still hoping there is a library function that will do this as I don’t think my math skills are up to rolling my own.
Any advice welcome. And Happy New Year all!!
Nigel
Hello Nigel,
I'm sorry I kept answer too brief, I answered first using mobile phone...
This 2-D Gaussian is more like "two-axis Gaussian", a 3-D function that's widths along e.g. x and y axes are different.
You can actually use function from Astropy itself, too:
from astropy.modeling.models import Gaussian2D
However, a lot of examples about photutils usage are given on their documentation page: https://photutils.readthedocs.io/en/stable/index.html . I'd suggest to look at PSF-related topics. I also noticed that probably I have to revise my former opinion about the usefulness and quality of photutils - progress till ver 0.6 has been impressive.
Best wishes,
Tõnis