# Aperture Photometry

Aperture photometry determines sum of counts from a star in a set of predefined apertures.

## Synopsis

`munipack aphot [.. parameters ..] file(s)[,result(s)]`

Running of photometry adds a HDU extensions to the original frame as a table described in Processing Format.

## Algorithm

Aperture photometry is performed by the way:

- Read parameters (command-line and gain and LOBAD,HIBAD) and list of detected stars (in FIND extension).
- For every detected star, the sum inside of the specified apertures as well as in sky determining ring is computed.
- The mean background in the ring is computed.
- The counts for all apertures are computed by subtracting of mean background.

The pixels near the border are approximated by only a fraction covering the pixel inside.

By defaults, twelve apertures is used. Aperture radii are computed as points of logarithmic spiral r = r0exp a φ with the initial radius r0=2 and pitch angle 8.9073° (to be compatible with DAOPHOT II).

For a correct determination of photometry errors, the camera-specific parameters must by provided.

Strictly speaking, for further processing just one aperture is required. The prepare of several apertures has profit in fast switching to another aperture without needs to do photometry again. More apertures can be also used in simultaneous use of ones for PSF of grow-curve photometry.

The results of aperture photometry are stored in columns of a newly created APERPHOT extension.

The photometry is performed for all detected stars (all stars in FIND extension) in all specified apertures. Sometimes it is impossible compute the sum, the case is indicated by a negative value (-1). Common situation are when the sum of counts with subtracted background is negative (sky is polluted by a bright source, background has a fast gradient) or the star is too near of border and summing pixels are out of area) or a star is saturated.

The results of aperture photometry are stored to next PHOTOMETRY extension. In the extension, the results in a selected aperture (by `-s`) are selected. Just stars with valid (non-negative) values are presented here.

## Data assumption

Aphot does assumtion, that data represents actually detected counts.

While common digital devices detects single photons, the cameras does not report their true counts. Rather, they reports a digitised value which is multiplied by some amplifier gain of the electronic device. Moreover, the value has included bias to suppress a non-linearity of the devices.

Therefore, it is very important to pre-correct the data. The relative precision of star determination is driven by Poisson statistics; if actually detected counts of photons is N, the relative error will be σ=√N/N. However, data multiplied by factor g gives σ/√g (for N=10000, σ=1/100, while a choice g=4 leads to 1/50).

Aphot does not check the assumption. Carefully handled parameters of phcorr will prepare such correct data. The gain value can be checked by flat-field.

## Elliptic apertures

Munipack improvement over the original DAOPHOT aperture photometry implementation is possibility to use of elliptic apertures enclosing trailed stars more tightly. While this idea looks extremely attractive, the application on real data shows minimal, if any, progress. This is perhaps a dead way.

The implementation is pure experimental. FIND estimates both eccentricity and inclination; the values are used by this routine, if it is invoked with `--enable-ellipticity`. Elliptic apertures are missing intentionally in GUI.

## Input And Output

On input, list of frames containing the table with already detected stars is expected.

On output, tables with the aperture photometry and results from the selected column, represented by FITS extension, is added to all input images.

## Parameters

`--apertures r1, r2, .. rmax`
  define apertures radii (in pixels), count and sizes are arbitrary, must be specified in increasing order and separated by commas
`--ring ri,ro`
  inner and outer sky ring radius in pixels, the inner radius must be equal or bigger than the greater aperture
`--enable-ellipticity`
  Apertures are ellipses; their actual shape is determined by FITS parameter in FIND extension, or specified by following command line options.
`--eccentricity e`
  Eccentricity of apertures by a contour ellipse: 0 ≤ e < 1. The default value is e=0 meaning circular aperture.
`--inclination i`
  Inclination of major semi-axis of the ellipse in degrees. Positive values of the angle are in mathematics sense (counter-clockwise).
`--coo "x1,y1 x2,y2..."`
  List of pixel rectangular coordinates: they are centroids of stars to get photometry for. Their photometry processing, including accuracy and robustness, is exactly the same as the canonical way. FIND extension can not be presented in the FITS file.

See Common options for input/output filenames.

## History

The routine is on base of original code of DAOPHOT II by P.B.Stetson (has been forked from Midas's implementation at 1996). Some additional enhancements has been done:

- Robust estimators replaces the original estimators of averadge.
- All processing is done in memory (no disc buffering is used).
- The magnitude output has been abandoned.
- Elliptic apertures can be choosed.
- FITS files for both input and output are used
- Log format is changed.
- Code is updated for Fortran 90 and 95 (and perhaps above).

## Examples

Run aperture photometry:

`$ munipack find pleiades.fits $ munipack aphot pleiades.fits`

Select apertures and sky estimation by hand (as powers of 2):

`$ munipack aphot --apertures 1,2,4,8,16,32 --ring 16,32 pleiades.fits`

List of total counts (aperture photometry) in default apertures for star at x = 666, y = 666:

`$ munipack aphot --coo "666,666" pleiades.fits`

## See Also

Growth Curve Overview, Find Stars, Common options, Photometry Format.