4.3 Distortion Information in Pipeline Calibrated Images

Image Structure

ACS and WFC3 images retrieved from the HST Archive are calibrated using the best available calibration file, including latest available distortion correction models. 

Calibrated science images from the HST Archive, with the suffix (flt.fits, flc.fits), have undergone standard image reductions including flat fielding, but have not been corrected for geometric distortion. After the data calibration step in the pipeline, calibrated images are processed by AstroDrizzle to produce drizzled images that are corrected for geometric distortion. If several images are part of an association, the images are drizzle-combined using pre-defined AstroDrizzle settings for each instrument stored in a reference file called the 'MDRIZTAB' (*mdz.fits).

 
As described in the previous section, WCS information in calibrated images is updated by AstroDrizzle in the pipeline to include the full distortion correction model:

  • 2-D corrections for ACS/WFC and WFC3/UVIS pixel-grid irregularities with D2IMFILE reference files, appended to the science image as FITS extensions of D2IMARR type
  • Scale, rotation, and time-dependent skew (in the case of ACS/WFC) linear corrections are incorporated in the CD matrix.
  • Distortion correction polynomial function orders and coefficients from the IDCTAB are recorded as keyword values in the image header.
  • Optionally the NPOLFILE  reference file is also appended to the science image as new FITS extensions of WCSDVARR type


The Table below shows the new structure of an ACS/WFC image. similar structure is also for any ACS/WFC images)

>>>from astropy.io import fits
>>>fits.info('j6d508ojq_flc.fits')
 
Filename: j6d508ojq_flc.fits
No.    Name      Ver    Type      Cards   Dimensions   Format
  0  PRIMARY       1 PrimaryHDU     279   ()     
  1  SCI           1 ImageHDU       361   (4096, 2048)   float32  
  2  ERR           1 ImageHDU        57   (4096, 2048)   float32  
  3  DQ            1 ImageHDU        49   (4096, 2048)   int16  
  4  SCI           2 ImageHDU       349   (4096, 2048)   float32  
  5  ERR           2 ImageHDU        57   (4096, 2048)   float32  
  6  DQ            2 ImageHDU        49   (4096, 2048)   int16  
  7  HDRLET        1 HeaderletHDU    18   ()     
  8  HDRLET        2 HeaderletHDU    26   ()     
  9  HDRLET        3 HeaderletHDU    26   ()     
 10  HDRLET        4 HeaderletHDU    26   ()     
 11  HDRLET        5 HeaderletHDU    26   ()     
 12  HDRLET        6 HeaderletHDU    26   ()     
 13  WCSCORR       1 BinTableHDU     59   18R x 24C   [40A, I, A, 24A, 24A, 24A, 24A, D, D, D, D, D, D, D, D, 24A, 24A, D, D, D, D, J, 40A,  128A]  
 14  HDRLET        7 HeaderletHDU    26   ()     
 15  HDRLET        8 HeaderletHDU    26   ()     
 16  HDRLET        9 HeaderletHDU    26   ()     
 17  HDRLET       10 HeaderletHDU    26   ()     
 18  WCSDVARR      1 ImageHDU        15   (64, 32)   float32  
 19  WCSDVARR      2 ImageHDU        15   (64, 32)   float32  
 20  D2IMARR       1 ImageHDU        15   (64, 32)   float32  
 21  D2IMARR       2 ImageHDU        15   (64, 32)   float32  
 22  WCSDVARR      3 ImageHDU        15   (64, 32)   float32  
 23  WCSDVARR      4 ImageHDU        15   (64, 32)   float32  
 24  D2IMARR       3 ImageHDU        15   (64, 32)   float32  
 25  D2IMARR       4 ImageHDU        15   (64, 32)   float32

Keywords

Naming a Polynomial Distortion Solution

Polynomial distortion models for all HST images, which are used as the primary source of distortion information, are presented in the image headers using the SIP convention.

Some instrument modes, however, require additional distortion corrections. During pipeline processing, distortion correction information is obtained from reference files and stored in images as FITS extensions. For data processed in the pipeline, only ACS/WFC and WFC3/UVIS images require residual optical distortion corrections, stored in the image files as FITS extensions of D2IMARR and WCSDVAR type.

