last updated by NGD July 2005

INTRODUCTION

IRAF is one of the most-used systems for optical data reduction and it is well supported within the lab and externally. IRAF can be programmed at various levels of complexity or used in purely interactive mode with the inbuilt functions.

The functionality is much improved by the coupling with the scripting language "Python", but this is not discussed here.

IRAF support at the lab is provided by Wim Zwitser, to whom you should adress questions of installation, operating problems, disk space etc.

TUTORIAL: GETTING STARTED

There is considerable on-line help, and we have some printed guides to photometry, spectroscopy and other aspects of data reduction in IRAF. There are several self-drive tutorials available, and you can download guides to IRAF Scripts, CL Programming, SPP Programming and SAOimage (or borrow them from me). There is also a Tips and Tools for Learning IRAF article in IRAF Newsletter No 13 with a link to the Beginner's Guide. cl> reset imtype="fits" cl> flpr % needed before the next task The next example sets the default type for new images to ".imh" for native format images, but enables image type inheritance. By default new images will be of the same type as the input image. For example if a FITS image is being read another FITS image will be output, or if a pixel mask is being read a pixel mask will be created.


 cl> reset imtype = "imh,inherit"  

You can override the default output image type specified by imtype by giving an image extension (as defined by imextn) explicitly in the image name, e.g. "pix.imh", "pix.fits", "pix.pl" and so on.

DOCUMENTATION

WRITING A SCRIPT

Using scripts for repetitive tasks saves a lot of work. I recommend that you use only procedure scripts....

Horrible string constructions

For no apparent (or documented) reason IRAF sometimes requires strings to be enclosed in double inverted commas (" ") and sometimes not. This example frustrated me, after consulting the help desk I found this to work:(Phillip Warner 12/9/2003)

procedure hello ()

struct *list

begin
        int ny, dx
        string stringd
        string s1, s2
        string tmpfile
        struct linein
        real center, cont, flux, eqw, core, gfwhm, lfwhm

        string NULL = " "

        ny = 300
        dx = 200
        printf("\'%d \n", (ny-dx)) | scan (s1)
        printf(" %d\'\n", (ny+dx)) | scan (s2)
        stringd = s1 // NULL // s2

        tmpfile = mktemp("tmp$iraf")
        fitprofs(input="test.fits", reg=stringd, pos="pos", \
           lines=1, dispax=2, nsum=3, verbose=yes, > tmpfile)

        list = tmpfile
        while (fscan (list,linein) != EOF) {
           if (substr(linein,1,1) != "#") {
              print(linein) \
                 | scan (center, cont, flux, eqw, core, gfwhm, lfwhm)   
              printf("%g %g\n",center,gfwhm)
           }
        }
        delete(tmpfile, verify-)
end

MAKING A DATA CUBE

Use the IMSTACK command, it'll create a data cube from a list of 2D images. If you then need to transpose the cube so one face is in a given plane, have a look at the IM3DTRAN task in the VOL external package (from iraf ftp archive).

MAKING A PACKAGE

If you have your own software and need to run the mkpkg utility a number of additional environment variables need to be set, which can be done by typing

source ~iraf/.cshrc

or by pasting the relevant parts of that file to your own .cshrc file in the login directory.

Check then that the CL shell picks up the correct variables (for example):

cl> ! env
... IRAFARCH=ssun
arch=.ssun
IRAFBIN=/dj5/users/iraf/iraf/bin.sparc/

Also, some packages are configurable for different systems and need to be set to the specific architecture -- in this case, for example:

cl> mkpkg -p rgo sparc

IMFORT The traditional way of writing your own software within IRAF is to use Fortran, making use of the IMFORT interface. For more information see A User's Guide to Fortran Programming... by Doug Tody

C INTERFACE Documentation on the C Interface to the IRAF Virtual Operating System (CVOS) is now available. The CVOS allows one to write C programs which have the added advantage of being able to use IRAF functionality. The "CVOS User's Guide and Reference Manual" is available in PostScript or PDF format

COMPILERS

Local upgrades to the Solaris operating system often cause problems with IRAF's built-in compilation facility (xc) and may be noticed when using for example fc from within IRAF. To get around this, the xc version which is normally distributed has in the past been replaced by one which is hard-wired to go and which looks for a specific compiler (in particular V3.0.1). Users were required to add WANT_SUN_COMPILER "SC3.0.1" in their .cshrc file above the call to cshrc.csh.

That particular compiler is no longer with us and until further notice we assume that the default compiler works. If you have problems, check first that you NO LONGER have such an entry in your .cshrc file

The IRAF libraries are now located at (SOLARIS):

/tha6/users/iraf/V211SSUN/iraf/bin.ssun:

libbev.a       libimfort.a    libstg.a
libc.a         libinterp.a    libsurfit.a
libcur.a       libllsq.a      libsys.a   
libcurfit.a    libmain.o      libvops.a 
libdeboor.a    libmemdbg.a    libxtools.a
libds.a        libncar.a      
libex.a        libnlfit.a    
libgks.a       libnspp.a     
libgkt.a       libsgi.a      
libgsurfit.a   libshare.a    
libimd.a       libslalib.a   
libiminterp.a  libstg.a      
             

/tha6/users/iraf/V211SSUN/iraf/unix/bin.ssol:
libboot.a	libos.a

MULTIPLE IMAGE DISPLAYS

OVERPLOTTING AN IMAGE WITH CONTOURS

A quick solution which is OK in most situations is:

displ target 1 fill+
contour target fill+ perimeter- device=imd

where "target" is the filename. This interpolates "target" to fill the viewport and subsequent use of "zoom" will, happily, zoom both image and contour plot. If the image and the contour plot do not align properly then try the following:

HARDCOPY FROM GRAPHICS WINDOW

To produce a hardcopy from a graphics window (for example after plotting with implot or splot) the most flexible procedure is as follows:

(in graphics window) :.write aa

-- note the dot. This makes an intermediate file called `aa' containing the plot at that moment. You can make any number of such files, which will appear in the working directory. After quitting the window type for example:

cl> stdplot aa dev="slk_ps3"

to send a plot directly to ps3 or

stdplot aa dev="eps"

to make an encapsulated postscript file. It will appear with a cryptic name in your working directory. If you plan to print the file later you might be happier with straight PostScript (in general this will emerge as a full A4 copy). For this type

stdplot aa dev="psdump"

For some reason the file will now appear not in the working directory but in /tmp. Other options for `dev' can be seen by typing:

cl> devices

and looking at the appropriate entries.

A shortcut to all this (but less flexible) is to make sure that stdplot is set to the desired printer:

cl> show stdplot
slk_ps
cl> set stdplot = slk_ps3

The command "=" in the graphics window should then send a hardcopy to the printer.

(X,Y) OUTPUT OF A SPECTRUM

... or of any 1-D file can be obtained using

cl> onedspec
cl> wspectext

HARDCOPY OF HELP PAGE

cl> set printer = help_ps_3
cl> help "name" nlpp=80 rmargin=80 | lprint

BUGS AND OTHER PROBLEMS

COMPILERS: see above

ESO HEADERS: Owing to the fact that the ESO HIERARCH convention does not conform to the FITS standard, the task "hselect" (and related) will not work properly. Iraf offer a "partial fix"

LINKS

back to our Astronomical Resources page.