Data Formats

Working With Multigroup Images

There will likely be times when you want to work on only a part of an entire image. In this section we will describe and present examples showing how to work with:

Omitting File Extensions

tasks in can generally figure out what file you want to process without your typing the file name extension, at least if you are using STSDAS files with the standard default extensions of .hhh and .hhd. In such cases, you can drop the explicit reference to .hhh or .imh when specifying the name of the input image. If the input STSDAS file has an extension other than .hhh and .hhd, it must be specified. See the rules for STF file name extensions on page 48.

Specifying Groups

Because GEIS files can contain multiple images (each stored in a group), you will often need to specify a particular group upon which an application program should operate. In fact, if you do not specify a group, most IRAF and STSDAS tasks will operate only on the first group.

To specify a group, enclose the group number in square brackets. For example, if the file mydata.hhh were a 10-group file, the command:

cl> imarith mydata.hhh[2] + 2. output.hhh
would add 2 to the values in group 2 of the file mydata.hhh, writing the results to a new file called output.hhh, which would be a single-group file.

The output from any operation on a single group of a multigroup GEIS file is a single group output file. You can, however, create multigroup output files the first time the new image is written, for example, look at the first line of the following commands:

cl> imcopy mydata.hhh[2] newimage.hhh[3/4]
cl> imcopy mydata.hhh[3] newimage.hhh[4]
The first statement copies group 2 of the input image to group 3 of the output image, and creates the output image with enough storage space to accommodate 4 groups. The other 3 groups will be empty, but you could copy other data into them as long as the image dimensions match. Note that the second time the output file is used, the new total group count (4) is not repeated. If you were to repeat it, IRAF would think you wanted to create an entirely new file, rather than updating a group in an existing file, and would warn that you were trying to overwrite an existing file. Similarly, other standard tasks can be used to create multi-group output files, for example:

cl> imarith mydata.hhh[10] * 2. newimage.hhh[2/5]
There is currently no automatic way to have an IRAF or STSDAS task process all groups in an input image and write the results to corresponding groups in an output image. However, there are several STSDAS tasks, particularly in the
toolbox.imgtools, fitsio, and hst_calib.ctools packages, that simplify using group format data. Also, the pipeline calibration tasks explicitly process all groups in a GEIS file. For example, the gcopy task in the imgtools package will copy all of the groups to another GEIS image:

cl> gcopy mydata.hhh newimage.hhh

Specifying Image Sections

There are also likely to be
times when you do not want to work with an entire image, perhaps because you want to limit a task to a particular area of interest or because you want to exclude suspect regions from affecting your analysis. You can limit the area affected by a task using image section syntax. For example, the following command will add 2.0 to a 100 100 one-group pixel subimage of the second group of mydata.hhh and store the result in a new 100 100 image called output.hhh.

cl> imarith mydata.hhh[2][101:200,101:200] + 2. output.hhh

If you specify both a group number and an image section, the group number must precede the image section. (See
"Image Sections and Groups" on page 28).

Image Types

File formats can be controlled
by the environment variable imtype. When a new data file is created (for example, by a FITS reading task), imtype can be used to define the format of the newly-created file without giving an explicit file name extension. To create STSDAS format files by default, use the command:

cl> set imtype = hhh
To create IRAF format files by default, use:

cl> set imtype = imh
The value of imtype has no effect when an image is created as a copy of an existing image.

Any application in IRAF or STSDAS can read a file in one format and write an output file in the other format. By default, the output file is assumed to use the same format as the input file (IRAF format for IRAF input files, STSDAS format for STSDAS input files). This can be overridden by giving the output file name a different extension, for example:

cl> imcopy data.hhh output.imh # copy file to IRAF format
cl> imcopy output.imh newdata.hhh # copy to STSDAS format

Remember that commands that do not specify a group (like those above) usually work only on the first group in the image.

Omitting File Extensions
Specifying Groups
Specifying Image Sections
Image Types

Generated with WebMaker