Astronomy 480 - IRAF Tutorial for Exercise IV
Aperture Photometry

Learning Goals

Files Used

Processed images of M92 taken through blue and visual filters.

Aperture Photometry Exercises

This exercise will lead you through some basic steps dealing with the measurement of instrumental magnitudes for a few stars and then the calibration of that data to a standard photometric system. We will use tasks in the DIGIPHOT and APPHOT packages. We will be using the data that was processed in Exercise 2; these were the M92 images, provided courtesy of Dr. George Jacoby. These images should have been reduced using the CCDPROC task as part of that exercise and should now be ready for doing photometry.

warning[NOTE: If you chose not to clobber the original images in the last IRAF exercise and have your images named something other than m920004, m920005, etc., then you may need to choose among 1) redoing CCDPROC and clobbering original images, 2) moving the newly-named, processed images to m92????.fits, or 3) changing every reference below to m92*, etc. to whatever your new file names were.] If you still have m92.tar file in your exercise2 directory, it may be a good idea to move or delete it.

You are logged into IRAF in an xgterm window, with DS9 running as well, and in the directory where the m92 processed images are. We will make photometric measurements on the four images of M92, two through the V filter and two through the B filter. Check to be sure the frames have been processed:

ecl> dir # good way to see if you are where you want to be!
ecl> imhead m92* lo+ | page # what do you want to look for here?

Patching image headers

First, fix up our image headers. There are several bits of information that we will be using during the photometry phase of the reductions, and we should check to be sure our headers are prepared properly. We will need the exposure time, the filter identification, and the airmass. The airmass is effectively the number of atmospheres through which the image was taken. An image taken straight overhead has an airmass of 1.0, and the airmass increases as the telescope is pointed towards the horizon. Inspect one of the headers you got listed just above that should still be displayed on your screen. Is there any reference to airmass? If there is, then simply read through the next part, noting the process carefully for possible future use.

Setting the airmass

We see an EXPTIME keyword and a FILTERS keyword, but there does not appear to be any reference to airmass. Let us first set the AIRMASS keyword in our headers. Use the task SETAIRMASS in the ASTUTIL package to do this. The information required by this task to compute the effective airmass for the exposures is in the image headers.

cl> astutil # load the package
as> phelp setairmass # learn what each task totally does; don't be a bad robot
as> unlearn setairmass # always a good idea when starting a new task
as> lpar setairmass # see what’s there
as> setairmass m92* update- # type kpno when prompted for the observatory
as> setairmass m92* # this actually carries out the operation

hintKnowledge Check: What are the values for the airmass for 4 object images? ________ _________ _________ _________What value for airmass is actually used? _____ Starting? ______ Middle? ______ Ending? The changes in airmass for the images taken through the blue filter are greater than those through the visual filter because the exposure times for the blue images are twice as long as the visual ones. List two reasons why the blue images would need a longer exposure time to reach a similar flux level as the visual ones.


as> imhead m920006 lo+ | page # notice the new keywords added
as> bye # unload the last package loaded, if you want

Aperture Photometry

Now we are ready to proceed with the aperture photometry measurements. Load the DIGIPHOT and then the APPHOT packages.

ecl> digiphot  
di> apphot  

Now decide the size of the aperture radius for doing the photometry. This radius will depend on the FWHM of the stars. We can measure the FWHM with IMEXAMINE.

ap> display m920004 1  
ap> imexamine  
# put the cursor on a bright star
r # type the letter r to get a radial profile

hintNOTE: Recall that three values of the FWHM are printed at the end of the status line on the bottom of the plot; each value was computed using a slightly different algorithm.

A good rule of thumb is that the photometry aperture radius should be 4 or 5 times the size of the FWHM, to insure that we measure all of the light. Since our FWHM is about 3.0 pixels that would indicate that we should use ~12-15 pixels for our aperture radius. The tradeoff is that the 12-15 pixel radius would include a lot of sky background photons. Since our stars are relatively faint we may want to consider using an aperture radius of 10 pixels. Since we want to simplify things and use the same radius for all frames, let’s verify that the FWHM is about the same for the other frames and that we will get "almost all" of the light through the 10 pixel aperture. Continuing with our use of IMEXAMINE started just above move your cursor to the image window (DS9):

Do not use the following keystroke instructions in an absolute sense as part of the steps may be missing. Think about what you have done, what you are doing and what you need to do. This takes practice and you should not become discouraged. (Deeper meaning: Students before you have.)
d # display m920005 in buffer 2
r # measure a couple of stars
d # display m920006 in buffer 3
r # measure a couple of stars
d # display m920007 in buffer 4
r # measure a couple of stars
q # quit

Use the task QPHOT, in interactive mode, to measure some stars in the first field. Run EPAR on the task and edit the parameters until they look like those below. (Some parameters were left blank on purpose; figure it out.)

