ASTR 4880 Computer Lab Session 5

Log in to your astro1 account, change to your iraf directory, open an xgterm window, 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 to open the onedspec page and open row 541 of your raw stellar spectrum, file number 29, with splot.

Practice with IRAF Interactive Curve Fitting

Interactive curve fitting is a module that is used in many connections in various IRAF tasks. This session is designed to give you practice with this module and can be done anywhere in the sequence of computer lab sessions from Session 2 onward.

To activate the interactive curve fitting module in splot, type t with the graphics crosshair active. In response to the menu that appears, type n for the "no operation" option, meaning that you want to inspect the fit (perhaps to determine the rms and thence the signal-to-noise ratio) but don't want to do anything with it. You may want to experiment with the other options on your own. The interactive curve fitting screen will now appear with a fitted function according to the default task parameters.

At the IRAF command prompt, help icfit will display general help with interactive curve fitting. As with any IRAF graphics task, typing ? when you see the red crosshair will display in your xgterm text window a listing of available commands in that context. If the display fills more than one screen, hit the space bar to see more text. To get back to the graphics window, you usually have to type q twice.

In addition, graphics commands that are available in most tasks can be displayed when the graphics cursor is active in response to:

Interactive curve fitting finds the function that minimizes the rms residual between the function and the data, given the specified properties of the fitting function. Chances are, your initial fitted function will not match your data very well. To improve the match, let's experiment with the graphics parameters that are displayed at the top of the interactive curve fitting graphics window. The value of each parameter will be displayed in response to : followed by the name of the parameter. To change the parameter, type : followed by the name of the parameter, a space, and the new value. After changing the parameter, create a new fitted function by typing f (nothing will happen if you don't).

All the functions available are polynomials; the parameter function specifies the type of polynomial. A good type to fit a complex curve like the one now displayed is a cubic spline, spline3. Splines are separate polynomials that are spliced together, with continuity conditions at the joints on the value of the function and its derivatives. Also available in IRAF is spline1, a broken straight line. The order of the spline is the number of pieces.

A reason to fit a row of a raw image, as we are doing, is to determine the signal-to-noise ratio, which is equal to the average signal in a region of the image, divided by the noise in that image. The noise is given by the rms of our fitted function, if the function runs through the middle of the data points. In order to obtain a meaningful value, we should perform the fit in a more or less uniform region of the image.

To restrict the points that are used in the fit, place the vertical crosshair at the left-hand end of the range and type s, then place the crosshair at the right-hand end and type s again. After making any change, always type f to make a new fit.

Sometimes it is necessary to exclude, or delete, a single point from the fit. Place the cursor on the point (zoom in with the w commands to do this) and type d. The deleted point will be marked with an X. To undelete the point again, place the cursor on it and type u.

Before deciding whether your fit is satisfactory, zoom in on a narrow range and examine it closely. If your fitted curve does not go through the middle of the points (in the up-and-down sense), other than definite features such as spectral lines, you do not have a satisfactory fit. To examine the whole spectrum, move your window to the left or right with w, then l or r.

If your spectrum includes spectral lines or other features, points in those features may deviate from the fit by too much. They have been rejected (not included in the fit) and are marked by diamonds. What is meant by "too much" is determined by the parameters low_rej and high_rej that are included in the list at the top of the interactive curve fitting graphics screen. Points deviating above the fit by more than high_rej times the rms are rejected, as are points more than low_rej times the rms below the fit. After points are rejected, the rms is recalculated and more points rejected, if necessary. The number of times this iteration cycle is done is given by the parameter niterate. The parameter grow gives the number of neighboring points on each side of a rejected point that are also rejected. Its default value is 1; try :grow 0.

A possible application of the t command is to remove cosmic rays from the image with the clean menu option. For this purpose, you could set :low_rej 0 (this command can be abbreviated :low 0) in order to reject only high points. Careful, though; by not rejecting low points, you inflate the rms of the data and possibly interfere with the rejection of the high points. Experiment for best results.

If you use the options within the t command that change the data (such as c for clean, or remove deviant points), then, after exiting the curve fitting, you need to save the changed image to a file with the i graphics command of splot.

Return to ASTR 4880 home page

Latest update (by NDM): 11/8/09 21:37