Aperture Photometry

Introduction

Aperture photometry uses Apertures to cut out and sum values in an image. A very basic mask might be a square of pixels at a certain position. We can model this as a matrix of ones and zeros like

[0 0 0 0 0
 0 1 1 1 0
 0 1 1 1 0
 0 1 1 1 0
 0 0 0 0 0]

If we have some data like

[7 9 6 0 8
 8 5 8 7 9
 5 6 2 2 7
 9 7 3 4 1
 7 8 0 9 8]

then the result of our aperture photometry looks like

[0 0 0 0 0     [7 9 6 0 8     [0 0 0 0 0
 0 1 1 1 0      8 5 8 7 9      0 5 8 7 0
 0 1 1 1 0  .*  5 6 2 2 7  =   0 6 2 2 0
 0 1 1 1 0      9 7 3 4 1      0 7 3 4 0
 0 0 0 0 0]     7 8 0 9 8]     0 0 0 0 0]

sum(result) = 44

This module uses the above principal with common aperture shapes in a fast and precise manner, including exact overlaps between apertures and pixels.

The majority of the lifting is done with the aperture_photometry function with common shapes being described in Apertures. It is possible to create a custom aperture by sub-typing the Aperture.AbstractAperture class, although it may be easier to perform PSF photometry instead.

Pixel Convention

Photometry.jl follows the same convention as FITS, WCS, IRAF, ds9, and SourceExtractorBackground with (1, 1) being the center on the bottom-left pixel. This means the exact bottom-left corner is at (0.5, 0.5). Pixels increase up and to the right until axis_length + 0.5.

This is mostly in line with Julia's indexing, although it is important to remember that arrays are layed out in (y, x) due to the row-column interface. So the pixel at (34, 56) is at image[56, end-34].

API/Reference

Photometry.Aperture.aperture_photometryFunction
aperture_photometry(::AbstractAperture, data::AbstractMatrix, [error]; method=:exact)
aperture_photometry(::AbstractVector{<:AbstractAperture}, data::AbstractMatrix, [error]; method=:exact)

Perform aperture photometry on data given aperture(s). If error (the pixel-wise standard deviation) is provided, will calculate sum error. If a list of apertures is provided the output will be a DataFrame, otherwise a NamedTuple.

Methods

  • :exact - Will calculate the exact geometric overlap
  • :center - Will only consider full-pixel overlap (equivalent to subpixel method with 1 subpixel)
  • (:subpixel, n) - Use n^2 subpixels to calculate overlap
Note

The :exact method is slower than the subpixel methods by at least an order of magnitude, so if you are dealing with large images and many apertures, we recommend using :subpixel with some reasonable n, like 10.

source