1 Introduction

1.1 Why a New IRAF CL?

The current IRAF CL has some shortcomings as a scripting language that make it difficult to use in writing scripts, particularly complex scripts. The major problem is that the IRAF CL has no error or exception handling. If an error occurs, the script halts immediately with an error message that has little or no information about where the error occurred. This makes it difficult to debug scripts, impossible to program around errors that can be anticipated, and difficult to provide useful error messages to the user.

But there are other important reasons for wanting to replace the CL. We want to develop a command language that is a stronger environment for general programming and that provides more tools than the existing IRAF CL. Python (, like Perl and Tcl, is a free, popular scripting language that is useful for a very wide range of applications (e.g., writing CGI scripts, text processing, file manipulation, graphical programming, etc.). Python is also an open system that can be easily extended by writing new modules in Python, C, or Fortran. By developing a Python interface to IRAF tasks, we open up the IRAF system and make it possible to write scripts that combine IRAF tasks with the numerous other capabilities of Python.

Ultimately, we plan for PyRAF to have command-line data access and manipulation facilities comparable to those of IDL (the Interactive Data Language,, which has extensive array-processing and image manipulation capabilities). It should soon be possible to write applications in PyRAF that can manipulate the data directly in memory and display it much as IDL does. The data access and computation abilities are already present, and we are currently working on a new scientific graphics modules for Python.

We are hoping that Python and PyRAF will become the programming language of first resort, so that programmers and astronomers will only infrequently need to write programs in C or Fortran. Moreover, when it is necessary to use compiled languages, programs written in C, C++, and Fortran can be easily linked with and integrated into PyRAF.

1.2 Why Should I Use PyRAF?

PyRAF can run the vast majority of IRAF tasks without any problems. You can display graphics and use interactive graphics and image display tasks as well. You can even run more than 90% of IRAF CL scripts! While many things work the same way as they do in the IRAF CL, there are some differences in how things are done, usually for the better.

The most important difference between PyRAF and the old IRAF CL is that PyRAF allows you to write scripts using a much more powerful language that has capabilities far beyond simply running IRAF tasks. Some of the things that now become possible are:

As far as the interactive environment goes, the new system has most of the current features and conveniences of the IRAF CL as well as a number of new features. It is possible to use exactly the same familiar IRAF CL syntax to run IRAF tasks (e.g., imhead dev$pix long+). There are some additional features such as command-history recall and editing using the arrow keys, tab-completion of commands and filenames, a GUI equivalent to the epar parameter editor, the ability to display help in a separate window, and a variety of tools for manipulation of graphics. We believe the new environment is already in many ways more convenient for interactive use than the IRAF CL, and further enhancements are planned.

1.3 Python Prerequisites

This guide will not attempt to serve as a complete Python introduction, tutorial or guide. There are a number of other documents that serve that role well. At some point we recommend spending a few hours familiarizing yourself with Python basics. Which Python documentation or books to start with depends on your programming background and preferences. We have written A Quick Tour of Python that may be helpful for IRAF users. Some people will find quick introductions like the Python tutorial (see our list of available Python documentation for sources for this and other books and documentation) or the Essential Python Reference all they need. Others may prefer the slower-paced introductions found in the Learning Python or Quick Python books.

In any case, do not spend too much time reading before actually starting to run PyRAF and use Python. The Python environment is an interactive one and one can learn quite a bit by just trying different things after a short bit of reading. In fact, you may prefer to try many of the examples given in this guide before reading even a single Python document. We will give enough information for you to get started in trying the examples. Our approach will be largely based on examples.

1.4 IRAF Prerequisites

This guide also is not intended to be an introduction to IRAF. We assume that current PyRAF users are relatively experienced with IRAF. We plan to prepare documentation (and user tools) intended for first-time IRAF users, but this beta release targets those who are already using IRAF and are looking for a better command language.

Questions or comments? Contact
Documented updated on 2004 Jun 1