Surface and Contour Plotting with IRAF


IRAF is a collection of image analysis software aimed at professional astronomers. It can be difficult to use but it has some interesting functions. IRAF runs on Linux on the command line. I use a Linux machine from Amazon's EC2 service where I have installed the required software and run xming, an X-Windows sever, on my local Windows machine.

This tutorial assumes IRAF is installed. Some familiarity with IRAF is helpful but not necessary. A Beginner's User Guide is available.

An IRAF working environment also requires xgterm and ds9. Xgterm is an extended graphics enabled X-windows xterm and ds9 an image display program. There is also a windows version of ds9. Xgterm is installed as part of IRAF. ds9 is usually a separate installation.

If you do not have an image in FITS format, you can use this FITS file of NGC 2903 to follow this example.

Running IRAF

Start the IRAF Command Line

  1. Run xgterm from Linux
  2. Within xgterm run cl from the directory where the FITS file is located - this starts the IRAF command line
  3. On the cl command line, enter 'imstat {filename}' - to make sure IRAF can find the FITS file. This should produce something like:

    M101.fits 10296576 2049. 422.4 6. 55938.

Run ds9 to create a Surface Plot

  1. Run ds9 from Linux
  2. Load file: File->Open, load the FITS file
  3. Scale image: Scale->ASINH, Scale->99.5%
  4. imexamine - On the cl command line enter imexamine. This changes the DS9 cursor and IRAF will use the current DS9 image for analysis
  5. Select: In DS9, left click an object in the image in the image and press s. This opens a surface plot.
  6. Modify parameters: Enter epar eimexam - to change plotting parameters, ncolumn, nlines, floor, ceiling. Then replot.
  7. Return control to imexamine: With the mouse focus in ds9, press q, returns control to imexamine

For any specfic image you will have to adjust the floor, ceiling, ncolumn and nlines parameters. The floor parameter is used to ignore background noise. Set floor a litle higher than the background noise level. Set ceiling a little higher than the highest value. ncolumn and nlines are the number of pixels to plot centered on the location of the mouse click.

Run ds9 to create a Contour Plot

  1. Select: In DS9 image left click on an object in the image and press e. This opens a contour plot.
  2. Modify parameters: Enter epar simexam - to change plotting parameters specific to your image, ncolumn, nlines, floor, ceiling. Then replot.
  3. Return control to imexamine: With the mouse focus in ds9, press q, returns control to imexamine
The only way I have found to create jpg images of these plots is to use Alt-PrtScn from the X-Server running in windows and copy and paste to another document.

NGC 2903 in DS9

NGC 2903 Surface Plot

NGC 2903 Contour Plot