WCSTools

Getting Good Coordinates

Telescope Data Center

The object of this note is to show you how to take an image and produce coordinates you can use for Hectospec observing. These examples use data from the 4-Shooter CCD camera on the FLWO 48-inch (1.2 meter) telescope on Mt. Hopkins. Each 4-Shooter FITS file has 4 image frames. The particular file used here is called 0103.M67I.fits.

First look to see if a world coordinate system (WCS) exists. In our example, there was a WCS as shown by the following keywords in the header:

	CD1_1		 x degrees/pixel
	CD2_2		 y degrees/pixel
	CTYPE1 = RA-projection
	CTYPE2 = DEC-projection
	CRVAL_1		 degrees in ra
	CRVAL_2		 degrees in dec
	CRPIX1		 x coordinate reference pixel
	CRPIX2		 y coordinate reference pixel

Produce a file with 3 columns: image x position, image y position, and a relative magnitude. To do so run Doug Mink's shell script, imsex. This script uses Emanual Bertin's SExtractor, the basic purpose of which is to detect and classify sources from an image.

	imsex -m -n 300 0103.M67I.fits

where

	-m	extracts stars for all images in a multi-extension file
	-n	number of stars to extract

The script imsex splits the 4 frames into 4 fits images AND produces a file (with .sex suffix) of x, y, and relative magnitude for each frame. Using our example, you would expect to see output:

	0103.M67I.IM1.fits		0103.M67I.IM1.sex
	0103.M67I.IM2.fits		0103.M67I.IM2.sex
	0103.M67I.IM3.fits		0103.M67I.IM3.sex
	0103.M67I.IM4.fits		0103.M67I.IM4.sex

You can now compare your star positions with one of the catalogs. Your choices are the
GSC-ACT updated HST Guide Star Catalog, the GSC II Catalog, the USNO-B1.0 catalog, the USNO-A2.0 catalog, and the 2MASS Point Source Catalog. We've chosen the USNO-A2.0; simply substitute gsc (HST GSC), gsc2 (GSC II), ub1 (USNO-B1.0), or tmc (2MASS PSC) for the trailing or leading ua2 in the following commands. The command:

	saoua2 0103.M67I.IM3.fits
will bring up SAOimage with circles drawn around the USNO-A2.0 catalog positions on frame 3 of the FITS image. You can also compare against the GSCII using saogsc2, the GSC-ACT using saogsca, the USNO-B1.0 using saoub1, or the 2MASSPSC using saotmc. If your stars are in the center of these circles, congratulations, your header WCS coordinates are very good. More typically, the placement of stars and circles won't coincide, and you will want to create a better WCS for your image. To do so, run the program imwcs.

Doug Mink has written macros to deal with the 4 images in the 4-Shooter data. The one for the USNO-A2.0 catalog is called ufit. To run it on four images generated above, type:

	ufit 0103.M67I

The macro contains the following lines:

	imwua2 -wved $1.IM1.sex -q i2t -h 300 -n 8 -y 2.0 -p 0.67 -x -100 1100 -o $1.IM1uw.fits $1.IM1.fits
	imwua2 -wved $1.IM2.sex -q i2t -h 300 -n 8 -y 2.0 -p 0.67 -x 1100 1100 -o $1.IM2uw.fits $1.IM2.fits
	imwua2 -wved $1.IM3.sex -q i2t -h 300 -n 8 -y 2.0 -p 0.67 -x 1100 -100 -o $1.IM3uw.fits $1.IM3.fits
	imwua2 -wved $1.IM4.sex -q i2t -h 300 -n 8 -y 2.0 -p 0.67 -x -100 -100 -o $1.IM4uw.fits $1.IM4.fits

where

	-w	writes new header
	-v	verbose
	-e	erases the old WCS projection on the newly created file
	-d	uses the .sex output instead of searching for stars in the image
	-q i2	iterate 2 times
	-q t	tolerance in pixels for match
	-h	maximum number of stars to find
	-n	number of parameters to fit
	-y	multiply image dimensions by this number (used if there is no well defined center)
	-p	plate scale in arcseconds/ per pixel
	-x	pixel coordinates
	-o	output

This produces a FITS output file for each of the 4 images.,

	0103.M67I.IM1uw.fits		0103.M67I.IM3uw.fits
	0103.M67I.IM2uw.fits		0103.M67I.IM4uw.fits

gfit, g2fit, b1fit, and tfit produce similar files with gw, g2w, and tw added instead of uw. Now, you are ready to match your new coordinates against a catalog and to eliminate from your list objects that have large residuals. To do so you run immatch.

Once again there is a macro for the 4-Shooter data, called umatch which contains the following lines:

	immua2 -t 2 -d $1.IM1.sex -h 300 $1.IM1uw.fits > $1.IM1uw.umatch
	immua2 -t 2 -d $1.IM2.sex -h 300 $1.IM2uw.fits > $1.IM2uw.umatch
	immua2 -t 2 -d $1.1M3.sex -h 300 $1.IM3uw.fits > $1.IM3uw.umatch
	immua2 -t 2 -d $1.IM4.sex -h 300 $1.IM4uw.fits > $1.IM4uw.umatch

where

	-t	offset tolerance in pixels
	-d	input catalog with (x y mag) format
	-h	maximum number of reference stars

so, the command is:

	amatch 0103.M67I

and an example of output is:

	0103.M67I.IM3uw.match

You will want to look at the separation given at the end of each amatch file; if it is less than 0.25", everything is fine; if not, try to understand why -- do you perhaps have too few stars in your solution, for example.

You may also wish to look at the image plotted against catalog circles as you did above, so here you could run:

	saoua2 0104.M67I.IM3uw.fits 
or, to compare with 2MASS Point Sources,
	saotmc 0104.M67I.IM3uw.fits 

Now you are ready to produce a file with right ascension, declination, and magnitude for the stars in your field (up to the maximum you set previously). The program to be run is called xy2sky and once again, Doug Mink has written a macro, uphot, for the specific case of 4-Shooter data. The macro consists of the lines:

	xy2sky -tc $1.IM1uw.umatch $1.IM1uw.fits @$1.IM1.sex > $1.IM1.cat
	xy2sky -tc $1.IM2uw.umatch $1.IM2uw.fits @$1.IM2.sex > $1.IM2.cat
	xy2sky -tc $1.IM3uw.umatch $1.IM3uw.fits @$1.IM3.sex > $1.IM3.cat
	xy2sky -tc $1.IM4uw.umatch $1.IM4uw.fits @$1.IM4.sex > $1.IM4.cat

where

	-t	Tab-separated table (Starbase) output
	-c file	Read polynomial magnitude mapping from this file
	@file	Read x, y, and instrumental magnitude from this file

It is invoked by typing (in our example)

	uphot 0103.M67I

This will produce four tab-separated table files with the .cat suffix. These files contain for each identified star:

	ra	dec	magnitude	image x	image y

These files (4 here) can be combined to create a catalog.