How to setup IRAF and useful IRAF commands
Nicole Fields

After IRAF has been installed, IRAF can be run by typing cl at a command line. For display purposes if IRAF is going to run from a non-local machine it might be a good idea to run IRAF from a terminal running on that non-local machine. This is done by typing xterm &. If you want to view any images you will also want to run a viewer like ds9. On this is done by /net/local/user/ds9 &.

Then a script must be created within IRAF with the command mkiraf. You will probably want to do this in a particular directory from which you will always run IRAF. For example my file, along with all of my other IRAF scripts are in /net/user/nfields/iraf. You'll probably want to change few things in the file, so open it up in your favorite web browser. If the images you are working with are .fits images, then you'll want to add a line to the file set imtype="fits,noinherit". Also if you are using an xterm or xgterm you'll want to add stty xterm or stty xgterm. The terminal must be set correctly in order for the displays to work properly.

The next thing to do in order to setup IRAF for doing data reduction is to set an option so that IRAF can properly read the information in the image headers. Load the package noao:imred:ccred. Then run the command setinstrument. When prompted for an instrument ID type kpnoheaders since the data files are from the WIYN telescope on Kitt Peak. This should only have to be done once.

Now that IRAF is setup, you might want to know how to do a few simple things. Once IRAF is running, packages are loaded by typing their names. The whole command does not have to be typed if the command is unambiguous. The IRAF commands that I use regularly are ccdproc, zerocombine, flatcombine, hedit, pdump, qphot, imexamine, imheader, and ccdlist.

The first three of these commands are used in data reduction and are more fully described in that section. hedit is a command that lets you change or view particular header fields of an image file. The difference between viewing and changing a value is the value expression:. This can either be the value to which you wish to change a particular header field, or if it is set to . then the current value is displayed to the screen. The header of an image file can also be edited in any text editor, however, IRAF is very sensitive about the number of characters in a file, so the exact same number of characters must be replaced either with other characters or with spaces.

pdump is a command that lets you retrieve relevant fields from .mag files. These files are created by the qphot command which is more fully described in the photometry section. Both pdump and qphot are located in the package noao:digiphot:apphot. The fields that will likely be useful are mag and merr which are the relative magnitude calculated by IRAF and the error on that magnitude.

imexamine is a command that does several things. It is used in conjuction with the image viewer, which must already be running and have an image open. When imexamine is then run from IRAF the cursor in the image viewer window should change to a small black circle or ring. If , is pressed the coordinates of the pixel that the cursor is on will be displayed in the IRAF window. If r is pressed then a new window should pop up and display a radial profile of the star that the cursor is close to. Do not close the radial profile window once it has opened or IRAF will be very confused. If the ds9 image viewer and IRAF are not working together, be sure and check that the terminal type is set correctly, and that the terminal is running from the same machine from which IRAF is running.

imheader and ccdlist do almost the same thing, except ccdlist gives more information in list form such as the filter, the ccdtype (zero,flat or object), and what operations have been performed on a given image. ccdlist will also prompt you for the file list if it is not given as an argument, but the package noao:imred:ccred needs to be loaded. imheader needs to have the files given as an argument and gives less information in list form. imheader can also be used with the additional parameter lo+ which will give the long form of the header of the image. This will display all of the header fields.

Lastly a little bit about some general IRAF things. Once packages are loaded, if you want to exit them typing bye will exit the package. logout will exit IRAF entirely. As far as I know IRAF does not tab complete like a normal shell does. The closest thing thing that IRAF has to this is a history function. If at an IRAF command line you type the command e it will bring up the last command the was typed in. At this point you can use the arrow keys to navigate the history and change the commands the same way as you would in a shell. This feature will save time and typing effort.

Back to the REU homepage!
REU homepage