Setting up IRAF

IRAF (Image Reduction and Analysis Facility) is now very old, and the the current advice is to avoid using it, or if you really have to use it, run it via the pyraf python module which uses the obsolete (since November 2020) python 2.7 language. There are instructions at http://www.gemini.edu/observing/phase-iii/understanding-and-processing-data/data-processing-software/download-latest

First install Anaconda python (not miniconda) from https://www.anaconda.com/products/distribution, there are some local instructions here. At the end, of the install when it says "set ananconda to automatically intialise" or similar say "yes". See below for the commands I used to get this working. The commands are in bold text.

Check that our python is the anaconda python

(base) rahm@aquarius:~: which python
~/anaconda3/bin/python

(base) rahm@aquarius:~: conda config --add channels http://ssb.stsci.edu/astroconda

(base) rahm@aquarius:~: conda config --add channels http://astroconda.gemini.edu/public

(base) rahm@aquarius:~: conda create -n geminiconda python=2.7 gemini stsci iraf-all pyraf-all

(base) rahm@aquarius:~: conda activate geminiconda
wait a while here....

(geminiconda) rahm@aquarius:~: pyraf
could not open XWindow display
could not open XWindow display

No graphics display available for this session.
Graphics tasks that attempt to plot to an interactive screen will fail.
For help, search "PyRAF FAQ 5.13" or contact "help@stsci.edu".

setting terminal type to xterm...


   NOAO/IRAF PC-IRAF Revision 2.16 EXPORT Thu May 24 15:41:17 MST 2012
      This is the EXPORT version of IRAF V2.16 supporting PC systems.


  Welcome to IRAF.  To list the available commands, type ? or ??.  To get
  detailed information about a command, type `help '.  To run  a
  command  or  load  a  package,  type  its name.   Type  `bye' to exit a
  package, or `logout' to get out  of the CL.    Type `news' to find  out
  what is new in the version of the system you are using.

  Visit http://iraf.net if you have questions or to report problems.

  The following commands or packages are currently defined:

  (Updated on 2013-12-13)

clpackage/:
 adccdrom/      esowfi/         mem0/           rvsao/          user/
 cfh12k/        finder/         mscdb/          softools/       utilities/
 cirred/        fitsutil/       mscred/         sqiid/          vo/
 clpackage/     gemini/         mtools/         stecf/          xdimsum/
 ctio/          gmisc/          nfextern/       stsdas/         xray/
 cutoutpkg/     guiapps/        noao/           system/
 dataio/        images/         obsolete/       tables/
 dbms/          language/       plot/           ucsclris/
 deitab/        lists/          proto/          upsqiid/
PyRAF 2.1.15 Copyright (c) 2002 AURA
Python 2.7.18 Copyright (c) 2001-2020 Python Software Foundation.
Python/CL command line wrapper
  .help describes executive commands

--> gemini
uparm parameter list `/home/rahm/anaconda3/envs/geminiconda/iraf/noao/imred/ccdred/ccdtest/ccdtest.par' inconsistent with default parameters for IrafPkg `ccdtest'
This is the initial release of the IRAF FITSUTIL package
to include support for FITS tile compression via 'fpack'.
Please send comments and questions to seaman@noao.edu.


     +------------------- Gemini IRAF Package -------------------+
     |                 Version 1.14, July 20, 2017               |
     |                                                           |
     |               Requires IRAF v2.16 or greater              |
     |              Tested with AstroConda IRAF v2.16            |
     |             Gemini Observatory, Hilo, Hawaii              |
     |    Please use the help desk for submission of questions   |
     |  http://www.gemini.edu/sciops/helpdesk/helpdeskIndex.html |
     |     You can also check the Data Reduction User Forum      |
     |                 http://drforum.gemini.edu                 |
     +-----------------------------------------------------------+

     Warning setting imtype=fits
     Warning setting use_new_imt=no

gemini/:
 f2/            gmos/           midir/          oscir/
 flamingos/     gnirs/          nifs/           quirc/
 gemtools/      gsaoi/          niri/

Next time you run iraf, you only need to run the commands from "conda activate geminiconda" onwards.

Running IRAF

This note explains a couple of things that need to be done before IRAF (Image Reduction and Analysis Facility) can be used to process data and display images on your workstation.

If you need to reduce gemini data, then there is a separate version of IRAF using the 'Ureka' package. Talk to your system manager.

If you have never used IRAF before the first step is to create a subdirectory, "cd" to it, and type

mkiraf
If you get an error 'Error: current directory is not an iraf user login directory' then try running mkiraf in a subdirectory whose name does not contain the string 'iraf'.

Answer "xterm" when prompted for a terminal type, this assumes you will normally run IRAF in terminal window on an X-windows workstation.

The mkiraf command creates a file called login.cl in your IRAF subdirectory. It is recommended that you do the following:

Edit the login.cl file to change the following line (which will contain your username instead of rahm):

set     imdir           = "/iraf/imdirs/rahm/"
to
set     imdir           = "HDR$"
so that any two part IRAF files created have the header and the pixels in the same directory.

The login.cl which is essential to the running of iraf. You could also create a file called loginuser.cl with a text editor in which you should put any customisations you may need as your become more experienced with IRAF. Edit login.cl as little as possible as mkiraf must be run each time a major version of IRAF is installed so your changes may be lost then.

Starting IRAF

IRAF is started using the cl command, although many people prefer the cl --ecl command which gives you a slightly more modern interface which allows you to recall and edit previous commands using the up-arrow key. When IRAF has started you are presented with an IRAF prompt (initially cl>) to indicate that you should now type IRAF commands.

Image Display

Use ds9 to view images in IRAF.
cl --ecl
!ds9 &
display dev$pix 1
An image of the galaxy M51 (The Whirlpool I believe) will appear in the saoimage window.

Graphics

To plot graphs etc you need to use the xgterm tool which has a graphics plane. If the default fonts are too small, you can all the following to your .cshrc file.
alias myxgterm 'xgterm -fn 9x15bold'

Quitting IRAF

You leave IRAF using the 'logout' or the short version 'log'.

Documentation

In general, IRAF documentation is archaic. You can use "help taskname" or "apropos taskname" to do a keyword search from within IRAF. There is a splendid Starlink document available here.

The iraf home page is here and the FAQ (Frequently Asked Questions) page is very helpful.

Gotchas

You may have problems running iraf if you run the miriad initialisation scripts from your .cshrc file, it is best to start iraf first, then start miriad if you do intend using both together.

Users of RedHat Enterprise may need to run the command below before running IRAF or put it in your .cshrc file.

limit stacksize unlimited

Last modified: Monday, 11 October 2021