Space Telescope Science Institute |

DrizzlePac 2012 Handbook |

help@stsci.edu |

The DrizzlePac Handbook > Chapter 3: Astrometric Information in the Header > 3.2 How Distortions are Represented in AstroDrizzle

The best information about instrument aperture locations and orientations, pixel scales, and the image distortion correction model is contained in a HST reference file called the Instrument Distortion Correction reference table (named in the FITS header keyword IDCTAB).Astrometric calculations by MultiDrizzle use distortion correction information in the IDCTAB and DGEOFILE reference files, as well as information in the image header about telescope orientation, spacecraft velocity vector for velocity aberration correction, and date of observation to determine time-dependent skew in ACS. Even though SIP keywords were present in image headers from the previous HST Archive pipeline, actual astrometric calculations were done using the IDCTAB and DGEOFILE reference files.With AstroDrizzle in the calibration pipeline, the IDCTAB reference file is now only used in the HST Archive pipeline to create and populate SIP header keywords in images.Non-polynomial distortion correction information, previously supplied by the DGEOFILE reference file, are now contained in two new reference files given by the image header keywords NPOLFILE (Non-POLynomial distortion correction) and D2IMFILE (Detector to IMage distortion correction). The NPOLFILE reference file contains tabular information about residual distortion corrections for some instrument modes. The D2IMFILE reference file contains column (or row) width corrections for some instrument chips. During pipeline processing of images that require non-polynomial distortion corrections, the relevant information is obtained from these reference files and stored as new FITS extensions in the image data. A more detailed description is provided later in this section.

1. Linear distortion corrections–scale, rotation, and time-dependent skew–are incorporated into the CD matrix.

2. Non-linear distortion corrections expressed as simple image polynomial (SIP) quadratic functions.

1. Apply the detector to image correction (DET2IM) calibration step to input pixel values.

2. Apply the SIP coefficients to DET2IM-corrected pixel values.

3. Apply the non-polynomial look-up table corrections to DET2IM-corrected pixel values.

5. Apply the WCS transformation in the CD matrix to the summed results to get intermediate world coordinates.

6. Add the Right Ascension and Declination position at the reference pixel, CRVAL1 and CRVAL2 keyword values, to the transformed positions to get the positions on the tangent plate.

7. Apply the inverse projection from the tangent plane to the celestial sphere to get the true world coordinates.where column corrections applied to initial coordinates (x,y) using the DET2IM convention produces the coordinates (u,v).In the OTFR pipeline, this correction is only done for ACS/WFC data using the detector correction table stored in FITS image extension type D2IMARR. Other ACS detectors, and all WFC3 detectors do not require the D2IMARR correction, therefore,u = x and v = y.

• CRVAL1, CRVAL2 are the Right Ascension and Declination position of the reference pixel

• CD1_1, CD1_2, CD2_1, CD2_2 are CD matrix keyword values describing linear distortions: plate scale, rotation, and skew of the image

•

• P−1 is the de-projection of the tangent plane back onto the celestial sphere

• f(u',v') and g(u',v') represent the polynomial distortion correction specified asThe type of tangent plane projection used in the creation of the distortion correction polynomial coefficients is described by the CTYPE1 and CTYPE2 header keywords. For AstroDrizzled data, their values are RA---TAN-SIP and DEC--TAN-SIP, respectively.

3.2.2 Astrometric information in FITS images (in the form of World Coordinate System or WCS) is stored in image headers using a standard set of keywords:

• CRVAL1: right ascension (α) at a reference pixel

• CRVAL2: declination (δ) at a reference pixel

• CRPIX1: the x location of the image reference pixel

• CRPIX2: the y location of the image reference pixel

• CTYPE2: the coordinate type for the second axis, value is DEC--TAN-SIPThe CD matrix is defined by the partial derivatives of the world coordinates with respect to the pixel coordinates as evaluated at the reference pixel. Its keywords are:

•

• CD1_2 is the partial of first axis coordinate w.r.t. y

• CD2_1 is the partial of second axis coordinate w.r.t. x

