


home Lymm Observatory optimal photometry how it works test data 1 test data 2 real data 
Consider a star image, which is spread over a number of pixels. We want to measure the flux from this star, with maximum precision. We assume that we know: position of target star approximate brightess of target star (approximate) PSF for stars sky background level to be subtracted model for noise associated with each pixel We also assume: pixel sensitivity is uniform across pixels all stars have same PSFOptimal extraction then proceeds as follows: 1. Using the position and the PSF, we estimate the fraction of total flux contained in each pixel (this requires integrating the PSF over the area of the pixel). 2 Subtract the sky to obtain the star flux from each pixel, and then divide by the fraction calculated in step 1 to obtain an estimate of the total stellar flux (and its associated error!). Each pixel gives an independent estimate of the total flux. 3. We now combine these independent estimates in the most advantageous way, that is to say, by computing the weighted mean. We take the weights to be inversely proportional to the variance. A mathematical description can be found in Naylor 1997. Here I will try to describe how the process works with the aid of an Excel spreadsheet, which you can download here. This spreadsheet was developed purely to demonstrate how optimal extraction works  you wouldn't use it to do photometry of actual images. For that you require appropriate photometry software. There's rather a lot in this spreadsheet, so let's go through it step by step. It assumes the star has Gaussian PSF, which it models by considering a series of concentric rings or annuli. Each annulus extends over one unit in radius, and the model extends out to 120 units in radius. You should enter the central flux (in photons per unit area) for the star, the sky background (also in photons per unit area) and also the FWHM (full width half maximum) of the PSF. Nowhere does this spreadsheet actually refer to pixels. The units are arbitrary, but it is sometimes helpful to think of them as 0.1 pixels (so 1 pixel has an area of 100 units). For example, the FWHM in my images is typically 1.52.0 pixels. A typical sky background might be 1000 photons per pixel, so I would enter 10 for sky flux per unit area, and 15 to 20 for the FWHM. The spreadsheet computes the total flux for the star  note that if you leave the central flux alone, and double the FWHM, the total flux will increase by a factor of 4. (Strictly speaking, the term flux is incorrect, and I should use the term fluence, which is the timeintegrated flux. However, flux is more commonly used, so I shall use that). The results presented in rows 15 to 24 are computed in rows 35 and below. If you are not interested in the details of the computations, you can skip to the results. Computation is as follows: Columns A to H are concerned with the flux from the test star. Columns J to O calculate the result obtained from aperture photometry, i.e. the stellar (=sky corrected) flux within a specified radius, and its associated error. Columns Q to U are concerned with the model PSF used for optimal extraction. Optimal extraction for the target star is carried out in columns W to AC. Column Y  estimate of total flux from this annulus  is derived by dividing the sky actual sky corrected flux by fraction derived from the model. The weight for each annulus is calculated in column AA. The optimally weighted flux and its error appear in cells AB177 and AC177. Note that the distribution of weights depends on the brightness of the star  a fainter star or brigher sky will place higher weight towards the centre of the star image, in comparison to a brigher star or darker. We refer to the distribution of calculated weights to be used, as a 'weight mask'. Columns AE to AK and AM to AS repeat the optimal process for the two comparison stars. These have the same shape as the target star. Note, however, the weights for each annulus are taken from the target star. Columns AU and AV are used to force the weights to zero after we have reached 99.999% of the flux. Finally, in rows 183 to 205, the extraction process is repeated for the target star, but with the annuli grouped in batches of 10. This is an attempt to simulate a poorly sampled image (remember that we can't divide the image up into 0.1 pixelwide rings in practice!). Now, let's have a look at some of the results from these calculations.

