Here are some column definition files (to use with tcreate, for example) and other information about the reference files. PEDIGREE and DESCRIP header keywords are optional. If you include them (either one or both), they go in the primary header of the SDSTFILE but in the bintable extension header of the tables. The SDSTFILE should be a FITS file containing two IMAGE extensions, one with EXTNAME = "AXIS1" and the other with EXTNAME = "AXIS2". Each extension must be the same size as the input science image. The AXIS1 extension gives the small-scale distortion as a shift in pixels along the first axis, and the AXIS2 extension gives the distortion along the second axis. The SDSTFILE has no primary data. This particular file has just a constant three-pixel shift in X and a two-pixel shift in Y. (We need to decide on the sign of the shift.) # APERTAB APERTURE CH*24 %-24s "" NELEM I %8d "" WAVELENGTH D[1024] %15.7f angstrom THROUGHPUT R[1024] %15.7g "" The wavelengths must be monotonically increasing. The throughputs are supposed to be the fraction of light passed by the slit. # APDESTAB WIDTH1 R %8.3f arcsec WIDTH2 R %8.3f arcsec OFFSET1 R %8.4f arcsec OFFSET2 R %8.4f arcsec NBARS I %5d "" BAR1LOCN R %8.3f arcsec BAR2LOCN R %8.3f arcsec BAR3LOCN R %8.3f arcsec BAR1WIDTH R %8.3f arcsec BAR2WIDTH R %8.3f arcsec BAR3WIDTH R %8.3f arcsec The aperture size, offset, and the bar locations and widths are all in arcseconds. Divide by cdelt2 (arcsec) from distntab to convert to pixels. The BARnLOCN values are the distances of the bars from the center of the aperture. In addition, there must be a header keyword REF_APER that gives the name of the reference aperture. # PHOTTAB columns: OPT_ELEM CH*24 %-24s "" CENWAVE I %8d "" SPORDER I %8d "" NELEM I %8d "" WAVELENGTH D[1024] %15.7f angstrom THROUGHPUT R[1024] %15.7g "" The wavelengths in this file also must be monotonically increasing. # IDCTAB Column definitions (e.g. cdfile when running tcreate): APERTURE CH*16 %-16s "" # aperture name OPT_ELEM CH*8 %-8s "" # grating name NPIX1 I %5d pixel # X size for output image NPIX2 I %5d pixel # Y size for output image NCOEFF1 I %5d "" # number of coefficients in X NCOEFF2 I %5d "" # number of coefficients in Y COEFF1 D[24] %25.16g "" # array of coefficients for X COEFF2 D[24] %25.16g "" # array of coefficients for Y The arrays in columns COEFF1 & COEFF2 consist of an eight-element header followed by the actual coefficients. The header is just a list of numbers, such as the number of coefficients for each axis and the valid ranges of the independent variables (X & Y). NCOEFF1 & NCOEFF2 are therefore eight plus the number of actual coefficients. For a cubic fit ("order" 4 x 4) including cross terms, for example, 16 coefficients are needed, so NCOEFF is 24. These values are printed by the xyztable task if coefficients=yes. Chebyshev fit ncoeff-8 ------------- -------- 2 x 2 cross- 3 2 x 2 cross+ 4 3 x 3 cross- 5 3 x 3 cross+ 9 4 x 4 cross- 7 4 x 4 cross+ 16 The geometric distortion described by the idctab is a mapping from output pixel coordinates to input pixel coordinates, both in reference pixel units. Pixel coordinates are one-indexed. Here is a description of the coefficients returned by xyztable (i.e. returned by dgssave in the iraf gsurfit package) for the case of a linear fit, no cross terms, Chebyshev polynomials. The polynomial to be evaluated is f(x') = a0 + a1 * x', where x' = [2 * x - (maxx + minx)] / (maxx - minx), and minx & maxx are the minimum and maximum values of x over which the fit was computed, and similarly for y. The values in the coefficient array are as follows: 1: 1 --> Chebyshev polymonial, 2 --> Legendre, 3 --> polynomial 2: number of coefficients for X (=2) 3: number of coefficients for Y (=2) 4: 0 --> no cross terms; 1 --> cross terms included 5: min X 6: max X 7: min Y 8: max Y 9: a0 for either X or Y 10: a1 for X 11: a1 for Y You can use the xyztable task with coefficients=yes to get a list of the coefficients, including the header. You need to run xyztable twice, once for the X fit (COEFF1) and once for the Y fit (COEFF2). The parameters for xyztable were as follows, for finding the coefficients for the identity mapping over 1:1024 in both axes: intable1 = "inx" input files to fit to intable2 = "inx" positions at which to evaluate fit outtable = "STDOUT" list of output tables (xname = "c1") name of column for X values (yname = "c2") name of column for Y values (zname = "c3") name of column for Z values (xorder = 2) number of coefficients in X (yorder = 2) number of coefficients in Y (x1 = INDEF) minimum X value for fit (x2 = INDEF) maximum X value for fit (y1 = INDEF) minimum Y value for fit (y2 = INDEF) maximum Y value for fit (cross_terms = no) include cross-terms? (function = "chebyshev") function to be fit (verbose = yes) print file names? (coefficients = yes) print coefficients? # file inx, for COEFF1 # the columns are X and Y in the output image, and X in the input image 1. 1. 1. 1. 513. 1. 1. 1025. 1. 513. 1. 513. 513. 513. 513. 513. 1025. 513. 1025. 1. 1025. 1025. 513. 1025. 1025. 1025. 1025. # file iny, for COEFF2 # the columns are X and Y in the output image, and Y in the input image 1. 1. 1. 1. 513. 513. 1. 1025. 1025. 513. 1. 1. 513. 513. 513. 513. 1025. 1025. 1025. 1. 1. 1025. 513. 513. 1025. 1025. 1025. Here is a text file containing all the information for this particular row of the idctab; I used tcreate with this as the data file: # This is the identity mapping for x = 1 to 1024 and y = 1 to 1024 # for imaging mode. "52X52" "MIRVIS" 1024 1024 513. 513. 0.05078125 0.05078125 12 12 1. 2. 2. 0. 1. 1025. 1. 1025. 513. 512. 0. 0. 1. 2. 2. 0. 1. 1025. 1. 1025. 513. 0. 512. 0.