source_photometry

petrofit.segmentation.source_photometry(source, image, segm_deblend, r_list, error=None, cutout_size=None, bg_sub=False, sigma=3.0, sigma_type='clip', method='exact', mask_background=False, plot=False, vmin=0, vmax=None, figsize=[12, 6])[source]

Aperture photometry on a PhotUtils SourceProperties.

Parameters:
sourcephotutils.segmentation.SourceProperties

SourceProperties (an entry in a SourceCatalog)

image2D array

Image to preform photometry on.

segm_deblendSegmentationImage

Segmentation map of the image.

r_listlist

List of aperture radii.

error2D array

Error image (optional).

cutout_sizeint

Size of cutout.

bg_subbool

If the code should subtract the background using the sigma provided.

sigmafloat

The sigma value used to determine noise pixels. Once the pixels above this value are masked, a 2D plane is fit to determine the background. The 2D plane model is then converted into an image and subtracted from the cutout of the target source. see the sigma_type on how this value will be used.

sigma_type{‘clip’, ‘bound’}, optional
The meaning of the provided sigma.
  • 'clip' (default):

    Uses astropy.stats.sigma_clipping.sigma_clip to clip at the provided sigma std value. Note that sigma in this case is the number of stds above the mean.

  • 'bound':

    After computing the mean of the image, clip at mean - sigma and mean + sigma. Note that sigma in this case is a value and not the number of stds above the mean.

method{‘exact’, ‘center’, ‘subpixel’}, optional

The method used to determine the overlap of the aperture on the pixel grid. Not all options are available for all aperture types. Note that the more precise methods are generally slower. The following methods are available:

  • 'exact' (default): The the exact fractional overlap of the aperture and each pixel is calculated. The returned mask will contain values between 0 and 1.

  • 'center': A pixel is considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. The returned mask will contain values only of 0 (out) and 1 (in).

  • 'subpixel' A pixel is divided into subpixels (see the subpixels keyword), each of which are considered to be entirely in or out of the aperture depending on whether its center is in or out of the aperture. If subpixels=1, this method is equivalent to 'center'. The returned mask will contain values between 0 and 1.

mask_backgroundbool

Should background pixels, that are not part of any source in the segmentation map, be included? If False, only pixels inside the source’s segmentation are unmasked.

plotbool

Show plot of cutout and apertures.

vminint

Min value for plot.

vmaxint

Max value for plot.

figsizetuple

Figure size.

Returns:
flux_arr, area_arr, error_arr(numpy.array, numpy.array, numpy.array)

Tuple of arrays:

  • flux_arr: Photometric sum in aperture.

  • area_arr: Exact area of aperture.

  • error_arr: if error map is provided, error of measurements.