The name for a specific polynomial distortion model is recorded in the primary header of each image in a new keyword called SIPNAME. In the pipeline, the default distortion model is named after the image's rootname and its IDCTAB reference file. A name can also be assigned to this keyword by the user during post-pipeline processing. A value of 'N/A' or a blank string indicates that no SIP model was provided or applied. A value of UNKNOWN means that there's a SIP model but no record of the model's origin.

A unique description of the full distortion model is summarized in a new keyword called DISTNAME, in the primary header of the image file. The value for this keyword is a string comprised of the names of all distortion model components used for the image, described by the keywords SIPNAMENPOLFILE, and D2IMFILE. A value of UNKNOWN is used if a distortion model was applied but the keyword values for SIPNAMENPOLFILE, and D2IMFILE are not provided

In the example below, python is used to query the header keywords SIPNAME, IDCTAB, NPOLFILE, and D2IMFILE for an ACS/WFC image.

The DISTNAME keyword is also shown to illustrated naming nomenclature for the keyword value (eg. ROOTNAME_IDCTAB_NPOL_D2IM):

>>>from astropy.io.fits import getheader
>>>hdr=getheader('j6d508ojq_flc.fits',0)
>>>print([hdr[i] for i in ['SIPNAME', 'IDCTAB', 'NPOLFILE', 'D2IMFILE', 'DISTNAME']])


('j6d508ojq_0461802ej', 'jref$0461802ej_idc.fits', 'jref$02c1450pj_npl.fits', 'jref$02c1450oj_d2i.fits', 'j6d508ojq_0461802ej-02c1450pj-02c1450oj')

>>>from astropy.io.fits import getheader
>>hdr=getheader('j6d508ojq_flc.fits',0)
keynames=['sipname','idctab']
[print(f'{name}:{hdr[name]}') for name in keynames]

Similar for any ACS/WFC image but with different name of the reference files.

This effort to include distortion information in science images requires the use of multiple FITS conventions (proposed and improved) to support the full range of calibration distortion models used for HST data. The approved SIP Convention is used for describing polynomial terms of the distortion correction, while the proposed Paper IV FITS convention is used for NPOLFILE and D2IMFILE distortion corrections.

SIP Convention Keywords

IDCTAB reference files are used  in the pipeline to populate science header keyword values that describe polynomial models as coefficients. A prime example is the implementation of SIP (a registered FITS convention) in the STScI_Python package stwcs (which relies on the FITS standard C package wcstools). The reliance on published or proposed FITS standards allows these updated HST headers to be understood by other standard astronomy-related tools such as the image display software DS9.

The keywords used for the SIP standard are shown in the table below. 

Table 4.1: Standard SIP Keywords Keyword 

Keyword

Definition

CTYPE1, CTYPE2

The type of tangent plane projection used in the creation of the distortion.

CD1_1, CD1_2, CD2_1, CD2_2

Linear terms of distortion: scale, rotation, and skew. These are CD matrix keywords

A_ORDER, B_ORDER

Order for distortion polynomials, along axis 1 and axis 2 respectively.

A_p_q, B_p_q

High order coefficients for X-axis and Y-axis, respectively.

For A_p_q, (p + q) ≤ A_ORDER ; for B_p_q, (p + q) ≤ B_ORDER

Excerpts from an ACS/WFC image header illustrate how distortion correction-related keywords, including standard SIP keywords, are presented:

World Coordinate System and Related Parameters

Additional information:

  • OCX10, OCX11, OCY10, OCY11 are linear distortion terms without image scale, directly from the distortion model in the IDCTAB reference file.
  • IDCSCALE is the pixel scale from the IDCTAB reference file.
  • IDCTHETA is the orientation of the detector's y-axis relative to the V3 axis, as derived from the IDCTAB reference file.
  • IDCV2REF, IDCV3REF are the reference pixel's V2 and V3 positions, respectively, as derived from the IDCTAB reference file.
  • IDCXREF, IDCYREF are the reference pixel location in x and y as specified in the IDCTAB.

Time-Dependent distortion in ACS/WFC and its keywords