ap> unlearn apphot # get into habit when starting NEW task
ap> epar qphot  
image = "m920004"          Input image
cbox = 5.          Centering box width in pixels
annulus = 15.          Inner radius of sky annulus in pixels
dannulus = 10.          Width of the sky annulus in pixels
aperture  = "10"         List of photometry apertures
(coords = "")          Coordinate list
(output = "default")          Results file
(plotfile = "")           Plot metacode file
(zmag = 25.)          Zero point of magnitude scale
(exposure = "exptime")          Exposure time image header keyword
(airmass = "airmass")          Airmass image header keyword
(filter = "filters")          Filter image header keyword
(obstime = "ut")          Time of observation image header keyword
(epadu = 14.)          Instrument gain
(interactive = yes)          Interactive mode
(radplots = "yes")           Plot the radial profiles in interactive mode
(verbose = no)          Print messages
(graphics = "stdgraph")   	Graphics device
(display = "stdimage")     Display device
(icommands = "")          Image cursor: [x y wcs] key [cmd]
(gcommands = "")          Graphics cursor: [x y wcs] key [cmd]
(mode = "ql") 

You might have noticed a slightly different order of a couple of the parameters. Don’t worry about it; just make sure the parameter values are good.

hintNote: You will be working in interactive mode! While you are in interactive cursor mode you must initiate commands from the active window - there is only one active window at a time although you may be interacting with three windows during one task execution: the text window, the plot window, and the image display window. If the image cursor is blinking then it is the active window. If the text window has dumped some information to the screen and is waiting for a pagination command or a "q", then it is the active window. It may require a bit of practice to acquire the "feel" of this, and you will experience some "hang-ups."

M92 numbered star field

We will now get ready to execute QPHOT. We will determine the query parameters interactively when we actually get into QPHOT. When "eparing" QPHOT, you set cbox=5, annulus=15, dannulus=10, and apertures=10 in the parameter file. The annulus is the radius of the inner sky annulus, and dannulus is the width. (Recall the points previously made about different ways of setting annuli when doing photomety.)

A "finding chart" of the field is included here. We will measure 9 fairly isolated stars, as numbered in the M92 image shown at the left.

If you have a graphics (plot) window currently active, delete it by clicking on the "X" in the top right corner of the window. Now we’ll run through an interactive session of aperture photometry.

ap> display m920004 1

# You may already have it displayed!

ap> qphot m920004  

In response to the questions, pick:

(You’ll get a warning about graphics overlay not available. Ignore it.) Type:

? # list cursor options
Skim the options. Name an option that might be helpful if you were doing photometry on 1000’s of stars: _______________
q # to quit the help listing

You should now have a blinking donut in the DS9 window! Line the "donut" up on star 6 as defined by the finding chart, then enter the "interactive" photometry mode by typing

i #enters interactive photometry mode

This will bring up a new graphics window, and it will prompt you (yellow strip at the bottom) for the radius of the extraction box and the rest of the photometry parameters as given in the following table. When you see CR, that stands for carriage return (from antiquity) or hit the "return" or ¬ Enter key. These steps are tricky!

Graph window says:

You do and/or type:

Radius of extraction box in pixels (15.0) (CR or value):

25

return Enter (return)

Waiting for setup menu command (?=help, v=default setup, q=quit):

v

return Enter (return)

You should get at this point the typical "imexamine" radial plot for the star, except this time you’ll be able to set the aperture photometry parameters interactively, presumably based upon what you see in the radial plot.

Mark centering box half width (2.5) pixels:

Line up vertical crosshair at 2.5 pixels

return Enter (return)

Centering box width in scale units (4.92....) (CR or value):

5

return Enter (return)

Mark inner sky radius (15.) pixels:

Line up vertical crosshair at 15 pixels

return Enter (return)

Mark outer sky radius (25.) pixels:

Line up vertical crosshair at 25 pixels

return Enter (return)

Width of the sky annulus in scale units (9.9....) (CR or value):

10

return Enter (return)

Mark apertures (10.00) pixels [q=quit]:

q

File/list of aperture radii in scale units (10) (CR or value):

 

return Enter (return)

Waiting for setup menu command (?=help, v=default setup, q=quit):

q

The cursor now jumps back to image. Make sure it does and you recognize it!

Notice that photometric information is printed on your screen for this star: center (x and y), sky, magnitude, error (if any). Also, you get a nice radial plot that shows the photometry aperture, as well as the sky regions.

We are now going to follow a series of steps to do photometry on the stars, looking at the radial profile plots for each star as the measurements are made. First, place the cursor over the DS9 window and save the settings with w:

w # save the parameters that we just computed by typing this in the image window

By placing the cursor over the correct star and pressing the "space bar," do photometry on the following stars: 6 (you must measure star 6 again since the first part was simply setting the parameters), 9, 5, 8, 7, 23, 13, 20, 18 - Double check to make sure you have all the stars!

