PyRAF has its own built-in graphics kernel to handle interactive IRAF graphics. Graphics tasks can be run from any terminal window -- there is no need to use the IRAF xgterm. If the value for stdgraph set in your login.cl would have the IRAF CL use its built-in graphics kernel, in PyRAF it will use PyRAF's built-in kernel. The PyRAF kernel is not identical to IRAF's but offers much the same functionality -- it lacks some features but adds others. If you specify a device that uses other IRAF graphics kernels (e.g., for printers or image display plots), PyRAF will use the IRAF graphics kernel to render those plots. There are currently some limitations when using IRAF kernels. For example, it is not possible to use interactive graphics tasks with those kernels. But otherwise, most of their functionality is available.
Currently the PyRAF built-in graphics kernel is based on OpenGL and Tkinter (other alternatives will probably be added in the future). Graphics windows are created from PyRAF directly. One can run a graphics task like any other. For example, typing
will (after some delay in loading the graphics modules) create a graphics window and render a plot in it. The graphics window is responsive at all times, not just while an IRAF task is in interactive graphics mode. If the window is resized, the plot is redrawn to fit the new window. There is a menu bar with commands allowing previous plots to be recalled, printed, saved, etc. The Edit->Undo menu command can remove certain graphics elements (e.g., text annotations and cursor marks.) It is possible to create multiple graphics windows and switch between them using the Window menu. See the Help menu for more information on the capabilities of the PyRAF graphics window. At present, few of the options (such as the default colors) are easily configurable, but future versions will improve on this.
Interactive graphics capability is also available. For example, typing
implot dev$pix will put the user into interactive
graphics mode. The usual graphics keystroke (gcur) commands recognized by
the task will work (e.g., lowercase letter commands such as
and colon commands will work as they do in IRAF. Most CL-level (capital
letter) keystroke commands have not yet been implemented; the following
CL level commands are currently available:
Help for interactive IRAF tasks can usually be invoked by typing ?; the output appears in the terminal window. Output produced while in cursor-mode (e.g., readouts of the cursor position) appear on the status line at the bottom of the graphics window. Note that the status line has scrollbars allowing previous output to be recalled.
It is likely much of the additional functionality of CL level gcur commands (zooming, etc.) will also find its way into menus or other GUI elements of the PyRAF graphics window. Where possible we also will try to make these available through the keystroke commands familiar to expert IRAF users.
PyRAF attempts to manipulate the window focus and the cursor location in a sensible way. For example, if you start an interactive graphics task, the mouse position and focus are automatically transferred to the graphics window. If the task does not appear to be responding to your keyboard input check to see that the window focus is on the window expecting input.
It is possible to generate hard copy of the plotted display by using the File->Print menu item or, in gcur mode, the equal-sign (=) key. PyRAF will use the current value of stdplot as the device to plot to for hardcopy. Inside scripts, a hardcopy can be printed by
This could be used in a Python script that generates graphics using IRAF tasks. It is also possible to do other graphics manipulations in a script, e.g., changing the display page.
It is possible to display several graphics windows simultaneously. The Window->New menu item can create windows, and the Window menu can also be used to select an existing window to be the active graphics window. Windows can be destroyed using the File->Quit Window menu item or directly using the facilities of the desktop window manager (close boxes, frame menus, etc.)
It is also possible to create new windows from inside scripts. If you type:
you will create a new graphics window which becomes the current
plotting window for PyRAF graphics. The
gwm.window("GraphicsWindowName") function makes the named
window the active graphics window. If a graphics window with that
name does not yet exist, a new one is created. Windows can be deleted
by closing them directly or using
gwm.delete("GraphicsWindowName"). Using these commands, one
can write a script to display several plots simultaneously on your
To plot to standard IRAF graphics devices such as xterm or xgterm one can
or whatever device you wish to use. [Note the Python version of the set
iraf.set(stdgraph="stgkern").] In this way it
is possible to generate plots from a remote graphics terminal without
an Xwindows display. The drawback is that is is not possible to run
interactive graphics tasks (e.g.,
splot) using this approach.
It may be necessary to call
iraf.gflush() to get the plot
One can generate plots to other devices simply by setting
stdgraph to the appropriate device name (e.g.,
stdplot). Only special IRAF-handled devices such as
xterm need to use the ``magic'' value
IRAF tasks such as
tv.display that use the standard image display
servers (ximtool, saoimage, saotng) should
work fine. Interactive
image display tasks such as
imexamine work as well (as long as you
are using the PyRAF graphics window for plotting.) Graphics output to
the image display (allowing plots to overlay the image) is
currently supported only through the IRAF kernel, but a PyRAF built-in
kernel is under development.
|Questions or comments? Contact firstname.lastname@example.org|
Documented updated on 2002 May 3