Stacking data with shiftadd

Very often one wants to combine a number of frames together to improve the signal-to-noise of faint sources. Whilst averun can be used to do this, it simply combines the frames without any attempt to align them. For very deep images, usually one wants to align the frames first, and this is what shiftadd does. This page discusses the usage of shiftadd and provides some tips on how to get the best results.

Note

TLDR: For those in a hurry, stacking frames with shiftadd requires the following steps:

  1. Create a low signal-to-noise stack using averun.

  2. Create an aperture file using setaper and define reference apertures.

  3. Set parameters for aperture positioning and image calibration using genred.

  4. Run shiftadd to align and stack the frames.

Aligning images

The first step in stacking images is to find the offsets between the frames. Rather than re-write the machinery for doing this from scratch, shiftadd uses the same code used for finding the positions of stars during the photometry. Therefore, the first step is to proceed as if you are performing a data reduction.

In particular, you will want to create an aperture file using setaper and define some reference apertures using the r keyboard shortcut. These positions of these reference apertures in each frame will be used to determine the offsets between the frames. You need to place at least one reference aperture for every CCD that you want to align. shiftadd does not rotate frames (only applying linear shifts), so the primary advantage of using multiple apertures is to improve the accuracy of the offsets.

Reduction file for parameter setting

There are many parameters that control how apertures are positioned. Because these are also common with the parameters used in photometry, we create a reduction file to hold these parameters. This is done using the genred command.

Calibrating images

Before stacking images, we usually want to apply the usual calibration steps to remove instrumental effects. This includes bias subtraction, flat fielding and fringe removal. genred will prompt you for the relevant calibration files to use in these steps.

Stacking images

The actual stacking of images is done using reproject as an engine. The documentation for the reproject package is the best place to look for the details of the various algorithms used to resample the data. Here we only outline a few issues which are worth considering for different use cases.

Exact pixel shifts

For very faint sources, you may want to avoid any resampling of the data, which can wash out the signal. In this case, you can use set the reprmethod=interp parameter with reprorder=0 to apply integer pixel shifts only. For almost all other cases you want to use reprmethod=adaptive or reprmethod=exact as these methods guarantee conservation of flux and can provide better resampling for brighter sources.

Instrument specific issues

There are some peculiarities of shiftadd that should be noted when used on ULTRA(CAM|SPEC) or HiPERCAM data. These instruments have multiple CCDs, and each CCD has two or more output amplifiers with different gains, bias levels and readout noise. The output amplifiers naturally divide the CCD into multiple regions (2 in the case of ULTRACAM and 4 in the case of HiPERCAM). In addition, the observer can define windows which fill some, or all, of these regions.

The shiftadd command treats data from each region/window as entirely separate. Data from one region/window is never combined with data from another when stacking data.