Using XGFIT to Focus and Measure the FWHM of IRTF Images


XGFIT is a tool that will fit a Gaussian to a line cut through an image and display the data, the best fit Gaussian, and the parameters of the Gaussian. The FWHM can be read off the display. This provides a convenient means of quantitatively measuring the seeing and determining the optimal focus position.

  1. In an xterm window, type xgfit &. This will start the Gaussian fitting program. The program will bring up an X-window in which the data and the fit will be displayed.

  2. Take an image of a star. We find that a total integration time of about 10 seconds works well for focussing, but this can be composed of numerous shorter-integration co-adds. Make sure the star is not situated on a bad pixel in the detector and that the maximum pixel value is not at the saturation level.

  3. Display the image in one of the canvases of VF.

  4. Draw a box around the star and zoom on the box.

  5. Draw a line through the star by holding down the shift key and the middle mouse button and dragging the cursor through the middle of the star. The line should be about long enough so that an accurate measure of the background level can be obtained.

  6. In one of the canvases, choose the XLINECUT option and select the buffer displaying the image.

  7. Click on "Set Endpoints from line". The canvas displaying the XLINECUT will then display the pixel values along the line drawn in the image buffer.

  8. Click on "Output Gaussian Data", which will send the pixel values to the XGFIT program.

  9. In the XGFIT window, click on the "Read data" button. The program will plot the observed data (pixel) values.

  10. Click on the "Fit" button. The program will plot the best fit of the Gaussian through those values. It will also give the best fitting parameter values in the panel below the fit. Make sure the fit to the data points is reasonable. If the program cannot fit a reasonable Gaussian to the data, there may be problems due to bad (hot) pixels. In this case, the observer should either re-draw the line cut to avoid the bad pixels, or move the star to a cleaner position on the array.

  11. Record the FWHM value displayed in the xterm window. The units for this value are pixels. Multiply by the plate scale to obtain the FWHM in arcseconds.


If you have any problems with these procedures or the Gaussian fitting programs, please contact Tony Denault.


Also, documentation on XGFIT's Curve Fitting Algorithm with GSL as xgfit.doc(word) or xgfit.pdf(PDF).


Maintained by (Tony Denault)
Last updated 05 Apr. 2002