[Top] [Prev] [Next] [Bottom]

A.2 IRAF Basics

This section describes basic IRAF techniques such as:

A.2.1 Loading Packages

In IRAF jargon, an application is called a task and logically related tasks are grouped together in a package. Before you can use a task, you must load the package containing that task. To load a package, type the name of the package. The prompt will then change to the first two letters of the package name, and the screen will display the names of all the newly available tasks and subpackages. Even though the prompt has changed, previously loaded packages remain loaded, and all their tasks remain available.

Note that the standard way to specify a path through the IRAF package hierarchy to a task in a particular subpackage is to separate the package names with periods (e.g., stsdas.hst_calib.foc.focgeom.newgeom).

Figure A.2: Loading Packages

Some helpful commands for managing packages are:

A.2.2 Running Tasks

This section explains how to run tasks, background tasks, and system-level commands, and how to use piping and redirection.

Running a Task

The simplest way to run a task is to type its name or any unambiguous abbreviation of it. The task will then prompt you for the values of any required parameters, such as the names of input files. Alternatively, you can specify the values for the required parameters on the command line when you run the task. For example, if you want the task imheader to print header information on the file myfile.hhh, you can type

st> imhead myfile.hhh


IRAF does not require you to type the complete command name-only enough of it to make it unique. For example, dir is sufficient for directory.

Escaping System-Level Commands

To run an operating system-level command (i.e., Unix or VMS commands) from within the IRAF CL, precede the command with an exclamation point (!). This procedure is called escaping the command. For example:

st> !system_command

Piping and Redirection

You can run tasks in sequence if you desire, with the output of one task being used as the input for another. This procedure, called piping, and is done by separating commands with a vertical bar (|), using the following syntax:

st> task1 filename | task2 

For example, if a particular task prints a large volume of textual output to the screen, you will often want to pipe it to page, which allows you to read the output one page at a time:

st> task1 filename | page 

You can also redirect output from any task or command to a file by using the greater-than symbol (>) as follows:

st> command > outputfile

Background Tasks

To run a task as a background job, freeing your workstation window for other work, add an ampersand (&) to the end of the command line, like this:

st> taskname &

A.2.3 Getting Help

This section describes:

On-Line Help

You can get on-line help with any IRAF task or package by using the help command,1 which takes as an argument the task or package name about which you want help. Wildcards are supported. For example, to display the on-line help for the STSDAS mkmultispec task, you would type:

fi> help mkmultispec

Figure A.3: Displaying On-line Help

Two STSDAS tasks that display only certain sections of the help file are also available:

Finding Tasks

There are several ways to find a task that does what you need:

Figure A.4: The apropos task Using apropos

A.2.4 Setting Parameters

Parameters specify the input information for IRAF tasks. They can be the names of input or output files, particular pixel numbers, keyword settings, or many other types of information that control the behavior of the task.

The two most useful commands for handling parameters are:

Viewing Parameters with lparam

The lpar command lists the current parameter settings for a given task (Figure A.5).

Figure A.5: Displaying Parameter Settings with lpar

Setting parameters with eparam

The epar command is an interactive parameter set editor. It displays all of the parameters and their current settings on the screen. You can move around the screen using the arrow keys (also called cursor keys) and type new settings for any parameters you wish to change. Figure A.6 shows a sample of the epar editor at work (invoked by typing epar strfits).

Figure A.6: Editing -Parameters with epar

Parameter Data Types-What to Specify

Parameters are either required or hidden, and each parameter expects information of a certain type. Usually, the first parameter is required, and very often it expects a file name. Parameters are described in the online help for each task [include reference to help]. Hidden parameters, shown in parentheses in the online help and the lpar and epar listings, need not be specified at each execution because their default values frequently suffice.


Wise IRAF users will check the values of hidden parameters, as they often govern important aspects of a task's behavior.

If you specify the wrong type of information for a parameter, epar will usually display an error message saying something like "Parameter Value is Out of Range." The message is displayed when you move to another parameter or if you press . Table A.1 lists the different parameter types.



Parameter Data Types

Type

Description

File Name

Full name of the file. Wild card characters (* and ?) are often allowed. Some tasks allow you to use special features when specifying file names, including "@" lists, IRAF networking syntax, and image section or group syntax. (See "File Management" below).

Integer

Whole number. Often the task will specify minimum or maximum values (see the help pages).

Real

Floating point numbers, can be expressed in exponential notation. Often will have minimum and maximum values.

Boolean

Logical "yes" or "no" values.

String

Any characters. Sometimes file names are specified as string.

Pset

Parameter set.

Restoring Parameter Default Values

Occasionally, IRAF (or you) will get confused by your parameter values. To alleviate this confusion, you can restore the default parameters with the unlearn command. You can use unlearn on either a task or on an entire package.


The unlearn command generally will restore the parameters to reasonable values, a big help if you are no longer sure which parameter values you have changed in a complicated task.

A.2.5 Setting Environment Variables

IRAF uses environment variables to define which devices are used for certain operations. For example, your terminal type, default printer, and the disk and directory used for storing images are all defined through environment variables. Environment variables are set using the set command and are displayed using the show command. Table A.2 lists some of the environment variables that you might want to customize.



Environment Variables

Variable

Description

Example of Setting

printer

Default printer for text

set printer = lp2

terminal

Terminal type

set term = xterm

stdplot

Default printer for all graphics output

set stdplot = ps2

stdimage

Default terminal display setting for image output (most users will want this set to either imt512 or imt800)

set stdimage = imt800

stdgraph

Default graphics device

set stdgraph = xterm

clobber

Allow or prevent overwriting of files

set clobber = yes

imtype

Default image type for output images. "imh" is original IRAF format, "hhh" is STSDAS GEIS format.

set imtype = "hhh"


If you are working with GEIS files, you should set imtype to "hhh". If you are working with STIS and NICMOS data in FITS files, you can set imtype to "fits"

You can set your environment variables automatically each time you login to IRAF by adding the appropriate commands to your login.cl file. Use your favorite text editor to specify each variable on its own line. The show command with no arguments prints the names and current values of all environment variables.

A.2.6 File Management

This section describes:

File Formats

IRAF recognizes a number of different file structures. Among them are the standard HST file formats known as GEIS and FITS (see Chapter 2), both of which differ from the original IRAF format (OIF). GEIS is closer to OIF, in that two files are always used together as a pair:


When working with IRAF or STSDAS images, you need only specify the header file name-the tasks will automatically use the binary data file when -necessary.

File Specification

Most tasks in IRAF and STSDAS operate on files and expect you to specify a file name for one or more parameters. Several types of special syntax can be used with certain tasks when specifying file names. These syntax features include:


When using wildcards with image-processing tasks, be sure to exclude the binary pixel files by ending your file name specification with an "h", for example: y*.??h

Directory Navigation

To navigate through directories, you can use the following commands:

A.2.7 Troubleshooting

There are a couple of easy things you can do to make sure that you don't have a simple memory or parameter conflict-common causes of problems.



[Top] [Prev] [Next] [Bottom]

1 There is an optional paging front-end for help called phelp. For more information, type help phelp from within IRAF.

2 The binary data file format is host-dependent and may require translation before it can be moved to a computer using a different architecture.

stevens@stsci.edu
Copyright © 1997, Association of Universities for Research in Astronomy. All rights reserved. Last updated: 11/13/97 18:01:47