You are here: Home / Surveys & Projects / VISTA / Technical Information / Sky subtraction

Sky Subtraction Strategies

Pawprint method

For a dither sequence with a reasonable range of offsets there is a good chance that every location on sky is covered by some object-free pixels. Doing a straight forward stack of the images with some form of outlier rejection leads to a good contemporaneous background map providing the jitter offsets are significantly larger than the characteristic size of the point-spread function and no large, or bright objects, are in the field. Where this algorithm fails most often is when the jitter offsets are not sufficiently large to allow the full profiles of the brightest stars to be rejected completely, or when large bright galaxies are present in the field. Bright stellar halos are sometimes only a few percent above the ambient background and hence may not reject out during stacking.

Pawprint method with Object Masking

One way of avoiding the problem of poor rejection of astronomical objects while doing a combination for background estimation is to mask the objects beforehand using the following algorithm:

  1. Combine all the object images with rejection to form a sky frame.
  2. Subtract the sky frame from all the object images
  3. Shift and combine the background-subtracted object images to form a stacked frame
  4. Throw away the background subtracted object images
  5. Do an object detection on the stacked frame and note where the object pixels are. This forms a master object mask. Note how many object pixels there are.
  6. Throw away the stacked frame
  7. Recombine the original images with rejection and in conjunction with the object mask form a new sky frame.
  8. Go back to step 2. Repeat up to here until the number of object pixels you detect in step 5 roughly converges.


This procedure gives much better results, but with the penalty that it can be quite time consuming because of the repeated object detection and stacking steps. It will still fail in regions where there are no clean sky pixels left after object masking and here the only option is to interpolate between nearby pixels to fill in the gaps. There is a variation on this theme where the algorithm is provided with a mask beforehand. This can be done if the observations are part of a long running project and the mask can be defined by increasingly deeper stacks offline. This method should be quite quick, since the steps above that lead to the creation of the mask (repeated stacking, sky subtraction and object detection) are the main consumers of the computing time. However this approach also implies that any earlier data that were processed using a shallower version of the mask would have to be re-reduced as the mask improves.

Tile method

If the observations are part of a filled tile, as will be the case with the majority of data, then stacking the separate components that make up a tile is significantly faster and generally gives better results than the pawprint methods. If the observations are part of a tile with M pawprints and each pawprint consists of N exposures then we do the combination in two stages. First we form N intermediate sky frames by combining with rejection all of the input images that are in the ith position in each pawprint sequence (where i=1,M). Because each of these are in vastly different places it is very unlikely that there will be much overlap between objects. We then combine the N intermediate background images with rejection to form a final background image.

Sky flipping

In situations where you have a large extended object and that object is roughly the size of a detector it is possible to use a sky flipping observational technique to allow a sky estimate to be done. The basic idea is that the object is placed on a detector and observed for a full jitter sequence. The telescope is then moved to another position so that the object is now in an adjacent detector and another jitter sequence is taken. A background file is made for each jitter sequence using masked pawprint estimation, but skipping the detector where the object has appeared, resulting in two background files, each with one detector missing. For example, if the object was on detector 1 in the first sequence and then on detector 2 for the second, we use the background estimate for detector 1 in the second sky file to correct detector 1 in the first series and we use the background estimate for detector 2 in the first sky file to correct detector 2 in the second series. This method has the advantage that the object of interest is always being observed and the sky estimate is very close temporally (and spatially) to the object exposures.

Offset Sky Observations 

With very large extended sources (i.e. a significant fraction of the field-of- view), the only sensible way to do background correction is with offset sky observations. This is simply done by observing a pawprint, or tile, with the object and then moving the telescope to a point nearby, but far enough away so that contamination by the object or any other large source is not present. This requires no special observing strategy like flipping and only needs a means of associating the two sets of pawprints, or tiles, so that the pipeline knows that they are to be reduced together, using appropriate header keywords. Obviously, both object and sky frames must be observed in the same way (i.e. the same r/o mode, exptime and no. of exposures).