Log in to your astro1 (i.e., account, open an xgterm window, and start IRAF. Change to the directory in your account where the image files from Session 1 are stored.

To begin, it would be a good idea to make more simply named copies of the files we will be working with, for now, flat image number 11. To do so: imcopy 200908310011.fits 11.fits or just copy 200908310011.fits 11.fits . The difference between these two commands is that copy handles any type of file, while imcopy handles specifically images. If your image is in the two-part IRAF image format, imcopy will copy both of the files that make up the image.

To prepare for Lab 1, we need to cover three additional topics.

Image sections

Sometimes we need to work with only a portion of an image or a set of images. A portion of an image is called a section and is specified by appending to the image file name [x1:x2,y1:y2] where the x's and y's are pixel coordinates within the image. If you have added the DISPAXIS = 2 keyword to your image header, the x's designate the lines or "apertures" in your images, and a plot in the x direction is the same as a plot of a row of the spectrum.

For example, to copy a portion of image 11 to a new file called 11s.fits: imcopy 11.fits[501:700,1201:1300] 11s.fits. When I modify an image, I indicate the nature of the modification by appending a letter to the file name: here, 's' for "section."

To see what you did: splot 11s.fits and select a line numbered between 1 and 200 to plot. Then type o to overplot the next image and g to get image 11.fits. Here select the corresponding line, which will have a number larger by 501. It should be identical with the one you plotted before.

Sometimes, IRAF commits the sin of not labeling the axes of its graphs. To supply a y axis label, type (with the graphics cursor active) :/ylabel Counts(ADU). You are plotting counts as a function of pixel number.

Image statistics

To see the mean, standard deviation, maximum, and minimum value in image 11, type imstat 11.fits and the same for the section. You can also specify an image section in the command itself: imstat 11.fits[501:700,1201:1300] Other statistical quantities for the task to display can be selected in the parameter editor.

Image arithmetic

The task imcombine can form the mean or the median of a set of images. Let's construct the median of our bias frames, which are images 1 through 5, but first we need to learn to specify a set of files in the input parameter of any task.

There are several ways to specify a set of files. The simpleminded way is to list them individually as the input parameter: 1.fits,2.fits,3.fits,4.fits, 5.fits. You would have to have renamed them in order to list them in this shortened form. Another method is to write [1-5].fits as in,

files 20090831000[1-5].fits

The specification 20090831000[1-5].fits can also go into the input parameter field of a task - in fact you just did this in issuing the previous command.

Finally, you can use file redirection ('>') to construct a file containing a list of image names.

files 20090831000[1-5].fits > biasfiles.txt

page biasfiles.txt

Then, you can specify the list of files in the input parameter of a task as


Now, to construct the median bias frame: epar imcombine

PACKAGE = immatch
TASK = imcombine

input = @biasfiles.txt List of images to combine
output = medbias.fits List of output images
(rejmask= ) List of rejection masks (optional)
(plfile = ) List of pixel list files (optional)
(sigma = ) List of sigma images (optional)
(logfile= imcombine.log) Log file

(combine= median) Type of combine operation
(reject = none) Type of rejection
(project= no) Project highest dimension of input images?
(outtype= real) Output image pixel datatype
(offsets= none) Input image offsets
(masktyp= none) Mask type
(maskval= 0.) Mask value
(blank = 0.) Value if there are no pixels

[more ...]

Error report: I tried the specification 20090831000[1-5].fits in the input parameter field and got an error message, 'segmentation fault.' A segmentation fault is an often mysterious error, but it means that an unexpected area of computer memory has been used.

The task imarith can add, subtract, multiply, and divide one image by another. For example, to subtract the median bias from image 11:

imarith 11.fits - medbias.fits 11b.fits

Monday, September 28, 2009