WCSTools Publications WCSTools: Putting Image World Coordinate Systems to Use, Douglas J. Mink (1996), presented at the Sixth Annual Conference on Astronomical Data Analysis Software and Systems (ADASS 96) in Charlottesvile, Virginia in September 1996, published in Astronomical Data Analysis Software and Systems VI, A.S.P. Conference Series, Vol. 125, 1997, Gareth Hunt and H. E. Payne, eds., p. 249.

Putting Image World Coordinate Systems to Use

Douglas J. Mink
Harvard-Smithsonian Center for Astrophysics



After a means of translating image coordinates to sky coordinates was added to the SAOimage display program (Mink 1995), the same subroutine library was added to the SAOtng (Mandel 1994) and Skycat (Albrecht et al. 1997) image display programs. Users of these programs were then faced with the fact that world coordinate system (WCS) descriptions exist for only a few sets of data which optical astronomers routinely use: images from the Digitized Sky Survey, and spacecraft such as the Hubble Space Telescope and the Infrared Astronomy Satellite. Virtually no ground-based optical observatories add information to their image headers to translate pixel coordinates to sky coordinates.

Individual astronomers have used a variety of methods to match image stars with reference catalogs to set world coordinate systems for small sets of images. All widely-known methods required extensive user interaction until Elwood Downey reported (Downey and Mutel 1996) that the University of Iowa Automated Telescope Facility was automatically adding world coordinate system information to the header of each image it took. Steps were taken immediately to apply his program, SETWCS, to data from telescopes used by astronomers at the Center for Astrophysics. As the Iowa software was adapted to deal with more types of images, a whole suite of portable utilities and subroutines was developed to set and use image world coordinate systems.

Setting World Coordinate Systems

The sequence of processes used in SETWCS was retained in the revised program, IMWCS:
Read a FITS or IRAF image and its header;
Find all stars in the image and sort them by brightness;
Find all stars in a reference catalog in the region of the sky where the image header says the telescope is pointing and sort them by brightness;
Match the reference stars to the image stars;
Fit a standard WCS function to the matches;
Add the WCS information to the image header;
Write the revised image and header

While its overall structure was maintained, the program was modified extensively to handle all FITS image data types, access IRAF .imh (OIF) files as well as FITS files, use a standard WCS library, and handle a variety of reference catalogs. In addition to the HST Guide Star Catalog, the USNO A1.0 Catalog (Monet 1996) and user-generated reference catalogs in Starbase format (Roll 1996) may be used. Image stars are now sorted by integrated rather than peak flux. Instead of matching stars using a grid of possible offsets, each possible set of offsets between reference and image stars is checked and the most common offset is used as an initial value for the fit. The WCS fit has been expanded to include plate scale and rotation angle, and many fixed parameters, such as tolerance for reference/image position matches can now be changed on the command line.

In one-third to one-half of the 10' x 10' images we used for testing, there were too few Guide Stars to fit a world coordinate system. Figure 1 shows such an image with only 2 HST Guide Stars, positioned according to a nominal WCS based on the telescope pointing direction and an assumed plate scale. To deal with this situation, the star-finding code in IMWCS was broken out into a new program, IMSTAR, which catalogs stars with positions from images with a known WCS, such as those created from the Digitized Sky Survey (DSS). The DSS thus serves as a giant catalog, the depth of which can be varied as needed by altering the parameters used by IMSTAR. To make it easier to obtain DSS images covering the same region as a telescope image, a new program, IMSIZE, was written. It translates pointing information from the telescope image to the format needed by the DSS GETIMAGE program to extract an image covering the correct region. Figure 2 shows the same image as Figure 1 after it was processed by IMWCS. The positions of the stars extracted from a DSS image of the same region of the sky are plotted as circles. Where it is available, the USNO A1.0 catalog, with 491,848,883 sources, can be used directly, instead of the extracted DSS catalog, to fit a WCS with similar accuracy.

Figure 1: An image with only two HST Guide Stars.

Figure 2 shows the DSS stars found and fit to those in the image by IMWCS.
Figure 2: The same image with stars from the Digitized Sky Survey.

Using World Coordinate Systems

In the process of testing IMWCS, it became apparent that many of the pieces of that program were useful in their own right. In addition to the IMSTAR star-finding program used above, separate programs to search the GSC, USNO A1.0 or user catalogs were written. IMCAT lists the stars in a specified catalog which can be found in the region specified by an image's WCS. SCAT searches a catalog over a region specified on the command line. XY2SKY and SKY2XY translate coordinate pairs from image pixel coordinates to sky right ascension and declination (or galactic latitude and longitude) and vice versa.

Several image manipulation programs were also developed. EDHEAD edits the header of a FITS or IRAF image using any Unix text editor. IMHEAD lists the entire header of a FITS or IRAF image. GETHEAD and SETHEAD print and change, respectively, specified FITS or IRAF header parameters. I2F converts an IRAF .imh file to FITS. For all of these programs, the IRAF file may be of either binary byte order (Sun/HP or IBM PC/Dec).

Further information about this software and how to obtain it may be found on the World Wide Web at http://tdc-www.harvard.edu/software/wcstools.

I am grateful to Elwood Downey for proving that this project was possible and for sharing his code. Scott Kenyon patiently tested the WCS fitting program on hundreds of images until it worked all of the time. He also provided the image used as an illustration in this paper. Allan Brighton of ESO tested the WCS translation code on many kinds of images, enabling me to make it as general as possible.


Albrecht, M. A., Brighton, A., Herlin, T., Durand, D., Biereichel, P. 1997, ADASS VI [full text]

Downey, E. C., & Mutel, R. L. 1996, ADASS V, 109 [full text]

Mandel, E., & Tody, D. 1995, ADASS IV, 125 [full text]

Monet, D. 1996, BAAS, 28, 905

Mink, D. J. 1996, ADASS V, 96 [full text]

Roll, J. 1996, ADASS V, 536 [full text]