Photometry Process

Photometry will be performed in the directory into which you sorted your images after reduction. For example, /data/photometry/WYSCH/19/9155.

Because of the relative sensitivities of different filters, for any given field a different number of images must be stacked for different filters. The number of fields needed to stack are as follows:
      7598 and 7661: 4 images
      8132 and 8199: 12 images
      8615 and 8685: 20 images
      9155 and 9233: 32 images
Thus, if you have more than the required number of images, you will be able to choose the best 20 (or 12, or 4) images to stack, after you perform photometry. More on this later.

Before anything, copy an images.info file from a previously-completed directory to your working directory. Update its list of images to correspond to the field with which you're working.

There are four main steps involved in photometry: choosing five good stars; calculating the FWHM of each image; doing the actual photometry on the five stars in each image; and choosing the best 20 (or 12, or 4) images, and best center image, to use when stacking.

IMPORTANT!! BEFORE DOING ANY PHOTOMETRY, MAKE SURE THAT THE IMAGES ARE XY-FLIPPED IN DS9. THAT IS, CLICK "ZOOM" AND CHOOSE "XY." DO THIS BEFORE CONTINUING.

Choosing Stars
Open the first image, making sure it is xy-flipped. You need to choose five stars on which you will perform photometry. However, they can't just be any stars; here are a few guidelines to follow:
Once five stars that satisfy the above criteria are chosen, put a circular region around each one, and save the region file (containing all five regions) as a .reg file, in the lowest angstrom directory of the filter pair. For example the .reg file will be in the 8615 of the 8615/8685 pair. This will allow you to quickly identify the five chosen stars in other images. For sanity's sake, "prevu" each image with the regions loaded to make sure no star is too close to the edge of any image. It is much better to find a mistake like that now instead of at the end of the stacking procedure.

Calculating FWHM
Display an image and load the regions. Type "imexam" into iraf, and hit "a" once on each of the five stars. A row of information should appear in the iraf window each time you hit "a." The FWHM (in pixels) is the rightmost of these numbers. Average the five stars' FWHMs, and put the result into images.info. I usually round to three decimal places. Do this for each image.

Real Live Photometry
We will now use the iraf package "phot" to do photometry. The package is located in noao.digiphot.apphot.

The package "phot" takes a user-determined aperture (circle around the star) and annulus (donut surrounding the aperture) to measure a star's counts, minus the sky. Three parameters determine the aperture and annulus. The "aperture" parameter is the radius, in pixels, of a circle inside of which counts will be measured. The other two parameters, "annulus" and "dannulus," determine the size of the annulus and comprise the area of the image used for the background sky value. "Annulus" is the number of pixels from the center of the star where the annulus begins, and "dannulus" is the width, in pixels, of the annulus. You will use these parameters to measure the counts of your five chosen stars in each image.

