aperture_photometry#
- astropop.photometry.aperture_photometry(data, x, y, r='auto', r_ann='auto', recenter_limit=None, recenter_method='com', gain=1.0, bkg_error=None, mask=None, bkg_method='mmm', bkg_sigma_clip=3.0, pixel_flags=None, box_size=11)#
Perform aperture photometry using sep. Output units (ADU or e-) will be the considered the same as input.
This method just wraps the
ApertureStats
method from photutils, assuming standard arguments and performing extra steps:Calculate the total error (bkg+poisson) from input data, based on data and bkg_error.
It assumes the
'exact'
method of subpixel sampling.Compute an optimal aperture radius, considering only the gaussian background-only error. This radius is defined as r=0.6731*GFWHM.
Use sigma clipping for annulus background calculation.
Perform photometry flags generation. See
PhotometryFlags
.Sources recentering using
centroids
methods. Only performed ifrecenter_limit
is not None.
Most of the reduction is based on Astropy workshop sample notebooks [1].
- Parameters:
- data
ndarray
2D image data for photometry
- x, yarray_like
Positions of the sources
- rfloat,
'auto'
(optional) Aperture radius, in pixels. If ‘auto’, the value will be estimated based in the median gaussian FWHM of the sources in the image (r=0.6731*GFWHM). Default: ‘auto’
- r_annarray_like([float, float]),
'auto'
None
(optional) Annulus radii (r_in, r_out) for local background extraction in pixels. If ‘auto’, the annulus will be set based on aperture as (4*r, 6*r). If None, no local background subtraction will be performed. Default: ‘auto’
- recenter_limitfloat (optional)
Maximum distance allowed to recenter the apertures. If None, no recentering will be performed. Default:
None
- recenter_method‘com’, ‘gaussian’ or ‘quadratic’ (optional)
Algorithm to recenter the apertures. If None, no recentering will be performed.
'com'
method will use the center of mass of the aperture,'gaussian'
will use a gaussian fit to the aperture and'quadratic'
will use a quadratic fit to the aperture. Seecentroids
for more information. Default: ‘com’- gainfloat (optional)
Gain to correctly calculate the error. Default: 1.0
- bkg_errorfloat or
ndarray
(optional) 1-sigma gaussian error of the background-only error of input data. If None, zero will be used. Default:
None
- mask
ndarray
(optional) Mask badpixels and problematic ccd areas. Default:
None
- pixel_flags
ndarray
(optional) Array with flags for each pixel. If None, no flags will be used. Flags must follow the
PixelMaskFlags
standard. Default:None
- bkg_method‘mmm’, ‘mode’, ‘median’ or ‘mean’ (optional)
Algorith to calculate the background value.
'mode'
or'mmm'
(mean, median, mode) are computed as (3*median - 2*mean) and should be better for populated fields.'median'
and'mean'
just compute these values in the annulus. All algorithms can use sigma clipping ifbkg_sigma_clip
is not None. Default: ‘mmm’- bkg_sigma_clipfloat, tuple(float, float) or
None
(optional) Sigma clipping values for background calculation. If a tuple is provided, the first value will be used as lower sigma and the second as upper sigma. Only used if
sky_algorithm='sigmaclip'
. Default: 3.0- box_sizeint (optional)
Box size for median FWHM computation. Default is 11.
- data
- Returns:
- res_ap
Table
Table containing all aperture photometry informations. -
x
,y
: centroids of the sources. If recentering is performed,these values will be different from input.
aperture
: aperture radius. Same for all sources.flux
: flux of the sources with bkg subtractedflux_error
: flux error of the sources with bkg subtractedaperture_area
: effective aperture (considering mask) of the sources.bkg
: background value by pixelbkg_stddev
: background standard deviation inside the annulusbkg_area
: effective area of the annulus (considering mask and clipping)flags
: flag for the sourcesoriginal_x
,original_y
: original input positionsfwhm
: circularized FWHM computed for each source
The metadata of the table will contain the following information: -
photutils
: photutils version used -astropy
: astropy version used -astropop
: astropop version used -fwhm
: median FWHM of the sources -r
: aperture radius used -r_in
: inner annulus radius used -r_out
: outer annulus radius used
- res_ap
Notes
The input data is divided by the gain prior to any calculation.
The centroid of the sources is computed within a circular footprint with radius
2*r+1
. Seecentroid_sources
for more information.Local background subtraction is performed entirely by photutils. So, we do not touch it or compute any errors here.
References
[1]Astropy workshop sample notebook (astropy/astropy-workshop 8a5056449b92ca4019e16/09-Photutils/03-aperture_local_bkgsub.ipynb)