• CD2_2 is the partial of second axis coordinate w.r.t. yThe plate scale, scale, represents the average plate scale (in decimal degrees) for the reference pixel after removing all distortion.The value of originates from the PA_V3 keyword; this is the angle eastward from North to the telescope's V3 axis. However, the CD matrix describes a tangent plane projection, and PA_V3 describes the orientation of the telescope at the center of its field of view. Therefore, the orientation at the reference position for the image needs to be computed by projecting the PA_V3 orientation onto the detector coordinate system.The orientation of the Y axis at the center of the instrument's field of view is then computed relative to the -V3 axis to obtain the value of the PA_APER keyword. This step takes into account the orientation of the detector's axes relative to the V2-V3 coordinate system. Take for example, the 45 degree rotation of the WFPC2 field of view relative to the V2-V3 axes; the orientation for each chip's reference position, , gets computed by projecting the tangent plane for the full field of view with an orientation of PA_APER onto each chip's reference point. The orientation of this tangent plane at each chip's reference point is recorded in the ORIENTAT keyword.A10, A11, B10, B11 refer to the linear terms of the distortion model as defined in the polynomial stored in the IDC table (IDCTAB) reference file. These terms represent the skew, change in orientation, and plate scale in X and Y at the reference pixel of the image only. More information about geometric distortion and SIP keywords is available in Section 3.3.The right ascension (R.A.) and declination (Dec.) of the image target is stored in the image header keywords RA_TARG and DEC_TARG. These values are, however, the same for all images in a dithered set since the target itself is not changing. However, the R.A. and Dec. values (CRVAL1, CRVAL2) at the image reference pixel (CRPIX1, CRPIX2) will always be unique for each image. Therefore, the offset between the images (x and y shift) can be determined by retrieving the values of the associated reference pixel keywords.The velocity aberration for each exposure gets reported as the VAFACTOR keyword value, computed as a fractional scale change induced by the velocity of the telescope during the observation. This keyword has values near 1 and represent the change in plate scale for the image. The CD matrix simply gets multiplied by this term to correctly represent the actual pixel scale on the sky for this specific exposure. Application of the velocity aberration is performed when the WCS gets recomputed by AstroDrizzle to include all the distortion terms–this is done by setting a parameter to execute the updatewcs task in astrodrizzle. More detailed information about velocity aberration can be found in Appendix A:Plate Scales and Polynomial Distortions.World Coordinate System Information contained in the header of each image is as accurate as the guide star catalog information used for pointing the telescope, as well as the level of focal plane alignment errors, which evolve over time. Typical accuracy of the Guide Star Catalog 1 (GSC1) was about 1 arcsecond. GSC1 was the operational catalog until mid-2006 (cycle 14/15 boundary). As a result of this catalog accuracy, combined with focal plane evolution seen during this era, observations taken of the same field at different orientations with different guide stars could see offsets of a couple of arcseconds. From cycle 15 onwards, GSC2, with positional errors of ~0.25 arcseconds (1 ) has been the operational catalog. A more stable focal plane, with calibration errors kept below this level has meant that since this time, offsets of the same target at different rolls and guide stars have typically been ~0.3 to 0.5 arcseconds.Users may choose to calculate offsets due to different visits to align their images more accurately, then incorporate those shifts into WCS information in the image headers. This facilitates proper translation of pixel to sky coordinates for science analysis of the images, based on the WCS of a reference image, and stores the offset information for each image in the header for future alignment reference.It's also important to update WCS keywords in the image header based on distortion correction solutions (such as geometric distortion and velocity aberration) applied to the data during drizzling. The full distortion solution including velocity aberration correction is applied by the AstroDrizzle code-set using of the makewcs task. Primary keywords affected are the CD matrix keywords; namely, CD1_1, CD1_2, CD2_1, and CD2_2. These keywords not only contain the plate scale and orientation at a reference pixel, but also linear terms of all distortion corrections. Higher order terms of the distortion model are reported in the remainder of the SIP keywords. Users who wish to apply their own distortion corrections should be careful to update these keywords.In using the SIP convention (Shupe et al., 2005), pixel coordinates are transformed to sky coordinates using the CD matrix as specified in the header of the image. The CD matrix includes linear terms of the distortion model: skew, rotation, and scaling. Non-linear terms, defined as polynomial functions f(i,j) and g(i,j), are applied using the following transformation:

• and are intermediate world coordinates represented in degrees with its origin at (CRVAL1,CRVAL2) on the sky

• CD1_1, CD1_2, CD2_1, CD2_2 are CD matrix keyword values describing linear distortions applied to plate scale, rotation, and skew of the image

• f and g are simple image polynomial (SIP) functions

• Coefficients for the non-linear polynomial terms ipjq are recorded in the image header using the keyword naming convention A_p_q and B_p_q. The polynomial functions for use in the transformation can, therefore, be expressed as:In the astrometric expression shown above, all linear components–scale, rotation, and skew–are incorporated into the CD matrix. Therefore, the simple image polynomials (SIP) have no terms lower than the quadratic; this is a change from the previous representation in HST data where linear terms were included in the distortion polynomial. In other words, simple image polynomials (SIP) represent deviations from a standard tangent plane described by CRVAL1, CRVAL2, and the CD matrix.Image extensions containing non-polynomial distortion corrections are created in the pipeline by AstroDrizzle, and are included in the data that's delivered from the HST Archive to users. These tables were created using information extracted from the NPOLFILE (Non-POLynomial) and D2IMFILE (Detector to IMage) calibration reference files.At present, WFC3 data does not require non-polynomial distortion corrections. The CD matrix and SIP provide distortion corrections that are good to 0.1 pixels (with a root mean square error significantly smaller than that value).In some cases, however, distortion corrections using SIP and the CD matrix can be improved with additional non-polynomial distortion corrections. For example, a low order (4th order) SIP distortion solution for ACS/WFC is only good to a couple of tenths of a pixel and requires additional distortion terms for a more accurate geometric distortion correction. For ACS detectors, Anderson, et al. (Calibration Workshop 2002 and ACS ISR 2004-15), represented these as non-polynomial corrections in the form of look-up tables.For some instruments, there are small offsets in the physical positions of columns or rows in chips. ACS WFC CCD's have column offsets due to the placement of the lithograph used in creating the chips. (There's no offsets in the other ACS detectors and in WFC3. For information about other instruments, please refer to the MultiDrizzle Handbook.)For MultiDrizzle, non-polynomial corrections (residual distortion corrections and detector column or row offset corrections) were represented by DGEOFILE (differential geometry) reference images: each chip had one full-frame image representing higher order offsets in x, and another full-frame image representing higher order offsets in y. These non-polynomial corrections were applied to ACS's WFC, HRC, and SBC data.Instead of using DGEOFILE reference images, AstroDrizzle returns to the look-up table approach, implementing distortion corrections in the following stages:

1. The chip position is corrected for detector errors (currently only applied to ACS/WFC images in the pipeline). Those corrections are represented here as DET2IM^{3}

2. The position of the coordinates are determined relative to the fiducial point of the field (CRPIX1, CRPIX2):

3. These relative positions are then used in the SIP equation, along with another look-up table, LT, containing corrections for optical distortions that cannot be easily represented by a polynomial^{4}. With these changes the basic SIP equation becomes:All look-up tables used in AstroDrizzle follow the proposed Paper IV FITS convention. This enables the storage of look-up tables in image extensions needed for computing tabular interpolations.The definition of the look-up tables used here has the potential to create a small offset between the position stated in the header keywords CRVAL1, CRVAL2 and the actual sky positions at CRPIX1, CRPIX2. For ACS WFC, this offset is of order one to two hundredths of a pixel. Finally, it's worth noting that the SIP convention makes the reference pixel CRPIX1, CRPIX2 a special location on the chip; it is the reference position of the distortion solution. If one defines the look-up tables to have zero shift at that same reference position, then this offset disappears. Unfortunately, it cannot be implemented for the ACS without producing a small relative offset of the WFC chips.MultiDrizzle uses the DGEOFILE reference files for applying non-polynomial distortion corrections. There are two full-chip size image extensions in the DGEOFILE reference file for each instrument detector chip; one extension contains residuals of the polynomial fit in x, and the other contains residuals of the polynomial fit in y. For example, the DGEOFILE reference file for ACS/WFC has four extensions, each of them with dimensions 4096 x 2048 pixels: extension 1 contains residuals of the polynomial fit in x chip 2; extension 2 has residuals of the polynomial fit in y for chip 2; extension 3 contains residuals of the polynomial fit in x for chip 1; extension 4 contains residuals of the polynomial fit in y for chip1.As outlined in Anderson, 2002, residuals of the polynomial fit were originally modeled by sampling every 64 pixels in the WFC, creating a 65 × 33 table for each chip. For the HRC, it was every 16 pixels sampled and modeled to create a 65 × 65 table. The value of a residual distortion at any point on the chip is determined by interpolation. These tables were used to create a full-chip distortion “image,” the DGEOFILE reference image, for each camera.Because of the coordinate transformations, and the many steps involved in creating DGEOFILE files, it was not possible to start with the original tables. Therefore, a new version of the distortion tables were created for use by AstroDrizzle, done by subtracting the column width corrections from the DGEOFILE reference file, then sampling each full chip size DGEOFILE reference file extension to re-create the look-up tables. Tests have showed a near one-to-one match with the original images.In MultiDrizzle, non-polynomial distortion corrections were applied after implementing distortion corrections described by polynomial functions (that have coefficient values stored in the IDCTAB reference file). As a result, non-polynomial distortion corrections in the DGEOFILE reference file also included linear distortion corrections.For AstroDrizzle, in accord with the SIP convention, those linear distortion corrections applied to scale, rotation, and skew are now incorporated in the CD matrix; this portion of the transformation from distortion-corrected coordinates to sky coordinates is performed in the final step. Therefore, residual distortion tables in the NPOLFILE reference file, that were extracted from the DGEOFILE reference file as described earlier, must be corrected with the inverse of the CD matrix so that linear distortion corrections are not applied twice. This is done in the pipeline when the stwcs.updatewcs task performs the correction for each extension of the NPOLFILE reference file (that contains the tabular form of the residual distortions).Look-up tables containing residual distortion corrections for an image are derived from the NPOLFILE reference files and saved as separate FITS image extensions of type WCSDVARR in the science image.In a later processing step, software that performs coordinate transformations will use bilinear interpolation to calculate the value of the distortion at each pixel location in the image array.To fully map the image array to the distortion array, the standard WCS header keywords CRPIXj, CRVALj and CDELTj are used, where j denotes the axis. The mapping follows the transformation

• im refers to the image array

• dist is the distortion array

• p is the pixel

•

•

• CDELTj_dist is the spacing interval between pixels in the image array that map to consecutive pixels in the distortion arrayIn general CDELTj_dist can have a non-integer value, but cannot be zero. However, if the distortion array is obtained as a sub-image of a larger array, having a non-integer step size can produce undesirable results during interpolation.

• Every point in the corrected image is mapped to only one point in the uncorrected image (injective)

• Every point in the corrected image corresponds to at least one point on the uncorrected image (surjective)In other words, a look-up table acts as a function to describe a one-to-one relationship between each point in the distortion-corrected image with a unique counterpart point in the uncorrected image, such that both images are invertible by their look-up table.This one-to-one (non-extrapolation) requirement can have implications on the geometry of the distortion array. If the distortion array is obtained as a subimage or subsample of a larger array, it is important that the edges of the distortion array coincide with the edges of the image.The other element of the non-polynomial distortion correction is the fixed column width correction (for ACS/WFC). It's applied at the very start of the distortion correction process so that column width-corrected coordinates are used as input to the polynomial and non-polynomial distortion corrections. The adopted implementation is based on the FITS Paper IV look-up table convention.u,v are the initial coordinates x,y with the column correction applied (the DET2IM calibration step). At this time, the correction is only applied to ACS/WFC data. For detectors that do not need this correction, u=x and v=y.For ACS/WFC, a new reference file, given by the header keyword D2IMFILE, was created. It contains a one-dimensional array of column width corrections. In the pipeline, this correction table gets attached to the image as a FITS extension of type D2IMARR. Each element in the D2IMARR array specifies the correction (in units of pixels) for every pixel in the column of both science image extensions.This kind of detector-to-image correction could be extended to an arbitrary number of chips and extensions for other instruments and detectors. The extension headers would contain keywords about the implementation of the corrections. The keyword AXISCORR, for instance, indicates if the distortion corrections are applied to columns or rows. For ACS/WFC, the CDELT1 keyword was set to “1” which indicated that no distortion correction interpolations were done.

The “partial” refers to the change in coordinate value (R.A. or Dec.) along an axis (x or y), at the reference pixel.

The information is obtained, during pipeline processing, from the D2IMFILE (detector-to-image look-up) reference file, and stored as a FITS extension in the image file.

These non-polynomial corrections were obtained from the NPOLFILE (Non-POLynomial distortion correction) reference file during pipeline processing, and stored in the image as FITS extensions.