DAOPHOT - UMKCgeg/Wiki GitHub Wiki

DAOPHOT is a tool to do profile fitting photometry, which is useful in crowded fields. It can be a complicated tool to use, but sometimes is the only tool that will produce correct results. This page describes how to use DAOPHOT from start to finish. There is a standalone version of DAOPHOT, but there is also a version contained in IRAF, which is nice.

The following tutorial assumes you need to find your stars, and relies on scripts. If you already know where your stars are, and want an introduction to using the command line interface, check out this pdf. It also contains good descriptions of a lot of the DAOPHOT parameters.

Setting up Parameters

DAOPHOT has a ton of parameters that you can get totally overwhelmed with. There are datapars, centerpars, findpars, fitskypars, photpars, and finally daopars. There are also two ways to use these parameters. You can either modify them in your IRAF session with epar, or save them to a file for future use. Writing them to a file is often the best choice, so you don't have to re-input everything if you start a new IRAF session. To do this, use epar to edit all your parameters of choice. Before exiting, press :w to write the parameters. They will likely be written to somewhere in your iraf/ directory, but it should tell you where it wrote them. You can move the written parameter files wherever you want, and pass them in to other DAOPHOT functions.

Key parameters

While you should look through all the parameters to see if there is anything that is of importance to your specific case, there are a few highly-important ones that you shouldn't neglect. These are broken down by type.

daopars

The whole daopars file is important. Look at it carefully.

photpars

  • apertures: Aperture radius for the initial aperture photometry.
  • zmag: Zeropoint of the magnitude system you want to use.

fitskypars

  • salgorithm: Definitely the most important thing in this file, this sets the method for determining the sky value. The default value mode should work well in most cases, but a constant value might be good too.
  • annulus and dannulus: Radius and with of the sky annulus.
  • skyvalue: Value of the background. This will be subtracted off everywhere.

datapars

  • scale: This is a weird parameter, but if you leave it set at 1, all other values will be in pixel values. This is probably the easiest way to use DAOPHOT.
  • fwhmpsf: Full Width at Half Max of the PSF. This can be a rough estimate.
  • sigma: This is the standard deviation of the background.
  • Most of the other parameters are only used for errors, so input them if you want DAOPHOT to give you good errors. If you're going to calculate your own errors, you don't need to worry about these.

Note:

You can always run help name_of_task in IRAF to get the documentation. Running help daopars, for example, will give you explanations of all the parameters in the daopars file.

Creating PSF

Creating a good PSF is the most important part of using DAOPHOT. To do this, you'll need to create a list of PSF stars that DAOPHOT will combine to make the PSF. You can either run the following tasks from the command line, or create a script. I prefer to create an IRAF script, since it is easier and doesn't involve using epar a bunch on the following commands.

daofind image datapars=datapars.par 
phot image datapars=datapars.par photpars=photpars.par fitskypars=fitskypars.par
pstselect image datapars=datapars.par daopars=daopars.par interactive=n0

You can do interactive mode on pstselect if you want, but I didn't have much luck getting it to work properly. I manually selected stars afterward. Note that the daofind, phot, and pstselect commands output catalogs that are named by DAOPHOT. If you want to name them yourself, you can do that by passing in the appropriate parameters.

This process creates a catalog of the objects most likely to be stars in your image, which is stored in the output of the pstselect command. They may not be good, though, so we should go through them manually to verify. It can be helpful to create regions files from the pstselect output, so I wrote a Python code snippet to do that.

from astropy import table
stars = table.Table.read(pst_output, format="ascii")
with open("pstselect.reg", "w") as reg:
    for line in stars:
        reg.write("circle {} {} 12".format(line["XCENTER"], line["YCENTER"]) + " #text={" + str(line["ID"]) + "}\n")

That last line is ugly since formatting when {} are involved is tricky. It makes circles around the stars, labeled with their ID. If you want to adjust the size, change the 12 if the beginning of the last time to whatever you want.

You can then open the image in DS9, and load the regions file. When doing this, it can be helpful to open the same image in two frames with different scaling. Having one zscale, and another minmax with log scaling, provides a good way to see both the small details around objects on the zscale frame, as well as the absolute brightness on the minmax frame. This shows what that might look like.

Then verify each star visually and with imexam (especially the radial plot) to see that is is unsaturated, actually a point source, and not contaminated by other objects. Make a copy of the pstselect output file, then delete objects from it that you deem to be not proper stars. The ID is in the regions file, which should make that process easy.

Once we have a clean selection of stars, we can simply run the psf command, using our manually selected pst output file. You can put this one line in an IRAF script, or epar the psf command to the proper parameters.

psf image pstfile=manual_pst.cat datapars=datapars.par daopars=daopars.par interactive=no

This will create our PSF file. The file isn't quite what you would expect. All the info about the shape of the PSF is in the header of the file, while the data (that would show up in DS9, for example) holds the residuals of the average PSF from the model.

Doing Photometry

From here, we are ready to do the photometry process. If we know the locations of our objects that we want to fit, we have to rerun both phot and allstar (the first does aperture photometry to get a rough first guess, then the second does the actual profile fitting). We can use the following command (again formatted to be inside a script).

phot coords=your_coords.txt output=forced_coords.cat datapars=datapars.par photpars=photpars.par fitskypars=fitskypars.par
allstar photfile=forced_coords.cat datapars=datapars.par daopars=daopars.par

Use the wcsin parameter in phot to tell the code whether your input coords file is in ra/dec or pixels.

The allstar command produces a bunch of outputs. Assuming you left the output files at their default names, the main ones are the image.als.# catalog, which are the photometry catalog, and the image.sub.#.fits, which is the image with the objects subtracted. The # in each output is a number. DAOPhot won't overwrite any of your old files if you don't specify a name, it will just increment the number. Looking at the subtracted image is a good way to see how well the photometry did. If the stars are gone, and look to be at the same level as the background with no residuals, then the process worked well. This image shows an example of a pretty good vs pretty bad fitting process:

This is two fits done on the same region of space. The dark spots are masks, primarily for extremely bright stars or extended objects. While there is one object that was fit poorly on the left side (and it was likely an extended object), there are many such examples on the right. Some objects weren't subtracted much, and some were over-subtracted. When this happens, it means you need to take a close look at the parameters you used. If nothing changes there, you may need to remake your PSF, being very careful to select only stars that are truly unsaturated, not extended objects, and not contaminated.

If you do not know the location of your sources, things are a little more complicated. The basic idea is to run allstar on the residual image over and over again until all sources are subtracted, but I haven't had to do this. Google is a good resource here. DAOPHOT is a popular photometry code, so you should be able to find a good resource.

Sidenote on Masking

It doesn't seem like DAOPHOT directly supports masking. There is a way to get around this, though. There is a parameter in the datapars file called datamax that can be used instead. By modifying the pixels in the image to be higher than the datamax parameter, you can effectively simulate masking. This modification can be done with astropy or other tools.