q (in image window –cursor jumps to text window–

w in text window to "write and quit")

hintNOTE: You may see an ‘err’ come out from a measurement. At this point, it is probably due to the centering of the star. The magnitudes that are calculated may be off by a bit. We found it helpful to zoom in on the star we were measuring, and then use the "close-up" window in the upper-right-hand-side of DS9 to center the star more accurately. If you do another measurement within this qphot "session," then that star will be counted twice. You may choose to live with the error for now, or get other alternatives by asking.

All of your measurements should have been saved in a file: the image name plus .mag.1 appended. Do a ‘dir’ to check. Look at the m920004.mag.1 file, using the page command. There is a whole lot of information here!

hintCheck Understanding: Each star gets 5 lines of data in the .mag file. Somehow, the task txdump that we will use knows how to find certain information and only that information. For star #6 (and, without using txdump yet), in its .mag file, find and list here the values for: XCENTER YCENTER SSKEW IFILTER OTIME.

We can easily pull out selected information from this file with the TXDUMP command. We can also plot the errors in the magnitudes against the magnitudes themselves to see if there is any trend. Please do the following steps.

ap> lpar txdump # a clue to the meaning of what happens next
ap> txdump m920004.mag.1 image,xcenter,ycenter,mag,msky,stdev yes  
ap>txdump m920004.mag.1 mag,merr yes | graph point+  

That last command sequence should bring up a plot that shows the magnitude error (the y axis) vs. the magnitude of the objects you measured. Notice how the magnitude error increases as the stars get fainter. (Larger magnitude values correspond to fainter stars, remember?) A magnitude error of 0.1 mag corresponds to a 10% uncertainty in the measured flux. Do a similar txdump for the blue filter (m920006). Plot magnitude versus magnitude error for both filters on the same graph and attach to your answersheet for the exercise.

We can run QPHOT on our other three fields using a coordinate list as input and not run the task interactively. But we need to look at one of the B fields first to be certain that there is not too large a shift between it and the V field that we just measured. We do this as follows:

ap> display m920006 1 # You may already have it displayed

Look at star 6 and compare the coordinate readout in DS9 with the position of the star in our TXDUMP list - there is roughly a 5.5 pixel shift in x, and ~2 pixels in y. We are most likely OK, although we will enlarge the centering box to make sure.

Using TXDUMP, create a coordinate list for our stars. Notice that we could apply a shift to this list with the task LINTRAN in the LISTS package, if we needed to. Plot the coordinates back up on the image to verify our identifications. This is done with the TVMARK task, which allows you to place annotations on the DS9 display.

ap> txdump m920004.mag.1 xcenter,ycenter yes > coords  
ap>type coords # see what is in the file coords
ap> display m920004 1  
ap>tvmark 1 coords mark=circle radii=10 color=205 # you can get fancy within TV mark, including adding labels

Now edit the parameter file for QPHOT so it looks like the following. We will make the cbox parameter value a little bit larger to compensate for the shifts in our images.

ap> epar qphot

image = "m920005,m920006,m920007" 	Input image
cbox = 7.           Centering box width in pixels
annulus = 15.          Inner radius of sky annulus in pixels
dannulus = 10.          Width of the sky annulus in pixels
apertures = "10"           List of photometry apertures
(coords = "coords")         Coordinate list
(output = "default")          Results file
(plotfile = "")         Plot metacode file
(zmag = 25.)          Zero point of magnitude scale
(exposure = "exptime")          Exposure time image header keyword
(airmass = "airmass")          Airmass image header keyword
(filter = "filters")          Filter image header keyword
(obstime = "ut")          Time of observation image header keyword
(epadu = 14.)          Instrument gain
(interactive = no)          Interactive mode
(radplots = "no")          Plot the radial profiles in interactive mode
(verbose = no)         Print messages
(graphics = "stdgraph")          Graphics device
(display = "stdimage")          Display device
(icommands = "")          Image cursor: [x y wcs] key [cmd]
(gcommands = "")          Graphics cursor: [x y wcs] key [cmd]
(mode = "ql") 

<ctrl> d OR :go

ap> qphot  
ap> dir *.mag* # there should be a mag file for each image; is there?
ap> txdump m92*.mag.1 mag,merr yes | graph point+  
ap> txdump *.mag* xcenter,ycenter,mag,merr,ifilter yes  

Inspect these lists. Merr is the error associated with the magnitude measurement. A few of these appear high - probably fainter stars? Let’s keep these values, however, we can throw them out later, if we wish. Notice that V = 60 and B = 50 for the filter ID.

References

Does your plot resemble the one on the left below? Our guess is that we are at the red end of the horizontal branch (the two bluest stars in this plot at v ~ 19, but recall that our zero point for the magnitude scale is arbitrary) with some red giant branch or asymptotic giant branch stars. Hard to tell.

M92 partial cmd
M92 cmd