ASTR 4880 Computer Lab Session 3

Log in to your astro1 account, open an xgterm window, change to your IRAF directory, and type cl to start IRAF. Change to the directory in your account where the image files from Sessions 1 and 2 are stored. Type oned and epar splot and make sure that the options parameter includes hist. If not, make it so.

Measuring the locations of centers of features with splot

A fundamental part of spectroscopy is measurement of the locations of spectral lines. In this session, we'll get started on this topic, as well as prepare to carry out Lab 2, which will involve measuring the locations of emission lines in a spectrum of the thorium-argon lamp.

Among the files you copied to your account from my CCD3/20090831 directory are two Th-Ar spectra, file numbers 28 and 30. This evening, we will work with either one of them. (Lab 2 will use a different set of data, though.) Open either file with splot and give any row number to plot.

Your plot should include some tall, upward spikes; those are the Th-Ar emission lines. Move up or down with the ( or ) key until your plot includes several lines. Then type:

:nsum 10

This command causes splot to plot the sum of 10 adjacent rows and improves the signal-to-noise ratio in your graph. Use the parenthesis keys to move to higher or lower row numbers in order to maximize the height of the lines you choose to work with.

Zoom in on a line. In splot, the easiest method is to type a at the left-hand end of the region you want to see and then again at the right-hand end. This method is available in no other task. In order to measure line centers, you should be well zoomed in, so that you see individual pixels clearly.

If your line is too tall for your zoomed-in graph, use w n to scale the graph correctly. Several methods for measuring the location of the center of a line are available.
• Visually center the cursor on the line and press the space bar; the pixel in which the cursor is located will be displayed. This method is not very accurate but is sometimes useful for quick look purposes.
• Place the cursor where the line profile meets the baseline (examples will be shown) and press e and then where the line rejoins the continuum on the other side, press e again. The results of the measurement will be displayed in the yellow bar at the bottom of the graphics window, and the graphics will show a vertical line at the location identified as the centroid of the feature. The items displayed will be defined in class.
• Place the cursor were the line begins to depart from the surrounding continuum, as before, but this time type k at the beginning and the end. As before, the results will appear in the yellow bar. This command fits a Gaussian function - a bell-shaped curve - to the region of the data that you selected. The last of the output quantities is gfwhm, the full width at half maximum of the fitted Gaussian. The task graphs the fitted Gaussian; it's a good idea to check visually whether the fit is realistic. The center of the fitted Gaussian is adopted as the center of the feature.

Saving the results of measurements

While working with splot, you can review your accomplishments by typing :show to see a listing of your measurement results in the xgterm text window. There is no way to delete a measurement once it is made, but, if you decide you have made a mistake, you can enter a comment by typing #. When the yellow bar appears at the bottom of the graphics screen, type the text of your comment.

When you quit splot, the same text will be saved to a file called splot.log in the current directory. It can be: opened with a text editor such as pico and then copied and pasted to a Windows text processor; fetched with the Windows Secure FTP application; or whatever. Measurement results from subsequent sessions with splot will be appended to the splot.log file, so no work will be lost. If you switch to a different work activity in the same directory, it might be a good idea to rename the splot.log file in order to start a new one for the new activity.

The one way in which work can be lost is to end splot abnormally. The splot.log file is created only if the task is quit properly. For example, do not attempt to quit splot by closing the graphics window. You must quit it by typing q when the red graphics cursor (crosshair) is active, or the results of your measurements will be lost.

Measurements involve a series of decisions, such as exactly where to place the cursor. If a problem surfaces later - such as, your measurement disagrees with someone else's - you may want to review what those decision were. For this purpose, you should save the graphics showing the fitted Gaussian and so forth.
• To save to a graphics file the plot you are currently viewing, with the red crosshairs active, type :.write file where file can be any file name.
• To append another graph to the same file, just re-use the same file name. This is a good idea, in order to avoid having lots of little graphics files cluttering your directory. Choose a file name that is easy to type.
• Two or more plots can be displayed on the same screen as specified by the parameters nx and ny, the number of plots in the x and y directions respectively.
• The format of the graph can be changed from landscape to portrait, as is sometimes desirable: rotate=yes, fill=yes
• When there are multiple graphs in a file, move from one to the next with the space bar. Moving backwards can be done in principle but may not work well. For more information, see help gkimosaic.

We will need to use this technique later in the semester: advanced editing of image headers with the task asthedit, which belongs to the package astutil. To begin, type astutil at the IRAF command line prompt, then epar asthedit .

PACKAGE = astutil

images = 200908310028.fits Images to be operated upon
[use applicable file name]
commands= cmds-lamps.asth File of commands
(table = keywds2.tbl) File of values
(colname= ut exptime datatype dateobs object observer) Column names in table file
(prompt = asthedit> ) Prompt for STDIN commands
(update = no) Update image header?
(verbose= yes) Verbose output?
(oldstyl= no) Use old style format?
(mode = ql)

The second line (file of commands) references a text file. The file named here can be found in /mnt/vol01/ndm/CCD3/20090831/ - copy it to your current directory.

The third line (table) references another text file; copy it into your current directory as above. It is a sample only; the values will have to be changed to match the file(s) you are working with. It has one line per image header to be edited; if you specify only one image for editing, only the first line will be used.

The fourth line gives the column headings for the table values given in the table file.

Display the file cmds-lamps.asth with pico.

Each line is a command to create a header keyword and (if update=yes) add it to the image header. The item to the left of the equals sign is the name of the keyword. When there is an '@' and quotation marks, the purpose is to accommodate a special character such as a '-' in the name of the keyword. To the right of the keyword, the items beginning with a '\$' are variables to be read from the column in the data table with the same name. The '#' character is a comment character, causing the text following it in the line to be ignored.

The parentheses in the first command indicate that a calculation is to be done with the ut item; the sexstr, which is an abbreviation for "sexagesimal string," is a function giving the calculation to be performed. Here it just indicates that the universal time is given in hours and minutes.

After updating the file keywds2.tbl with appropriate values from the observing log for the image you are editing, check the parameters for asthedit and execute it. It will list the keywords to be added. Quit and execute it again with update=yes (or update+) in the command line, then check the image header that results.