astropy / photutils

Astropy package for source detection and photometry. Maintainer: @larrybradley
https://photutils.readthedocs.io
BSD 3-Clause "New" or "Revised" License
250 stars 138 forks source link

Add polygon aperture #467

Open larrybradley opened 8 years ago

larrybradley commented 8 years ago

This is a reminder to implement a polygon aperture based on a polygon region from the regions package. This will occur when regions is ready and we base all photutils apertures on regions.

cooker33 commented 6 years ago

Any updates on this feature? Arbitrary polygon apertures would be very useful.

larrybradley commented 6 years ago

@cooker33 We first need a polygon region to be implemented in the regions package (https://github.com/astropy/regions) before we can add a polygon aperture in photutils.

cooker33 commented 6 years ago

@larrybradley That's fair enough. Any advice or tips for performing photometry on fits images inside an HST-WFC3 footprint defined by a ds9 polygon?

larrybradley commented 6 years ago

@cooker33 You can use the pyregion (https://pyregion.readthedocs.io/en/latest/) package to load in a DS9 region file and use its get_mask function (https://pyregion.readthedocs.io/en/latest/api/pyregion.get_mask.html#pyregion.get_mask) to convert it to a boolean mask. You could then put that boolean mask into a photutils ApertureMask object (https://photutils.readthedocs.io/en/stable/api/photutils.aperture.ApertureMask.html) and use its multiply method to do the photometry (i.e. sum the result of multiply).