Aperture Photometry

Once you have reduced your CCD images, there are many ways to do photometry on them.

Photometry with imexamine
Photometry with daofind Creating DS9 Region Files
Instructions for using Phot Running Phot in Batch Mode
Running Phot in Interactive Mode

Photometry with imexamine

Imexamine is the most useful task when getting started with photometry. It can be accessed from the cl prompt and any other package. Enter imexamine filename for the image you want to look at. (If you don't enter a filename, IRAF will prompt you for one.)

The cursor will jump to the image on display in DS9, and the arrow will change to a blinking circle. This represents the annulus which will be used to measure the counts on a star and the average background around the star.

Imexamine will display information about the area under the cursor when you hit certain keys. Be sure that each time you want to get information, the DS9 window is active. (You may have to click on the window to make it active. You can also change the computer settings so that the window in which the cursor is located will become the active one. Go to Programs Settings GNOME Control Center and then click on Focus Behavior and edit the parameter When does the mouse pointer affect the input focus.)

Here is a list of the key commands that will probably be most useful for you. You can get more details about the commands, as well as a full list of the Cursor Key Commands by entering help imexamine.

? Print help. This also will give you a listing of the Cursor Key Commands and descriptions of the outputs for 'a' and 'r'
a Prints useful information about the star under the cursor.
First, the parameters will be listed in two rows, and then the values will be listed underneath in the same fasion.
c Displays a 2D graph for a column of data through the cursor position.
d loads a new image without having to quit imexamine
The cursor will move to the IRAF command window, and you will be prompted for a new image to display.
e Displays a contour plot for the area beneath the cursor.
l Displays a 2D graph for a horizontal line of data through the cursor position.
m Prints statistics about the area under the cursor (such as mean, median, mode, and standard deviation)
q Quits imexamine
r Displays a radial profile of the star under the cursor. IRAF will fit a Gaussian to the data points, which will also be plotted.
s Displays a surface plot for the area under the cursor.
x Prints the cursor's coordinates
, Prints more information about a star under the cursor, including the Maximum Full Width Half Max (FWHM)

If you want to change the way imexamine does photometry, you can check the parameters by entering epar imexamine. You can also change parameters for the 'r', 'c', and 'h' commands by entering epar rimexam, cimexam or himexam.

epar rimexam is the most useful because you can change the aperture radius.

Photometry with daofind

Daofind is a useful task for examining star clusters, because IRAF will automatically find stars using an algorithm and do photometry on them. To access this task, open the digiphot and then apphot packages.

Before running daofind, you will need to take some preliminary measurements with imexamine. Enter imexamine, and place the cursor over random spots in the sky. Press 'm' to print statistics about the area under the cursor. Note the standard deviation value (sigma) for the sky. Do this several times and decide on an appropriate approximation for later.

Now place the cursor over a star. Press 'r' to see a radial profile for the star. Estimate the Full Width Half Max (FWHM) by choosing the radius which seems to intersect with the value half the height of the Gaussian. The FWHM is twice the radius. Check your estimate by viewing the radial profile for other stars. The FWHM should be about the same for all of them, and a value between 2 and 4 is normally fine. Stars which have saturated the CCD are not good for estimating the FWHM. Another good way to check is to press ',' while the cursor is over a star. This will print data about the star, and the last column shows the Maximum FWHM. However, it is better to view the radial profile and choose an integer value for the FWHM.

Quit imexamine by pressing 'q'.

Now enter daofind. IRAF will prompt you with the following:

input image: enter the filename for the image you want to process
FWHM of features in scale units: enter the FWHM you estimated earlier
standard deviation of background in counts: enter the sigma value you chose earlier
detection threshold in sigma: enter a whole number
When daofind is examining the image, it will use an annulus with a diameter equal to the FWHM to find the peak number of counts inside and then estimate the average background count behind the star. It subtracts the background count from the peak, and then divides that value by sigma. If the quotient is above the detection threshold, that spot will be counted as a star.
It is wise to choose values from 4 to 6, although the values can vary, depending on the data. The higher the threshold, the fewer false stars will be detected. However, daofind may not pick up other real stars if the threshold is too high.
minimum good data value:
maximum good data value: set the min value very low, and the max value very high. 1000 and 60000 are good values, unless all your stars are near saturation. Then 1000 and 65000 will be more appropriate. (These numbers are for the Brackett telescope CCD chip, which saturates at 65000 counts.)

When daofind is done examining the image, it will create a coordinate file with the same name as the image, but with a .coo tag. The tag will be numbered. You can run daofind again to experiment with the parameters. Each time you do this, a new file will be created with the next number (ex: *.coo.1, *.coo.2, etc). Increasing the threshold, increasing the sigma value or increasing the FWHM will all cause fewer stars to be detected. Decreasing the threshold, decreasing the sigma value or decreasing the FWHM will all cause more stars to be detected, with a greater likelihood of false detections. It is best to try a few settings to attain the best possible results. It is not likely to get daofind to recognize all the stars that you can see. It is satisfactory to find the most prominent ones. The few that cannot be recognized without receiving large amounts of false detections are most likely not worth the trouble, since their data is weak.

To see what stars daofind has registered, you can view the .coo files in emacs, type more filename in the Unix command window or type ! more filename in the IRAF command window.

NOTE: The ! indicates to IRAF that you are using a Unix command. Simple commands like ls and cd do not need to have an ! before them, but more or less do.

The .coo file will contain information about the parameters you chose, some statistics, and photometric data. In the last column, each star is numbered. Look at the first two columns for the stars' coordinates, and check to see which are actual stars and which are false.

Checking Stars Found with tvmark

Tvmark is an incredibly useful command that allows you to see and edit the stars found by daofind. You can edit the parameters by entering epar tvmark to mark the stars in a variety of ways.

mark Determines what type of mark is used on top of the stars found in the coordinate file.
cross -- displays an x on top of the star
point -- displays a dot on top of the star
circle -- displays concentric circles over the star
rectangle -- displays rectangles over the star
plus -- displays a + on top of the star
color Determines the marking color
202 -- black
203 -- white
204 -- red
205 -- green
206 -- blue
207 -- yellow
208 -- cyan
209 -- magenta
label yes will cause the star coordinates to be printed with the mark
no will turn this option off
number yes will cause the star number to be printed with the mark
no will turn this option off
The stars do not have to be numbered in the coordinate file in order for this to work. Tvmark will number them in order
pointsize Determines how big the points will be if "point" is the chosen mark
txtsize Determines how big the text will be, and the marking size if "cross" or "plus" is the chosen mark
interac yes turns interactive mode on, and no turns interactive mode off
An easy way to change this parameter without having to enter the parameter listing, is to type interac+ with the tvmark command to turn interactive mode on or interac- to turn interactive mode off
radii Determines the sizing of the concentric circles if "circle" is the chosen mark.
Separate the various radii sizes by commas when you want to use more than one circle
nyoffest Determines the X and Y offset (in pixels) for the star numbers.
If these options are set to zero, the numbers will be displayed with the lower left corner at the center of the mark. With some markings, the number will be nearly impossible to read unless you modify this parameter

Before executing the tvmark command, the image you want to mark must be displayed. Note the frame in which the image is displayed.

Now you can enter

tvmark frame coords=coord_filename
at the ap prompt. For example, if I have just displayed an image, ngc6811.fit, in frame 1 of DS9, I can mark the stars that daofind found by typing:
tvmark 1 coords=ngc6811.coo.1
The marks will be displayed directly on the frame.

Running tvmark in Interactive Mode

When interactive mode is turned on, the cursor will change to a blinking annulus. You can execute a number of tasks by using keystrokes.

You can put marks on the frame by pressing:
+ for a plus sign
x for a cross
. for a point
c for concentric circle
r for rectangles
l marks all objects on the coordinate list
a adds the object nearest the cursor position to the coordinate list and marks it
d deletes the object nearest the cursot position from the coordinate list and marks it
Remember, when you are deleting points from the coordinate list, the markings will not disappear. It is not until you reload the display and reload tvmark will you see that the coordinates have been deleted.
q quits tvmark

These are the important keystrokes you need to know when editing a coordinate file with tvmark. For a full listing, enter help tvmark in the IRAF command window.

After running daofind, use tvmark to see which stars have been picked out. If a few stars have been left out, you can add them, and false detections can be deleted. This is extremely useful so you don't have to run daofind multiple times to get completely satisfactory results.

Creating DS9 Region Files

You can also create region files with the coordinates given by daofind by using the task txdump. It will work in the same package as daofind. Just enter digiphot and then apphot.

Don't worry about setting parameters. All the parameters you will need can be entered with the command as follows:

txdump filename XCENTER,YCENTER > filename.reg

For example, if I want to dump the X and Y coordinates from ngc6811.coo to make a region file, I will type:
txdump ngc6811.coo.1 XCENTER,YCENTER > ngc6811.reg

You can also number your region files (*.reg.1, *.reg.2, etc).

The XCENTER and YCENTER are parameters for the contents of the .coo file that I want to dump into another. You can choose other parameters, like MAG or SHARPNESS, but these parameters are not appropriate for region files. Whichever you use, be sure that the parameter names you enter match up with the ones in the file from which you are dumping text.

Once you create the region file, you can load it in DS9 by choosing Region Load Regions from the drop down menu bar. However, be sure that you have changed the File Type to XY before loading. (See DS9 Guide.)

Instructions for using Phot

Phot is IRAF's basic photometry package. It can be loaded by entering digiphot and then apphot starting from the cl prompt. The phot task has five parameter lists with lots of variables, but IRAF will prompt you only for the critical ones.

Entering epar phot will bring up the main parameter list. The important variables that you will need to change are:

image the name of the file you're doing photometry on
output = default The default setting will attach .mag to the end of the filename, with a number. You can choose an alternate filename for the results if you like.
coords the name of the coordinate list you are using
Any .coo or .reg type of file, such as the ones creates with daofind, should work.
interac = no Interactive mode is on when "yes" is entered. Batch mode is on when "no" is entered.
In interactive mode, the cursor will change to a blinking annulus before doing photometry. It will then wait for key commands before running. This will happen even if you have specified a coordinate file for phot to use. Type in help phot in the IRAF command window to see a full list of the key commands.
In batch mode, phot will not prompt you for any key commands. It will automatically run through the coordinate file you have specified. You will also be prompted for the vital parameters. You should run phot in batch mode unless you want to check your photometry by varying the parameters before saving the results to file.
An easy way to change this parameter at the command prompt is to type interac+ to turn interactive mode on or interac- to turn interactive mode off. This parameter should be assigned after typing in the full command.
verify = yes make sure that verify is on so that the critical parameters in using phot will be verified when you are in batch mode

You can use .coo files created by daofind, but if you want to perform photometry on a few specific stars, you can create your own coordinate files in ds9. Just place regions around each star, take note of the coordinates, and save your work under Region Save Regions. Then give this filename to the phot menu. (Make sure the Region Type is set to XY).

The phot menu also displays the names of the four other parameter listings: datapar, centerp, fitskyp, and photpar. If you have files which contain listings for these parameters, you can enter them in the epar phot listing. For more information on the essential parameters, type in help phot in the IRAF command window.

Running Phot in Batch Mode

There are various parameters the phot command uses in order to do photometry. You will be prompted for the most critical parameters. Just make sure interactive mode is off, and enter

phot filename coords=coord_filename

You will be prompted for several parameters:

Input image: enter the image you want to do photometry on or press enter to accept the one in parenthesis
Centering algorithm (centroid): controls the centering algorithm, which finds the stars' centers
If you are using the coordinate file from daofind, then the centers are probably good enough, and you can choose none. (It saves a tiny bit of time.)
If you created your own coordinate list or you have chosen a number of stars manually with tvmark, choose centroid. (This is the default, and if shown in parenthesis, just press enter.)
Centering box width in scale units: controls the size of the box that IRAF uses to find the stars' centers
The default is 5 pixels, and normally good enough. If this is the number shown in parenthesis, press enter or enter your own value.
Be sure that the cbox size is not too high, or else more than one star may fit in the box and cause confusion
Sky fitting algorithm (centroid): This algorithm controls how the sky value is calculated from the annulus
You can choose from mean, median, mode, and centroid. Massey and Davis, authors of A User's Guide to Stellar CCD Photometry have suggested using mode.
Centroid is the default, and will probably appear in parenthesis everytime you run phot. Just enter the algorithm you want, or press enter to accept the one in parenthesis.
Inner radius of sky annulus in scale units: choose a radius or press enter to accept the one in parenthesis (10 pixels is a good choice)
Width of the sky annulus in scale units: choose a width for the sky annulus or press enter to accept the one in parenthesis
File/list of aperture radii in scale units: change the aperture radius or press enter to accept the one in parenthesis
A number around twice the FWHM is good for fitting the entire star inside aperture radius.
Minimum good data value (INDEF): press enter to accept "indefinite", unless you have an idea of what you want the datamin to be
Maximum good data value (INDEF): press enter to accept "indefinite", unless you have an idea of what you want the datamax to be

The resulting file can be opened in Emacs, and will include values for the star's location, sky values around it, total counts within the aperture, flux, relative magnitude, and its error.

Running Phot in Interactive Mode

If you leave the interac parameter set to "yes" in the epar phot listing, the cursor will become a blinking annulus (just like imexamine), even if you have specified a coordinate file. However, interactive mode can be useful because you can edit the critical parameters and view the photometric results before saving it to an output file.

Enter phot filename at the ap prompt to start. The cursor will jump to the image display and become a blinking annulus. You can execute commands with the following keystrokes. (For a full list, enter help phot in the IRAF command window.)

v the IRAF window will prompt you for the critical parameters
w saves the parameters to the essential parameter listings
i allows you to interactively set parameters with the current star
A window will appear. Press enter to accept the extraction width. A radial profile plot will appear. Press ? to see a list of keystrokes you can use to interactively set certain parameters. Press q to quit
f prints photometry for the current star in the IRAF command window, but does not save it to the output file
space does photometry on the current star and saves it to the output file
m moves to the next star in the coordinate list
When you start phot, it will not start using the stars on the coordinate list until you press 'm'. The cursor will not jump, but if you keep pressing 'm' and then 'f', you will see that the data changes.
n does photometry on the next star in the coordinate list and saves the data to the output file
l does photometry on the remaining stars in the coordinate list and saves the results to the output file
r (rewind); sends the coordinate list back to the beginning
You will have to press 'm' again in order to go to the first star on the list. Otherwise you will stay on the star you were using before the list was rewound
q exits phot

If you have saved any information to an output, the output file will be labeled with the image name and .mag with a number.

You can also do photometry in interactive mode without a coordinate file. Be sure that the coords parameter in epar phot is empty. Run phot and use the cursor to choose the stars you want to examine. In this case, the following commands may be useful:

c fits the center for the current star
t fits the sky around current centered star
p does photometry on the current star using the current sky
o does photometry on the current star using the current sky, and saves the results to the output file

Pressing these key commands in order will help get the best magnitude for the star