Quick Notes on Using IRAF to Examine Images.

(for AY145)

IRAF is one of the "image reduction and analysis" systems most often used to reduce and analyse data in optical and infrared astronomy. While it is not the only such system available, it is one of the most common. Detailed documentation on IRAF can be found at its home website at NOAO:

  • IRAF Home
  • Also included here is the A Beginner's Guide to Using IRAF by J. Barnes.

    Getting Started

    To invoke IRAF you need a login.cl file in your home or your iraf directory on a CfA supported computer (I usually put it all in a subdirectory called IRAF), a.k.a. /home/huchra/iraf/). You can get a copy of my login file from the website (jph.login.cl) and place in in a subdirectory in your account in a file just called "login.cl." Type "cl" or "ncl" while you are in your iraf directory to get into the IRAF environment. You'll be greeted by a bunch of information and a list of the packages that are loaded. IRAF works by loading in various reduction packages. These include the "tv" package which, when loaded will allow you to display images. For the exercise here load tv and imred by simply typing those package names.

    You also need to set some environment variables and path's. This is what I have for IRAF in my .cshrc file:

    # IRAF package

    # Setup iraf depending on whether SunOS or Solaris system

    if ($OS == 2) then

  • setenv iraf /opt/IRAF/iraf.solaris/
  • if ($HOST != "saturn") source ${iraf}unix/hlib/irafuser.csh
  • # source ${iraf}unix/hlib/irafuser.csh
  • set path=( $path /opt/IRAF/iraf.solaris/unix/bin.ssol )
  • else
  • setenv iraf /OPT/IRAF/iraf/
  • source ${iraf}unix/hlib/irafuser.csh
  • set path=( $path /opt/IRAF/iraf/unix/bin.sparc )
  • endif

    # If using FOCAS under the IRAF package, add following line

  • set path=( $path /OPT/IRAF/iraf.bin.sparc/focas)
  • # The following line hardcopies SAOimage's buffers to the printer

  • setenv R_DISPOSE "lpr -r -s %s"
  • Displaying and Working with Images

    To display a file in IRAF I usually use SAOimage. Open a image display window with "simtool". You will need to have set the DISPLAY environment correctly if you haven't already done so when logging on --- "setenv DISPLAY machine.name:0.0" for example. After you have an image display window (you can also use ximtool), type "display xxxx.imh" to display image xxxx.

    You can do image arithmetic using the imarith routines. For example, "imarith image1 + image2 sum" will add images 1 and 2 and put the resultant image in "sum". You can also combine sets of images using the special arithmetic functions "imcombine", which allows you to combine, say, BIAS frames via several different algorythims such as avesigclip, minmax, crreject (cosmic ray reject), etc.

    There is an overall CCD reduction package called CCDProc.

    The other routines you may need to use are imstat, which will calculate various properties of the images like means and standard deviations (including clipping pixel values that are too high or low, which you will need to do), and possibly imcopy, which will allow you to copy files and also to trim them (i.e. create new files that only have the central, say, 500x500 pixels) using the image section format.

    Manuals for all of these routines can be obtained by typing "help packagename" in IRAF, or "help packagename | lpr" if you want a hardcopy.

    Small details: most unix commands also work directly in IRAF. Your aliases and special commands will not. If there is a normal unix command that doesn't, try "! command" --- the "!" puts you back into the cshell for one line.

    There are many IRAF gurus and accolytes at the observatory, so it should be relatively easy to find help. You don't need to use IRAF for the exercise if you already know another package like AIPS or IDL that can perform the same functions. Doug Mink (dmink@cfa) is the chief guru in the Telescope Data Center, ditto Julie Shaw in the CF. Iraf documentation can also be found at the NOAO website noted above (http://iraf.noao.edu/).

    JPH 3/19/03