The linear terms of the ACS/WFC geometric distortion is changing with time as it described in ACS ISR-2015-06, which is hard coded now in the new DrizzlePac as follows:

           OCX11´ = OCX11 − TDD_CXB1  × (TIME − RDATE)
           OCY11´ = OCY11 − TDD_CTB1   × (TIME − RDATE)

 where OCX11 and OCY11 are averaged linear coefficients in IDCTAB formalism and correspond to scale in X and rotation in Y respectively for  each CCD chip, WFC1 and WFC2.  

The  linear time-dependency TDD_CXB11, TDD_CTB1  and RDATE (2004.5 and 2012.0 before and after SM4) are kept in the primary header of the IDCTAB which are:

TDD_DATE=               2012.0

TDD_CTB1=     1.6597930806E-06 / Y-rotation cy_11

TDD_CTB2=     1.5787128139E-06 / Y-rotation cy_11

TDD_CXB1=    -1.0217767093E-06 / X-scale cx_11

TDD_CXB2=    -1.0658206323E-06 / X-scale cx_11

Since the plate-scale and the parameters of the linear time–dependent distortion are slightly different before and after SM4, two IDCTAB (before and after SM4) are provided to the user and to the HST data-base reference system to be used in DrizzlePac and the HST pipe-line. The SIP convention presented by the CD matrix of the linear terms of distortion is convenient to apply the time-dependent of the linear terms for each chip.

Note that the prior distortion functions operate on pixel coordinates (i.e., p rather than p− r), and that the independent variables of the distortion functions are the uncorrected pixel or intermediate pixel coordinates. That is, for example, we do not allow the possibility of q3′= q3 + δq3(q1′, q2′)

Detector to Image Correction

The fixed column width correction, required only for ACS/WFC is applied at the very start of the distortion correction process. Its applied to flt.fits, flc.fits  pixel positions, and the output positions are then used for computing the polynomial and other non-polynomial distortion corrections. The adopted implementation for describing this detector-to-image correction in the header, and how to apply it to the coordinates, is based on the Paper IV Look-up Table convention. It is assumed that the detector to image correction is the same for all chips, so only one look-up table needs to be specified and appended as a new FITS extension.

For ACS/WFC, the correction is a one-dimensional image extension of type D2IMARR . Each element in the row represents the correction for every pixel in the column of the science extension. The following new keywords for this correction have been added to the science image's header.

Table 4.3: Standard Detector Distortion Correction Keywords

KeywordDefinition

D2IMFILE

Name of reference file to be used for creating the look-up table. The task updatewcs creates an image extension of type D2IMARR, and populates it with column distortion information from this reference file.

D2IMERR1,2

 Maximum value of the correction for axis 1,2

Drizzled  Products

AstroDrizzle's primary product is a multi-extension FITS file with the suffix either drz.fits, drc.fits. The first extension contains the science (SCI) image which is corrected for distortion and, if applicable, dither-combined or mosaiced. The drizzled SCI image extension is typically in units of electrons per second which is the default for ACS and WFC3 images. (A user can choose to have the output in either electrons or electrons per second.) All image pixels have equal area on the sky and equal photometric normalization across the field of view, giving an image that is both photometrically and astrometricaly accurate for point sources and extended sources. The dimensions of the output image are computed automatically by AstroDrizzle, and the default output plate scale value is given by the header keyword IDCSCALE (its value obtained from the IDCTAB reference file during pipeline processing).

The default set of astrodrizzle parameters defined for each instrument may be changed by the user during post-pipeline reprocessing to best suit the actual data and user's needs. The WCS information for the science image of the drizzle product no longer contains any keywords related to distortion, as those models were removed from each input prior to being included in this combined image. Only the basic sky transformation is written to the drizzled science image header to reflect the uniform pixel scale and orientation of the image. The resulting header only contains the basic CD*, CRVAL, CRPIX, and CTYPE keywords to describe the transformation from each pixel position to a sky position, with a basic RA--TAN/DEC--TAN projection being provided in the header. This WCS solution also gets a default label, as the WCSNAME keyword, of DRZWCS to reflect the fact that it no longer contains any distortion model from any of the input images.