Instrument Science Report ACS 2000-11 Geometric Distortion Table: IDCTAB W. Hack, C. Cox December 6, 2000 ABSTRACT The new reference table, IDCTAB, will support the description of geometric distortion models for instruments. This report describes the columns in the table and how the coefficients in the table can be used. Introduction Many instruments require some sort of reference file for describing the geometric distortion, yet a single format has not yet been developed that satisfies each instrument’s needs. The description of the geometric distortion can take many different forms, ranging from images of pixel area variations to polynomial fits. One common element shared by all the instruments is the Science Instrument Aperture File (SIAF) which contains descriptions of the distorted and undistorted aperture positions. The conversion between distorted and undistorted positions in the SIAF is controlled by a polynomial fit performed by the instrument teams. This commonality provides the basis for generating a small and simple reference file which can be used by any instrument to describe the detector’s geometric distortion using the same fitting method. This report describes the format of this common reference file based on the polynomial fit used by the SIAF. The IDCTAB, as referenced by the ACS, contains the coefficients for this fit along with other information necessary for applying to each image. The format has been developed to be as general as possible so that instruments other than ACS can also use it along with any software designed to work with this table. Copyright© 1999 The Association of Universities for Research in Astronomy, Inc. All Rights Reserved. Instrument Science Report ACS 2000-11 Distortion Model A single model for the geometric distortion has been used for WFPC2, STIS and ACS in the SIAF. This model ties in the aperture position to the detector pixel positions and accounts for geometric distortion to support accurate target acquisitions, image processing, and photometry. The X and Y pixel coordinates for the reference pixel for this model gets recorded in the science headers as CRPIX1 and CRPIX2. The translation from detector pixel coordinates to sky position includes the scaling and distortion correction with the origin at the reference position where the detector and sky Y axes are assumed to be exactly parallel. The relationship between these systems is defined for the SIAF as k xc = i ∑ ∑ ai, j ( x – xr k ) j( y – yr )i – j yc = i=0j=0 i ∑ ∑ bi, j ( x – xr ) j ( y – yr ) i – j i=0j=0 where (x,y) are the positions from the image, (xr,yr) is the reference pixel position, (xc,yc) are the corrected pixel positions and k is the polynomial order of the fit. The orientation of the (xc,yc) system is normally chosen so that the corrected yc axis is parallel to the input y axis. This relation thus converts detector coordinates in pixels to corrected position in arcseconds. The only limitation to this fit is imposed by the interface document ICD-26 which limits the SIAF polynomial order to 5. Fortunately, this limit does not prevent us from using higher order fits in the IDCTAB should it be necessary. These polynomials expand out to the form x c = a 00 + a 10 y + a 11 x + a 20 y 2 + a 21 xy + a 22 x 2 + … The values of a 00 and b 00 will always be zero, since xc=0 and yc=0 at the reference position (x,y) = (xr,yr). Also, choosing yc parallel to y forces a10 = 0. A similar form is used for the inverse relation using coefficients c and d for the x and y fits respectively; specifically, k x = xr + i ∑∑ k c i , j x cj y c( i – j ) y = yr + i=0j=0 i ∑ ∑ d i, j xcj yc( i – j ) i=0j=0 Although this description appears asymmetric, the origin of each set of coefficients is the same point. This inverse relation provides the conversion from units of arcseconds to distorted input pixels. File Format The IDCTAB will be stored as a FITS file with a FITS table in the first extension. The primary header will only contain basic FITS keywords along with information about the generation of the reference file. Additional keywords in the primary header would include: 2 Instrument Science Report ACS 2000-11 INSTRUME S Name of the Instrument DETECTOR S Name of the detector used The first extension to the FITS file would then hold the table with the description of the geometric distortion. Its header would contain only the basic FITS keywords necessary for the extension plus: NORDER I Order of the polynomial fit used for the distortion PARITY I Parity value for conversion from (x,y) to (V2,V3) The keyword NORDER provides a way to ascertain up front what order of polynomial has been stored in the table, while PARITY describes the relationship between pixel coordinates and V2,V3. The table itself would then consist of the columns: DIRECTION S %8s Application direction of coefficients (FORWARD or INVERSE) DETCHIP S %8s ID of chip/detector used for observation WAVELENGTH R %12.4f XSIZE I %8d Raw image size in pixels in X direction YSIZE I %8d Raw image size in pixels in Y direction XREF R %12.4f X position of reference pixel YREF R %12.4f Y position of reference pixel XCOM R %12.4f X position of common point in fit YCOM R %12.4f Y position of common point in fit V2REF R %12.4f V2 position of reference point (arcsec) V3REF R %12.4f V3 position of reference point (arcsec) THETA R %12.4f Angle from V3 axis anti-clockwise to Y axis (degrees) SCALE R %12.4f Scale of square corrected pixel in arcsec CXSIZE I %8d Corrected image size in X direction (pixels) CYSIZE I %8d Corrected image size in Y direction (pixels) CXREF R %12.4f X value of reference pixel in corrected system CYREF R %12.4f Y value of reference pixel in corrected system CX10,CX11,... R %20.6e Distortion Coefficients for X position CY10,CY11,... R %20.6e Distortion Coefficients for Y position Central wavelength of fit The table contains one row for each part of the detector that has its own distortion correction. For example, the ACS WFC table would contain 1 row for each 2048x4096 chip that makes up a WFC observation where each row would have a different value of DETCHIP. 3 Instrument Science Report ACS 2000-11 An additional row for each chip may be included for the inverse fit and they would be flagged with the DIRECTION value of ‘INVERSE’. Naturally, instruments with only one detector (such as STIS CCD) would only have 1 row for the forward fit and an optional row for the inverse fit. There may also be separate sets of these rows for different central wavelengths, as determined by the optical elements used for the observation, with each set having its own value for WAVELENGTH. The units of WAVELENGTH can vary for each instrument since IR detectors operate in microns as opposed to Angstroms for a UV imager. Columns for Calibrated Values Any distortion model relies on more than the fit to properly apply the model to the data. The columns XSIZE and YSIZE provide the full input size of an uncorrected (distorted) image from each detector/chip in the observation. This provides some perspective for the location of the reference position given in the columns XREF,YREF and for the common fit point given in the columns XCOM,YCOM. The reference position corresponds to the nominal targeting position for the observation and serves as the zero-point for the distortion model (as discussed above with the equations). The pixel position provided by XCOM and YCOM corresponds to the common position for the global fit. This position is determined by taking the midpoint between each chip’s reference positions in V2,V3 and calculating the corresponding x,y position for each chip. The fit can be applied to corrected pixel positions relative to this common point’s corrected position to result in a global fit. The columns V2REF and V3REF provide the telescope position for the reference position given in XREF and YREF with THETA providing the angle between the telescope’s V3 axis counterclockwise to the images’s Y axis. The rotation from x to y is commonly in the opposite sense to that from V2 to V3. We express this by setting the value of PARITY to -1. The transformation from corrected image pixels (X,Y) to V2,V3 then becomes: V2 = V2REF + SCALE ( PARITY ( x c – X ref ) cos ( THETA ) + ( y c – Y ref ) sin ( THETA ) ) V3 = V3REF + SCALE ( ( – PARITY ) ( x c – X ref ) sin ( THETA ) + ( y c – Y ref ) cos ( THETA ) ) where (Xref,Yref) is the corrected position for the reference point. Distortion Coefficients Columns Applying the fit to an image will result in an image where the pixels are shifted around to correct for the distortion, but a couple of decisions remain to be made: output size and output pixel scale. Both of these are completely up to the end-user, however, this reference file contains the columns CXSIZE, CYSIZE, and SCALE to provide calibrated default values. The values for CXSIZE and CYSIZE specify an output size for the calibrated, undistorted image. These values will be a value which can be calibrated and set to provide an output image which completely contains the new image without trimming any input 4 Instrument Science Report ACS 2000-11 data. Similarly, the value for SCALE will specify a canonical, calibrated value which would be applied to the output image in lieu of any end-user overrides. This will allow data to be processed automatically with this reference table to produce output images of consistent pixel scale suitable for astrometric purposes subject to the errors in the correction. Finally, the columns CXnn and CYnn would then contain the values for the polynomial fit for the distortion for that chip alone. These values would convert an input pixel position to an undistorted position assuming the value of the DIRECTION column were ‘FORWARD’. Alternatively, if DIRECTION was specified as ‘INVERSE’ for the row, the coefficients would specify the application of the distortion to undistorted pixel positions resulting in an distorted image. Using the Table The column names for the coefficients contain the indices for the coefficients from the polynomial fit, such as CX11 corresponding to the a11 coefficient for the forward fit and c11 coefficient for the inverse fit. This allows a direct correlation between the columns and the coefficients used in the fit with little ambiguity. These columns can then be read into a polynomial of order NORDER (from the table header). For subarray data, the pixel position from the observation should be corrected for the offset of the subarray to put it into the coordinate frame of the entire chip. Figure 1: Schematic of Reference Points for ACS WFC observation. Chip #1 .a .C Chip #2 .b Once the coefficients have been read in from the table, they need to be applied to the data. This relies on understanding how to relate the input pixel positions to those expected for the fit. The model given in the table covers the entire instrument’s field of view, but some instruments use more than 1 chip for each observation. The fits for each chip are combined into a global fit with the same common point (xcom, ycom). Figure 1 shows how the common point C relates to each chip in an ACS WFC observation. This common point is provided in the table in the XCOM,YCOM columns and with the position being given rel- 5 Instrument Science Report ACS 2000-11 ative to each chip’s origin. As seen in this example, the common position can be different from the reference position for each chip since the reference position corresponds to the pixel position a target will be placed for an observation. Values for the common point specific to each chip and the reference points for the example in Figure 1 are provided in Table 1. Table 1. Table of Reference Positions for Figure 1. a 2048 1024 Reference position for Chip #1 b 2048 1024 Reference position for Chip #2 C1 2048 -18 Common position used for Chip #1 C2 2048 2065 Common position used for Chip #2 The fit can then be applied to the image pixel positions relative to the reference pixel position for the chip given by (XREF,YREF); namely, by using x = x d – XREF and y = y d – YREF , where xd and yd are detector pixel positions. Single chip observations will have XCOM and YCOM at the same position as the reference position XREF,YREF. In order to combine the corrected chips into a single corrected image, the corrected position for the common position should be calculated relative to each chip’s reference position using x = XCOM – XREF and y = YCOM – YREF . The final corrected pixel position from each chip can then be determined by placing it into the combined output image relative to the corrected common position using X = x c – X com and Y = y c – X com , where Xcom and Ycom are the corrected common positions. Ideally, both chips will be perfectly parallel with each other. However, the values of THETA in the table demonstrate that they are rotated slightly with respect to each other. The fit for each chip only insures that the distorted and corrected Y axes for a chip remain at the same angle with respect to the telescope V3 axis. This allows each chip to have different rotations relative to each other. Typically, though, this mis-alignment between the chips will be less than a degree. This can be corrected for, if desired, by rotating the corrected position for each pixel by half the difference in rotation between the chips in the observation. This will then align both chips in the output image. Summary The geometric distortion for many instruments can be described using the IDCTAB which contains the coefficients for the SIAF polynomial fit. This table has been defined so that any instrument whose distortion has been modelled using a polynomial fit can use this table as a reference file. The table contains information about the reference positions used for the fit and used for applying that fit to single- and multiple-chip observations. Each instrument has its own set of unique requirements that may not be fully met by this speci- 6 Instrument Science Report ACS 2000-11 fication. Those requirements can therefore be met with the addition of columns specific to the instrument. Overall, this table should support a wide-range of instruments and should be easily applied with software. 7