1. To begin, display the first image in ds9 (the images should still be xy-flipped) and load the region file. Type phot into iraf, and you will be prompted to enter the image name. Do so, excluding the .fit (this is because phot creates a file called IMAGENAME.mag.1; we do not want it to be called IMAGENAME.fit.mag.1). NOTE: Simply running phot in iraf does not automatically display the desired image. You must display the image on which you want to perform phot separately.
2. You now must determine the aperture and annulus settings to use. First, epar into phot and make sure the parameter "radplot" is set to "yes." Then, find the largest of the five stars and hit "t" in the center of that star. (Get as close to the center as you can without being overly obsessive about it. Most of the time you can get close enough without zooming in, but sometimes it helps to zoom.) A plot will display in a tektronix window (if a Tek window is already open, it will just display there), and you are looking for where the plot begins to flatten out. The curved part of the plot is the star, and the flat part is the sky. To find where the curved part ends, you will have to play around with the aperture, annulus, and dannulus parameters. To do so, with your cursor in ds9, type :ap #, :an #, or :dan #, respectively, and hit enter. NOTE: MAKE SURE THE CURSOR IS IN DS9 WHEN YOU HIT COLON. IF IT'S NOT, THE PARAMETERS WILL NOT CHANGE. You want to put both the aperture and annulus right where the plot flattens out, and I usually use a value of 4 for dannulus (you can use whole numbers; it will be precise enough). This will ensure that the sky you choose will be as close to the true background of the star as possible. Note that you do not need to set the aperture setting until after you've perfected annulus and dannulus. I usually start with an=10 and dan=10, play around with "an" until it's at the correct value, then set "ap" to that value and "dan" to 4. For example, if the annulus is set to 5 and dannulus is set to 10, the plot will display a radius from 5 to 15. NOTE: Sometimes certain images will have rogue bright pixels near the stars you've chosen (cosmic rays, etc.); this is fine, as long as they don't appear in all images -- this would mean the bright spot is a real source, and you'd have to choose a different star. Just be aware of these rogue pixels, and if necessary, put a little space between the aperture and the annulus to avoid the bright pixel.
3. Once you have chosen the three parameters, hit spacebar in the center of each of the stars, once and only once per star. IMPORTANT!! You must do this in the same order in every image. I go clockwise (upper left, upper right, lower right, lower left, center) ALSO IMPORTANT!! You must use the same phot parameters for all 5 stars in an image. Do not change the parameters after you have hit spacebar on the first star. This is why you use the largest star to determine the parameters; if the aperture and annulus are appropriate for the largest star, they will of course fit the other 4. Each stroke of the spacebar saves information about that star in the newly created .mag.1 file. When all five stars have had their turn with the spacebar, hit "q" twice. The .mag.1 file should now be created.
4. Repeat the above process for every image. The parameters can change from image to image, but they cannot change within an image. Still, if you always choose similar-sized stars, your parameters won't change much, so the job isn't quite as tedious after the first image. If you need to, to get to the aperture parameter, epar into phot and :e into photpar. To find annulus and dannulus, epar into phot and :e into fitskyp.

Choosing Images
1. Because you only need 4, 12, or 20 images to stack, you only need .mag.1 files for that many images. Of course, having more doesn't hurt, but you should only include more than the required number if you have that many good, usable images. To pare the list down, start throwing out less-than-ideal images: those with high FWHMs, those with any streaking or other large-scale structure, etc. To make things easier later, I usually delete the .mag.1 files of the images I'm not going to use, just so there's no confusion. If and when you throw out images, note the reason in images.info. Also, note in the stacking directory, in a notes file, how many images of each field you used, and which images, if any, you rejected (see notes.master.txt in pawnee:/data/stack for an example).
2. Now you need to choose the "center" of all your images. This is exactly what it sounds like: the "center" image is the image around which all the other images are best centered. You need to choose a center from all images in a FILTER PAIR, not just a single filter. So, for example, for 8615/8685, you'll choose the best center image out of the 40 images in both filters. To do this, make a list of all the images and prevu the list (prevu @images.list). Put your cursor on a star, leave it there, and hit spacebar to cycle through the images. Notice how the star moves around your cursor, and note an image that seems to be in the center of all the others. Copy that image's .mag.1 file up a directory (for example, to WYSCH/19 or ELAIS_N1/04) and rename it centerFILTER.mag.1. For FILTER, use the lower filter in the filter pair (so if you're working with 8615/8685, the center will be named center8615.mag.1).
Get .mag.1 Files
3. Copy, from a field's photometry directory, the .mag.1 file that corresponds to your "best estimate of center" image for a given field/filter pair to, for example, /stack/wysch/19/. Name it centerFILTER.mag.1, where FILTER is the lower filter in a filter pair. Thus, each field directory will have a collection of centerFILTER.mag.1 files, where FILTER is 7598, 8132, or 8615.
4. Copy, from a field's photometry directory, all .mag.1 files to, for example, /stack/wysch/19/8132 and /stack/wysch/19/8199.