Department of Physics AstroLab

Stacking Images

The combining of several images allow fainter sources to be detected and their apparent magnitudes determined with improved precision. We use the routines provided by Peter Draper's CCDPACK package to stack, i.e. register and average, sets of images.

A basic csh script is available that stacks of a set of the "default" AstroLab dark-subtracted images, i.e. the "dxxxx.fits, ..." image files. Typically the following steps would be carried out:

  • Create a working directory(folder) and "change" to this directory, e.g.

    mkdir mystack 
    cd mystack 
    It is helpful, of course, to give this directory a sensible name!

  • Examine the observing logs and select the fits images required. If necessary visually examine the fits images with the Starlink GAIA image display tool and note the numbers of the images that you may which to exclude from the stracking, e.g. those with poor tracking or poor S/N.
  • Run the python script

    /mnt/64bin/dfstack.py

    The syntax is:

    /mnt/64bin/dfstack.py telescope date start end

    e.g.

    /mnt/64bin/dfstack.py east-14 19_01_30 140 150

    If master_flat.fits is included in the working directory, it will be used to flat field each frame first. If you want to exclude files in the sequence put their numbers in a file called "DONT_PROCESS".

    If successful, an output image called "mosaic.fits" will be produced. This is the average of all the "d" fits images in th sequence. In the stacking process averaging is used rather than summing to allow for pixels with missing values.

    The average of the fits header keyword DATE-OBS, i.e. the UTC (Coordinated Universal Time) of each image, is calculated and stored in the fits header of the output image as the DATE-OBS value. The mean modified julian date is also calculated and is stored as the value of the keyword MJD-OBS.

  • The script will also attempt to determine the astrometry mapping for the image, i.e. the (x, y) pixel to (RA, Dec) mapping, from the auto identification of UCAC4 stars. (This image when displayed with Starlink's GAIA image display tool will give (RA, Dec) positions as well as the (x, y) pixel positions). If successful, an output image called "amosaic_ucac4.fits" will be produced. The code will also attempt to use the ESA-GAIA star catalogue to put an astrometry mapping on the image. If successful, an output image called "amosaic_gaia.fits" will be produced.

Old way

  • Copy these to the current directory, e.g.
    cp -p /archive/draco2/2015/15_05_21/d002*.fits  . 
  • Visually examine (if necessary) the fits images with GAIA and delete any that are not suitable, e.g. those with poor tracking or poor S/N.
  • Run the stacking csh script, i.e.

    /mnt/64bin/d_stack.csh 

Calculation of Photometric Errors in Stack Images

When undertaking aperture photometry with Starlink's GAIA the usual defaults calculate the photometric errors by assuming that the input image has units of "photon" counts and hence photon statistics are used to estimate the error. The stacked image produced by the csh script is the "average" (rather than the summed) image and hence GAIA's default setup parameters will give an erronous estimate of the photometric error.

Consider the following simple case. If an object in an individual image had a total count of ∼100, then ignoring any background/readout noise uncertainties, the statistical error would be the square root of 100, i.e. 10, and hence a 10% error on the flux. If nine images were used in stacking process the total count for this object would still be reported as ∼100, i.e. the images are averaged rather than summed. Now if photon statistics were assumed the same 10% error would be calculated which is incorrect. The stacked image effectively has 900 counts in the object and hence the statistical error is the square root of 900, i.e. 30, and hence a 3.3% error on the flux.

In GAIA the simplest way to get approximately correct photometric errors on a stack image is to change the "aperture photometry parameter" "Measurement errors use:" from "photon statistics" to "sky variance". GAIA will then use the scatter in the pixel counts in the sky annulus to estimate a reasonable "gain" factor to use in the photometric error calculation.


Back to the AstroLab Home Page jrl 2020-Jun-17 12:27:34 UTC