Space Telescope Science Institute
DrizzlePac 2012 Handbook
Table of Contents Previous Next Index Print

The DrizzlePac Handbook > Chapter 6: Reprocessing with the DrizzlePac Package > 6.2 Image Alignment

Flat-field calibrated images from the OTFR pipeline have been updated to incorporate the full distortion model that is stored in SIP header keywords and the updated CD matrix. This was done in the pipeline using the updatewcs task in the STWCS package. For ACS, non-polynomial distortion corrections are stored as FITS extensions that were inserted in the images during pipeline processing by the updatenpol task in DrizzlePac. Images retrieved from the Archive before AstroDrizzle was installed in the pipeline should either be re-retrieved, or processed using updatewcs, and for ACS, also with updatenpol, before running any DrizzlePac tasks.
Images may not be well-aligned for several reasons:
For the most part, commanded and actual telescope dither pointings in a single visit are highly accurate: about two to five milliarcsec. within an orbit, and five to twenty milliarcsec. for contiguous orbits that need guide star reacquisitions within a visit. (However, it is always useful to verify this by measuring the positions of a few objects in the *single_sci.fits images). See Appendix B:HST Pointing Accuracy and Stability
Images taken in different visits typically use different guide stars; since the positions in the guide star catalog have uncertainties as high as 0.2 to 0.5 arcseconds, it is very likely that the WCS from each visit will be misaligned at the same level.
On rare occasions, observations undergo loss-of-lock on guide stars, causing drifts and pointing offsets. A quick check of the keyword QUALITY (with details in the QUALCOM* keywords) in the image header will indicate if this anomaly occurred. If it did, it’s best to discard bad observations and realign those that are still useful.
The ability to get accurate centroids on objects like extended sources, targets obscured by dust, and faint objects with low signal-to-noise
Long exposures that may suffer from blurring due to the changing velocity aberration of the telescope. Neglect of the velocity aberration correction can result in misalignments on the order of a pixel for WFC images taken six months apart for targets near the ecliptic. For further discussion of the effect of velocity aberration see the paper on “The Effect of Velocity Aberration Correction on ACS Image Processing proceedings” from the 2002 HST Calibration Workshop.
The same methods used to align and drizzle small images are also applicable to large mosaics and deep surveys. Every effort has been taken to ensure that drizzle algorithms are structured to provide the fastest computation and memory management. However, the user should consider limitations which exist due to size of the data, and the amount of memory available in the processing computer. Processing large datasets on a 32-bit system will be limited by the OS restrictions for addressing memory, so only two Gb of memory can be used for all the output arrays. This results in a limiting size of about 16000 x 16000 for the combined image, if no context image is generated. This limitation can be avoided by running the AstroDrizzle code on a 64-bit system where the OS can address much larger blocks of memory.
The tweakreg task provides an automated interface for computing residual offsets for a group of flat-field calibrated images (flt.fits, c0m.fits for WFPC2, flc.fits for CTE-corrected ACS images) before they are combined by astrodrizzle.
Images are first aligned based on WCS information in the header. But if the images still remain slightly misaligned, they have residual offsets. This can occur when images are taken in different visits using different guide stars; residual shifts between the visits are due to uncertainties in the guide star positions (as much as 0.2 to 0.5 arcseconds). Smaller-scale residual offsets could also occur during guide star re-acquisitions for observations taken in a multi-orbit visit, (see Appendix B:HST Pointing Accuracy and Stability).
TweakReg is a WCS-based task, not pixel shift-based like MultiDrizzle; for images with residual offsets with respect to a reference image or catalog, WCS information in their headers are modified to “tweak” them to a common WCS with the reference image or catalog. In other words, TweakReg computes residual offsets that are used to update WCS header information in the images to put all images in a common coordinate frame.
Processing Steps Overview
TweakReg performs the following processing steps to determine a fit between each input image and a specified reference WCS:
Using a DAOFIND-like algorithm called ImageFind to detect stellar sources (the default mode)
An image specified by the user–this could be one of the input flt.fits files, perhaps an image that has the most overlap with other images. It could also be a different type of image, from another HST instrument or a different telescope
All source positions for the input flt.fits images, and reference source positions, are converted to X,Y positions in the reference WCS tangent plane using all available distortion corrections
For each input image and reference image pair, the difference in source positions is represented in a two-dimensional histogram, allowing the determination of an initial offset based on the histogram peak in X and Y
Algorithm based on the xyxymatch IRAF task is used to match input source positions and reference image source positions using the initial offset
For each input image, a fit to determine the most accurate offsets is performed on the matched sources lists1; at this point, the user may inspect the fit residuals for each input image, then re-run tweakreg with different parameter values until a satisfactory solution is obtained
When the user is satisfied with the fit, tweakreg can be run a final time, but this time, the software can update input images with WCSs that put all images in the same coordinate frame
A headerlet can also be (optionally) created from the updated input image WCS. More details on what a headerlet is, and how to use it can be found in Section 3.4.
Catalog Matching
A widely utilized method for computing offsets between images begins with identifying sources in each image. For each image, these sources are then matched with those in an overlapping section of the reference image or catalog, allowing offsets to be computed. This technique requires that each image contains recognizable sources, like point sources, that can be accurately identified and positionally measured by the software. There has to be enough overlap in each input-reference image pair so that enough real sources can be identified to calculate accurate offsets. TweakReg creates a catalog of source positions for each input image using an object identification routine similar to daofind. The user also has the option to provide his or her own source position catalogs for each input chip.
Input files can be passed to tweakreg in several forms:
An ASCII text file containing a list of input images, one per line, where the prefix "@" is specified before the file (i.e., @file_list)
When comparing the input images, the TweakReg software defines the reference frame either by:
The refimage parameter in tweakreg specifies the reference image from which the reference catalog was derived. This parameter allows the user to specify a reference image with a specific WCS solution that will define the coordinate frame to which all other input images will be transformed. If no reference image is designated in the refimage parameter, tweakreg will, by default, use the first image in the list of input images.
The source finding algorithm built into TweakReg has been optimized for point sources. The algorithm used to center on each source in the image works best with properly sampled PSFs, although it will work fairly well on the most strongly undersampled detectors on HST:WFPC2, NIC3, and WFC3/IR. 
In Figure 6.1, the apparent positions of stars in two WFC3/IR images (iabf01bxq and iabf01ckq), which have been offset by a simple shift along the detector X axis of 24 arcseconds, exhibit some very systematic residuals of up to +/- 0.1 pixels. These residuals arise because typical centroiding and PSF-fitting applications tend to move the position of a star in an undersampled detector towards the center of the pixel in which the star is brightest. In order to avoid this bias, one must explicitly take the undersampling of the detector into account. One method for doing this is the ePSF (effective PSF) method of Anderson and King (2006). Figure 6.2 shows the residuals from the alignment of the same stars; in this case, instead of using the native position-finding algorithm in TweakReg, the star positions supplied to TweakReg were created by running the ePSF algorithm by Anderson and King.
At present the ePSF method is not included as part of the DrizzlePac software.   However, it may be part of a future release, as an option in TweakReg (at a minimum for WFC3/IR). Nonetheless, the effect of not including the ePSF correction does not substantially bias the final fit as the oscillations one sees largely average out. The difference in the solutions with and without the ePSF correction is a shift of ~0.015 pixels.
Figure 6.1: Residuals from Aligning Two WFC3/IR Images Using tweakreg Source-Finding Algorithm
Figure 6.2: Residuals from Aligning two WFC3/IR Images with tweakreg Using Positions Determined with the ePSF Method

A matched sources list is a list of common sources found in an input image and the reference image or catalog.

Table of Contents Previous Next Index Print