% @(#)fit_roma.hlq	19.1 (ESO-IPG) 02/25/03 13:29:28 
\se                                      
SECTION./ROMAFOT
\es\co                                                                          
FIT/ROMAFOT                                                     07-AUG-1989 RHW
\oc\su                                                                        
FIT/ROMAFOT frame [int_tab] [thres,sky] [sig,sat,tol,iter] [meth,[beta]]
	[fit_opt] [mean_opt]
	determine characteristics of stellar images by non-linear fitting
\us\pu
Purpose:    Determine characteristics of stellar images by non-linear
            fitting.
\up\sy                                                                          
Syntax:     FIT/ROMAFOT frame [int_tab] [thres,sky] [sig,sat,tol,iter] 
                        [meth[,beta]] [fit_opt] [mean_opt]
\ys\pa                                                                          
            frame =     input image frame
\ap\pa                                                                          
            int_tbl =   name of the intermediate table which contains the 
                        selected objects; default the frame name extended with
                        `INT'.
\ap\pa
            thres,sky = photometric threshold and sky background. Data below 
                        the threshold will be ignored. Default values are 
                        those used in the commands SKY/ROMAFOT and 
                        indicated FIND/ROMAFOT.
\ap\pa
            sig,sat,tol,iter = trial value for sigma (parameter for the width 
                        of the Gaussian or Moffet curve), the saturation, the
                        shift tolerance, and the maximum number of iterations
                        for each window. The defaults for sigma and saturation
                        are the values used by previous commands (SKY/ROMAFOT);
                        the default shift tolerance is 2 pixels, and for the 
                        number of iterations 50.
\ap\pa                                                                         
            meth,beta = non-linear fitting method to be used. One can choose
                        between two fitting functions:\\
                        GI: a Gaussian function with inverse prop. weighting;\\
                        GU: a Gaussian function with uniform weighting;\\
                        MI,number: Moffat function with inverse proportional
                                   weighting and with beta factor number;\\
                        MU,number: Moffat function with uniform weighting and
                                   with beta factor number.\\
                        The default is MU,4.0.
\ap\pa                                                                        
            fit_opt =   four character logical string consisting of `Y'
                        and `N', indicating which parameters should kept 
                        fixed. The meaning of the string is as follows:\\
                        position 1: fix sigma;\\
                        position 2: fix sky background;\\
                        position 3: fix position;\\
                        position 4: allow tilted plane.\\
                        The default is `YNNN'.
\ap\pa                                                                          
            mean_opt =  character indicating if mean values of previous 
                        windows should be used as trial values for the next.
                        One can choose between:\\
                        S: mean values for sigma should be used;\\
                        B: mean values for sky background should be used;\\
                        A: mean values for sigma and sky background should
                           be used;\\
                        N: No mean values should be used as trials.\\
                        Default is `N'.
\ap\no                             
Note:     The command read the data from the intermediate table and tries
          to make to fit. The fit parameters will be stored back in the
          intermediate table on the same position. In case the fit fails
          or if the parameters are out of range the program will pass
          the message `NO CONVERGENCE'.
           
          The program determines the characteristics (position, width,
          and height) of each of the stellar images through a non-linear
          fitting procedure. It assumes that the PSF can be fit adequately
          by a gaussian or a moffat function and that a plane (optionally
          inclined) is a good approximation of the sky background. 

          The fit_opt may be used as follows: for the first parameter
          (sigma) give `N' when looking for the PSF parameters and `Y' 
          when fitting program stars. The second parameter (plane) can
          in general be chosen not fixed. Only in the case of small windows
          which are completely filled with stellar images one can leave the
          sky fixed. The third parameter (position) can in most cases vary.
          Since in most case the tilt of the sky background over the window
          is negligible one can kept the background flat in principle ('N')

          For more details see the MIDAS User Guide Volume 2, Chapter 5.

\on\exs                                                                         
Examples:                                                                       
\ex
          FIT/ROMAFOT GCLUST GCLUST
          Fit the windows in the intermediate table, GCLUST, using a 
          maximum of 50 iteration (default). Start from the beginning in the 
          table (default), and use a Moffat function with beta=4 (default). 
\xe \sxe                                                                        
