## 4.3 The CD Matrix

### 4.3.1 Definition of the CD Matrix

The astrometric information in FITS images (also referred to as the WCS) is stored in the header using a standard set of keywords. The reference location is defined by the following keywords:

• CRVAL1: defines the right () ascension of the reference pixel
• CRVAL2: defines the declination () of the reference pixel
• CRPIX1: the x location of the reference pixel
• CRPIX2: the y location of the reference pixel

The plate scale and rotation of the image is contained in the CD MATRIX (CD?_? keywords).

• 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

### 4.3.2 Computation of the CD Matrix

These keyword values get computed using the operations:

The plate scale, "scale", represents the average plate scale (in decimal degrees) for the reference pixel after removing all distortion. The value of originally comes from the PA_V3 keyword; 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. 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 then gets 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; 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, , then 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 gets recorded in the ORIENTAT keyword.

The terms A10,A11,B10,B11 refer to the linear terms of the distortion model as defined in the polynomial stored in the IDC table 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 on these can be found in the section dealing with the geometric distortion and update of the SIP keywords. The right ascension (R.A.) and declination (Dec.) of the image target is stored in the header of HST images using the keywords RA_TARG and DEC_TARG, however, these are the same across all images in a dithered set since the target itself is not changing. However, the R.A. and Dec. of the image reference pixel will always be unique for each image. Therefore, the offset between the images (the x and y shift) can be determined by retrieving the values of the associated reference pixel keywords.

### 4.3.3 Updating the WCS Header Information

The World Coordinate System information contained in the header of each image is only initially as precise as the available catalog information for the guide stars used for pointing. The typical accuracy of the guide star positions based on Guide Star Catalog V1 was about 1 arc-second. Thus, observations taken of the same field at different orientations (requiring different guide stars to be used) can see offsets between their observations of 1-3 arcseconds. Users may choose to calculate additional shifts to align their images more accurately and these delta shifts can be incorporated back into the WCS information in the header. This facilitates proper translation of pixel to sky coordinates for science analysis, and allows for all the necessary shifting information for each image to be stored in the header of the image itself for future alignment reference.

It is also important to update the WCS keywords in the header of the image based on the provided distortion correction solutions (such as geometric distortion and velocity aberration) that have been applied to the data through the drizzle process. The full distortion solution, with velocity aberration correction, gets applied automatically inside the MultiDrizzle code-set through the use of "makewcs". The 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 the reference pixel, but also the linear terms of all distortion corrections. Higher-order terms of the distortion model then get reported in the remainder of the SIP keywords.

Users who wish to apply their own distortion corrections should be careful to update these keywords.

 Space Telescope Science Institute http://www.stsci.edu Voice: (410) 338-1082 help@stsci.edu