PyRAF - UMKCgeg/Wiki GitHub Wiki

PyRAF is a Python wrapper for IRAF. It allows you to call IRAF tasks from within Python. This is useful as Python is an easier language to write scripts in than IRAF.

If your computer uses Ureka, you will already have PyRAF. Otherwise, you can simply install with pip, via pip install pyraf. If you run into trouble getting it setup, update this page once you figure it out.

This page only gives a brief introduction to PyRAF. The PyRAF tutorial goes into much more depth.

Using PyRAF

Inside a Python script, you will first need to import it. The usual call is

from pyraf import iraf

You can then call tasks like so:

iraf.qphot()

That specific task takes parameters, and will prompt you to enter them.

If you need to use a package like DAOPHOT, you do the same thing you would in IRAF.

iraf.daophot()

It will then list the new functions you can access.

epar

One of the best reasons to use PyRAF is the fantastic interface it has for epar. You simply call

iraf.epar("qphot")

and a window will pop up with all the parameters, like this.

You can then type them all in, or select them with the buttons. There is a help button on the right that shows the full documentation for the task in question. In the File dropdown, the Save As button will write the parameters you specified to a file. This is useful in DAOPHOT, for example. In the Options dropdown, there is an option to open the help pages in your web browser, which is much easier to read. Otherwise it will just be plain text. Then there are the obvious Unlearn and Save and Quit buttons, which you will probably be using often. Note that before you can do anything else in Python, you will need to close the epar window.