NAME: atmofit PURPOSE: (one line) Fit 1 or 2 gaussians to an astronomical image that is seeing limited. DESCRIPTION: CATEGORY: Function fitting CALLING SEQUENCE: atmofit,image,loc,guess,sub,resa,a,sigmaa,chisq INPUTS: image - 2-d data array to be fitted loc - 4 element vector that specifies where to look in the image for an object to fit. This is passed to boxm to look for the image maximum. The components are: loc(0) - X center of box. loc(1) - Y center of box. loc(2) - Half width of box in the X direction. loc(3) - Half width of box in the Y direction. guess - Initial value guesses for the image fitting process. There are two possibilites: 1) one star (object) fit - guess is a scalar value that is a guess at the 1/e width 2) two star (object) fit - guess is a three element vector guess(0) = 1/e width of seeing guess(1) = X location of fainter star relative to the center of the brighter object guess(2) = Y location of fainter star relative to the center of the brighter object OPTIONAL INPUT PARAMETERS: KEYWORD PARAMETERS: FILE - string containing the FITS file name to read for image. If read, then input parameter image is overwritten and returned. FORCE - If guess is set up for two stars, this forces the solution for the second position relative to the first if set. WIDTH - Number of pixels to attempt to extract from around the peak pixel. Subarray will be at most 2*WIDTH+1 square. Extraction is truncated by the edge of the array. Default is FIX( GUESS(0)*5.0 + 0.5 ) DISPLAY - Show extraction, model fit and residual images on the current display window. Value indicates the zoom factor for the displayed images. OUTPUTS: sub - Extracted piece of image. resa - Model fit to sub. a - Coefficients of the fit. sigmaa - Uncertainties of the fitting coefficients. chisq - Reduced chi-squared of the fit to sub. KEYWORD OUTPUTS: ERR - uncertainty on MAG. MAG - returns the magnitude of the object (scalar for a star, three element vector for 2 gaussians [total, bigger, smaller] COMMON BLOCKS: SIDE EFFECTS: RESTRICTIONS: PROCEDURE: MODIFICATION HISTORY: