4.2 How Distortions are Represented in AstroDrizzle

Design

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 Coefficients Table (named in the FITS header keyword IDCTAB).

Astrometric calculations by MultiDrizzle used 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/WFC. 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 files are 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 filter dependent part distortion correction) and D2IMFILE (Pixel-grid irregularities distortion -  Detector to Image distortion correction). The NPOLFILE reference file is a 2-D table unique for each HST filter and is presented as residuals from high-order polynomial distortion corrections. The D2IMFILE reference file is also a 2-D look-up table which is corrected for pixel-grid irregularities due to the manufacturing process in ACS/WFC images, and for the lithographic-mask pattern in the WFC3/UVIS chips.

During the HST pipeline processing of images that require 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.

Three major forms of distortion corrections are implemented in AstroDrizzle.

  1. Linear distortion corrections:  scale, rotation, and time-dependent skew (in the case of ACS/WFC, see ACS ISR 2015-06) are incorporated into the CD matrix.
  2. Higher order polynomial corrections are stored as SIP coefficients in the image header.
  3. Additional non-polynomial distortion corrections:
    • Non-optical detector variations - pixel-grid irregularities;
    • Residual distortion corrections for filter-dependent part of distortion 

The implementation of distortion corrections to an image works in the following way:

  1. Apply the detector pixel-grid irregularities (D2IMFILE) to image raw pixel values;   

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

  3. Combine the filter-dependent part of distortion as look-up table correction (NPOLFILE) with D2IMFILE+SIP corrected pixel values.

  4. Apply the WCS transformation in the CD matrix to the summed results to get intermediate world coordinates.
  5. Add the Right Ascension and Declination position at the reference pixel, CRVAL1 and CRVAL1 keyword values, to the transformed positions to get the positions on the tangent plate.
  6. Apply the inverse projection from the tangent plane to the celestial sphere to get the true world coordinates.

All these transformations can be conceptualized as:

(u,v) = D2IM(x,y)

where 2-D corrections applied to raw x,y pixel using the D2IM convention produces the coordinates (u,v).

In the pipeline, this correction is only done for ACS/WFC and WFC3/UVIS  data using the detector correction table stored in FITS image extension type D2IMARR. Other ACS detectors, and WFC3/IR detector do not require the D2IMARR correction, therefore,

\begin{bmatrix} u' \\ v' \end{bmatrix} = \begin{bmatrix} u - CRPIX1 \\ v - CRPIX2 \end{bmatrix}

  where u',v' are the D2IM-corrected coordinates relative to CRPIX1,CRPIX2 - the reference pixel in X and Y coordinates.

\begin{bmatrix} \alpha \\ \delta \end{bmatrix} = \Bigg( \begin{bmatrix} CRVAL1 \\ CRVAL2 \end{bmatrix} +P^{-1}\Bigg[ \begin{bmatrix} CD1\_1\,\,\,CD1\_2 \\ CD2\_1\,\,\,CD2\_2 \end{bmatrix} \begin{bmatrix} u'+f(u', v')+LT_x(x',y') \\ v'+g(u',v')+LT_y(x',y') \end{bmatrix} \Bigg] \Bigg)

where,

  • is the source position on the celestial sphere
  • CRVAL1CRVAL2 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 in X and Y and angle of rotation
  • LTx, LTy are the filter-dependent distortion corrections in 2-D look-up reference tables that are appended to the image as FITS extensions using the Paper IV look-up table convention 
  • 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 as


f(u',v')=\sum\limits_{p+q=2}^{AORDER}A_{pq}u'^pv'^q
g(u',v')=\sum\limits_{p+q=2}^{BORDER}B_{pq}u'^pv'^q


The 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.

World Coordinate System

Definition

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
  • CTYPE1: the coordinate type for the first axis, value is RA---TAN-SIP
  • CTYPE2: the coordinate type for the second axis, value is DEC--TAN-SIP

The 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_1 is the partial of first axis coordinate w.r.t. x

  • 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. y

Type of tangent plane projection used for distortion correction polynomial coefficients.

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

Computation

These keyword values get computed using the operations:

The plate scale (scale) represents the average plate scale (in arcseconds) for the reference pixel after removing all distortion.

The value of the θ angle is calculated 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 and/or WFC3 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 orientation, 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 4.3.

The right ascension  and declination 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.

Velocity Aberration

The velocity aberration for each exposure is reported as the VAFACTOR keyword value, computed as a fractional scale change induced both by the velocity of HST as it orbits the Earth and the velocity of the Earth+HST as they orbit the sun. The VAFACTOR keyword has values near 1 (one) and represent the change in plate scale for the image. Over a one orbit period the scale can vary by as much as 5 parts in 100,000. Across a long diagonal of the ACS field of view, this amounts to about 0.3 pixels which is sufficient to degrade the registration needed for cosmic ray rejection in CR-SPLIT exposures. Images taken six months apart could have scale differences as large as 12 parts in 100,000 leading to misregistrations up to 1.4 pixels. More details on this calibration can be found in the 2002 HST Calibration Workshop proceedings paper: “The Effect of Velocity Aberration on ACS Image Processing”.

The CD matrix is multiplied by the VAFACTOR to represent the actual pixel scale on the sky for each exposure. The full distortion solution including velocity aberration correction is applied by the pipeline software via the updatewcs task, which is run prior to AstroDrizzle processing in order to update all of the distortion terms with their most up-to-date values. 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, described in Section 4.2.3.

The Simple Image Polynomial (SIP) Convention

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:

\begin{bmatrix} \beta \\ \Upsilon \end{bmatrix} = \begin{bmatrix} CD1\_1\,\,\,CD1\_2 \\ CD2\_1\,\,\,CD2\_2 \end{bmatrix} \begin{bmatrix} i+f(i,j) \\ j+g(i,j) \end{bmatrix}

where,

  • β and Y 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
  • and j are image pixels relative to a chosen origin (CRPIX1, CRPIX2) on the detector

 
Coefficients for the non-linear polynomial terms ip jq 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:

f(i,j)=\sum\limits_{p,q}A\_p\_qi^pj^q\,\,\,\,\mathrm{where}\,\,\,\,(p+q)\leq A\_ORDER
g(i,j)=\sum\limits_{p,q}B\_p\_qi^pj^q\,\,\,\,\mathrm{where}\,\,\,\,(p+q)\leq B\_ORDER

where A_ORDER and B_ORDER are keywords reporting the order of the polynomial used for the model.

In the astrometric expression shown above, all linear components–scale, rotation 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 CRVAL1CRVAL2, and the CD matrix.

Non-Polynomial Distortions

Image extensions containing non-polynomial distortions corrections are applied 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. 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). The full description of the non-polynomial distortions correction for ACS/WFC images is given in ACS ISR 2015-06 and for WFC3/UVIS images in WFC3 ISR 2014-12.

For the prior generation of software (MultiDrizzle), non-polynomial corrections (residual distortion corrections and detector column or row offset corrections) were represented by the 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 data for the WFC, HRC, and SBC detectors.

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 which is only applied to ACS/WFC and WFC3/UVIS images in the pipeline. Those corrections are represented here as DET2IM
(x',y')=\mathrm{\tt DET2IM}(x,y)

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

\begin{bmatrix} u' \\ v' \end{bmatrix} = \begin{bmatrix} x'-CRPIX1 \\ y'-CRPIX2 \end{bmatrix}

3. These relative positions are then used in the SIP equation, along with another look-up table, LT, containing corrections for non-optical distortions that cannot be easily represented by a polynomial. With these changes the basic SIP equation becomes:

\begin{bmatrix} \beta \\ \Upsilon \end{bmatrix} = \begin{bmatrix} CD1\_1\,\,\,CD1\_2 \\ CD2\_1\,\,\,CD2\_2 \end{bmatrix} \begin{bmatrix} u'+f(u',v')+LT_x(x',y') \\ v'+g(u',v')+LT_y(x',y') \end{bmatrix}

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.

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 CRVAL1CRVAL2 and the actual sky positions at CRPIX1CRPIX2. For ACS/WFC and WFC3/UVIS, this offset is in the order of  ~0.1 pixel. Finally, it is 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.

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