GETTING STARTED WITH IRAF
How to Set Up Your Reduction Project on the Ohio University Astrophysics
Workstations
   IRAF (Image Reduction and Analysis Facility) is a large software package
developed by the National Optical Astronomy Observatories (NOAO). At OU,
IRAF is installed on the Sun workstations in room 338. These can also be
accessed remotely from the PC Lab on the 2nd floor.
   IRAF can be set up, run, and used in different ways. The following
scheme is not the only right way to do it, but it is strongly
recommended that new users follow these instructions. It is assumed that
the reader is already familiar with Unix basics and has a helios account.
1. XGTERM Windows
   IRAF should be run from an XGTERM window, not an ordinary "Terminal"
Window. If you don't already have your workspace set up to use xgterms
by default, edit your .cshrc file and add the following:
alias newxg '(xgterm -fn 9x15bold -geometry 80x24+110+100 -sb -rw -bg black -fg white -cr black -ms red -sl 200 &)'
(Be careful, that's one long line!) Exit the editor and type 'source .cshrc'
at the Unix prompt. From now on you will always be able to get a new
xgterm window by typing 'newxg'. You can fiddle with the parameters if
you want a different window size, font, etc.
2. Home Directories
   As far as the Unix operating system is concerned, your "home
directory" is the directory that the system puts you in when you log in.
(It's the diectory where your .cshrc file lives.) The "IRAF home
directory", on the other hand, is the directory you're in when you start
up IRAF. This means that you may, in principle, have several different
IRAF home directories. IRAF home directories don't have to be
subdirectories of your true home directory, they can be anywhere. The
point of this is that you might be working on more than one data
reduction project, each of which requires IRAF to run with different
parameters. If you set up a different IRAF home directory for each
project, and --- this is the important part --- ALWAYS START UP IRAF
IN THE APPROPRIATE HOME DIRECTORY FOR THE PROJECT YOU ARE WORKING ON,
then you will never accidentally operate on one data set using the parameters
for another.
3. Starting a New Project
   To set up a working area for a new project, go to any directory where
you know you will have enough space for your data, and use 'mkdir' to
create the IRAF home directory for the project. Go into that directory
using 'cd'. Then run the 'mkiraf' command, telling it that you are using
an xgterm. It should look basically like this:
% mkiraf
-- creating a new uparm directory
Terminal types: xgterm,xterm,gterm,vt640,vt100,etc.
Enter terminal type: xgterm
A new LOGIN.CL file has been created in the current directory.
You may wish to review and edit this file to change the defaults.
   Your directory should now contain a file called 'login.cl' and a
subdirectory called 'uparm'. The 'uparm' directory is where IRAF will
store a memory of the parameter settings on all the IRAF tasks
(commands) that you run. This is how IRAF remembers what you have done
on this project, and why you have to remember to ALWAYS RUN IRAF FROM
THE HOME DIRECTORY OF THE PROJECT YOU ARE WORKING ON.
4. Data Formats (Read this carefully, even though it's boring!)
   Every image contains 2 kinds of information: the header,
which contains descriptive information about the data, and the image
data itself. There are different formats for how to store this information.
The standard IRAF image format is the "imh" format. In this format, the
image is stored in 3 separate files: a header file (e.g., 'something.imh') that
contains - obviously - the header, a pixel file ('something.pix') that contains
the image data, and a copy of the image header ('..something.imh'). The
reason for this strange system is safety, in case you accidentally delete
something. All of the IRAF documentation assumes that you are working in
imh format, and so you will always see the examples done with .imh files.
   However, times have changed, and astronomers now greatly prefer to
work in FITS (Flexible Image Transport System) format. In this format, the
header and the image data are in a simgle file, which is more compact but
also potentially more dangerous. Working in FITS format has the advantage
that it saves you from having to convert the format of your data after
you transfer it from the data acquisiton laptop. The rest of this
document assumes that you are going to keep all of your data in FITS format,
and that all of your file names are going to have the '.fit' extension, which
is what the CCD software generates.
   If you are going to follow this advice, you have to remember that
where the documentation says to type '.imh', you should type '.fit' instead.
5. Editing the login.cl File
   Now, edit the 'login.cl' file. You will see the directory that is
defined as the IRAF home directory; this is the directory that you were
in when you ran 'mkiraf'. The next line says 'set imdir = "(something)"'.
Change the right-hand side of this assignment to "HDR$pixels/" -- note
the quotation marks and the trailing slash. This will actually be irrelevant
if you keep all of your data in FITS format but we will set it nonetheless
just in case you accidentally create an imh-format file.
   About 15 lines farther down
there's a section labeled "Uncomment and edit to change the defaults."
For working with data from the ST8 camera, you need to find the line
that sets 'stdimage', delete the # sign at the beginning, and change
'imt800' to 'imt4'. At the end of this section there is a line that sets
'imtype'. Delete the # sign and change "imh" to "fits". The subsequent line
will read:
#set imextn = "oif:imh fxf:fits,fit plf:pl qpf:qp stf:hhh,??h"
Delete the # sign and reverse the order of "fits" and "fit" as follows:
set imextn = "oif:imh fxf:fit,fits plf:pl qpf:qp stf:hhh,??h"
Note that the positioning is important! Save the file and exit the editor.
6. Directory Tree Structure
   You now have a choice to make. If you are absolutely certain
your project
is going to involve only one night's worth of data, then you can plan to
put all your data into this IRAF home directory. If you choose this
route, use 'mkdir' to create a subdirectory called 'pixels' (no quotes
in the name), and you're done. On the other hand, if you anticipate
having more than one night of data, then it is MOST STRONGLY recommended
that you create separate subdirectories, e.g., 'night1', 'night2', etc.,
and then create 'pixels' subdirectories in each of these.
If you always work in FITS format, your 'pixels' subdirectories
will remain empty. We're creating them just in case you switch to imh format,
so that the pixel files will have someplace to go.
   Your directory tree structure might look
something like this if you had two data reduction projects:
/e1/users/jones/
|
---------------------------------------------
| |
project1/ project2/
| |
----------------- --------------------------
| | | | | | |
uparm/ night1/ night2/ uparm/ night1/ night2/ night3/
| | | | |
pixels/ pixels/ pixels/ pixels/ pixels/
And now it should be obvious where you should be when you start up IRAF to
work on project 1 or project 2, respectively.
7. Starting IRAF
   Perversely, you don't start IRAF by typing 'iraf'. Your interaction with
the IRAF system is through the "Command Language", which you start by typing
'cl'. You exit IRAF by typing 'logout'. At this point, you can go on to
familiarize yourself with basic operations by working through the examples
in the IRAF Beginner's Guide.
Start with Section 3.2, Packages and Tasks;
these instructions bypass the earlier sections. You can skip Section 4
for the time being. The important material is in Sections 3, 5, and 6.
Work up to (and including) Section 6.1.
8. Image Display
   As you work through the Beginner's Guide you will soon arrive at the
point where you want to display an image. To do this you have to run a
separate image display program with which IRAF will communicate. There
are 3 image display programs available, of which the newest is 'ds9'. The
recommended (but not the only) way to start ds9 is to type '!ds9 &' (no
quotes, but with the ! and &) at an IRAF (i.e., CL) prompt. The other
alternatives are 'saotng' and 'ximtool', which are started in a similar
way. All of the image displays are exited using a pulldown menu.
Last updated 2008 Apr 8. Written and maintained by Tom Statler