ISPI Data Reduction

|CTIO Home| |CTIO IR| |ISPI Home|


Basics

ISPI data should be flat fielded and sky (and/or "dark") subtracted. These steps can be accomplished with may standard IRAF or IDL routines. One way is to use the basic reduction tool "osiris" provided in the cirred set of IRAF scripts. A basic set of initial reduction steps would include:
cl> osiris n1 n2 pre=r suf=n mask=mask.fits div=yes, dome=flat.fits

n1 and n2 are command line params, the others can be set in the param file. Here pre is a "prefix" or image base name, suf will be the output image suffix and the images to be reduced have numbers n1 thru n2, inclusive. Suppose the prefix for input images is "r" for raw. If n1=1, and n2=3, then images r001.fits, r002.fits, r003.fits will be processed and images r001n.fits, r002n.fits, and r003n.fits will be output. Look over the cirred pages, the osiris param file, and the osiris.cl script itself for more information.
cl> sky_sub 10 25 sky=kskyimage make+ sub+

Where the image numbers work as in the osiris example. Prefixes and suffixes are set in the param file or on the command line. The two flags "make" and "sub" control how sky_sub behaves. Make will combine the indicated images into a sky frame, and sub will subtract that sky frame from the images. A set of independent skys could be combined with make+ ans sub- (to suppress subtraction) and applied to a separate set of object frames with make- (to suppress making of the sky frame) and sub+.

Astrometry

One of the most important tasks for ISPI data reduction is the assignment of a proper coordinate system and correction of image distortions. These tasks are conceptually straightforward, but often difficult to accomplish in practice (especially the latter). A preliminary set of tasks and scripts has been set up to allow for the determination of the world coordinate system keywords to be included in the image headers. A solution to higher order distortions is also available, which will allow for the registration and combination of dithered images.

Software. The processing of ISPI images described here requires that one download and install several external packages.
Updating the Basic Headers for a WCS.
> imwcs -c tmc -d t150s.dao -h 200 -n 6 -vw -p 0.303 t150s.fits

In this example, -c tmc calls for the 2MASS catalog. The location of the catalog is specified during the build process of WCSTOOLS. -h 200 calls for 200 stars to be used in the matching between the image and catalog, and -n 6 refers to the order of the fit between image and catalog positions (6 parameters in each axis). -p 0.303 gives the initial image scale in arcseconds per pixel for ISPI; this is required since this information is not in the header. Alternately, one could add SECPIX (with a value of 0.3) to the ISPI image headers. -d t150s.dao specifies that the file "t150s.dao" be used for the input x,y positions of the stars to be matched by the catalog. This file should be sorted on brightness so the brightest stars are used. The file should be one star per line, x, y, and mag. "#'s" indicate comments and are ignored in this file, as are any fields after the first three of each line. See the IMWCS Command Line Arguments for more information. -vw sets the "verbose" flag along with a call (w flag) to write a new image (in this case t150sw.fits) which has the updated WCS. See the imwcs command line argument -o for more output options, including updating the input image header.
Taking Distortion into Account
 X residuals

In this image, the residuals to a linear fit are shown. The peak errors in position would be about three pixels if the distortion were not accounted for. In the next image, the residuals for a 4th order fit are shown. The RMS is less than 0.1'' which is about 1/3 of an ISPI pixel.

4th order plus full xterms

> swarp -c swarp.gc t150sw.fits t151sw.fits t152sw.fits t153sw.fits t154sw.fits

In this example, the swarp config file is "swarp.gc" and five images are reinterpolated. Each image can have its own TNX solution, which in our example would be the combination of WCS and TNX keyword values produced by imwcs and ccmap. Unless the fit to each image is very good, it is advisable to use an average solution for the higher order terms (and rotation and scale in this case). This can easily be done in swarp by specifying an auxillary header file with the FITS keywords and values. Cutting and pasting from the above solution from the FITS header, a file of the form t15?sw.head was made for each image. The file has the following form and is identical for each image:

WAT0_001= 'system=image'
WAT1_001= 'wtype=tnx axtype=ra lngcor = "3. 4. 4. 1. -0.09223848232288634 0.095'
WAT2_001= 'wtype=tnx axtype=dec latcor = "3. 4. 4. 1. -0.09223848232288634 0.09'
CD1_1   =  -8.4729762794223E-5
CD1_2   =  7.23448951262463E-7
CD2_1   =  7.40672424953437E-7
CD2_2   =  8.47678406227307E-5
WAT1_002= '30461739012073 -0.08294874238596413 0.086260218248302 -3.81821493608'
WAT1_003= '0989E-6 0.004201053595244364 0.004530606959289172 -0.722711400721411'
WAT1_004= '9 -5.887103279160741E-4 0.006853642315098468 0.0766861807819218 0. -'
WAT1_005= '0.005316483436707363 -0.4617939442868234 0. 0. 0.1156522538399243 0.'
WAT2_002= '530461739012073 -0.08294874238596413 0.086260218248302 4.34379162931'
WAT2_003= '0940E-6 -5.007423412969465E-4 6.003889063455503E-5 0.084985861670387'
WAT2_004= '73 0.003355387441743075 0.003754664665905738 -0.3911461579926636 0. '
WAT2_005= '0.001750656256554302 0.04350355226749533 0. 0. -0.5986827241716564 0'
WAT1_006= ' 0. 0. "'
WAT2_006= '. 0. 0. "'
END  

These lines were copied directly from the fits header of the image used in our example to find the higher order solution. A tab follows the keyword "END."

End to End Processing of ISPI Images

The following is an example of how ISPI images may be fully processed using the tools discussed on this page (cirred, WCSTOOLS, SWARP, IRAF).
  1. Make flats: Use med.cl to combine lights on and off images into a domeon and domeff image, respectively. Subtract the off image from the on.
  2. Make bad pixel masks: Use maskbad.cl to create bad pixel masks.
  3. Fix flats: Use fixfits.f to fix the flat images. The resulting images will have bad pixels interpolated over. If the images are named "dFilterNamef.fits", then the osiris.cl script will apply the right flat according to the FITS header filter name where FilterName is th evalue of this header parameter (e.g. KA for the ISPI Ks filter).
  4. Run osiris.cl: The meta script which will preprocess images, divide by a flat, and add appropriate head key words.
  5. Sky subtract the images: Use sky_sub.cl to make and subtract sky frames.
  6. Add a WCS: Use do_wcs.cl to add a World Coordiante System to the images. (Preliminary script included in cirred package. Requires WCSTOOLS. Requires a catalog implementation for the WCSTOOLS.).
  7. Compute high order distortions: Use do_ccmap.cl to compute the high order distortion coefficients and add them to the image header (Preliminary script included in cirred package. Requires WCSTOOLS. Need to incorporate TNX keywords manually as described above).
  8. Shift/Combine images: Use SWARP (by Emmanuel Bertin) to reinterpolate the images and optionally shift and combine them.
  9. Make a color image: SWARP can be used to shift and orient the final J, H, and K images so they can be combined in a false color image.


Acknoledgements: We would like to acknowledge the useful comments and input of Silas Laycock regarding ISPI data reduction and astrometry. It is also a pleasure to acknowledge the very useful software and documentation of the Mink WCSTOOLS, the Bertin SWARP program, and the IRAF suite.

please mail questions or comments to:
rblum@ctio.noao.edu
nvdbliek@ctio.noao.edu
bgregory@ctio.noao.edu