1 Language
              FIT\ Language Summary

    DISPLAY             Prints the results of the profile fit of R.
    VISUALIZE [N]       Plots the current fitted profile.
    MINIMIZE            Performs a profile fit.
    ITERATE             Iterates the profile fit.
    KEEP                Saves Gaussian fit results in the output file.
    LINES [N]           Enters the initial values for the profile fit.
    METHOD Arg          Selects the line profile for fits.
    RESIDUAL [n]        Computes the residuals of the profile fit.
1 DISPLAY
        FIT\DISPLAY [Yoff] [/NOPLOT] [/METHOD]

    Displays  the results of the profile fit of R for the current method, in
    the terminal and in the plot header. Yoff indicates the Y offset for the
    results to be printed on the plot; default value is 0.

    For  the  Gauss (default) method (see HELP METHOD), the command displays
    (1) the Line number, (2) the Area, (3) the Position, (4) the  Width  and
    (5) the Intensity , each with their associated errors, and resulting RMS
    in the Base and Line windows.

    Note that the values are also available in the R% variable, for  use  in
    procedures. See HELP MINIMIZE for details.

        /NPLOT:  if present, print the fit result but do not display them on
    the plot.
        /METHOD: if present, print the  fit  result  for  the  corresponding
    method.
1 ITERATE
        FIT\ITERATE [N]

    ITERATE  tries the GRADIENT technique to improve the last results of the
    profile fit. Optional argument N indicates the number of iterations.  Do
    not  expect  spectacular  results  if the absolute minimum is far away !
    Typically, this command should be used if the previous fit did not  con-
    verge,  but  seems  close enough.  If you are using the GAUSS method, be
    cautious not to change the X unit in the mean time.
1 KEEP
        FIT\KEEP

    Save profile fit results in the output file. KEEP is equivalent  to  UP-
    DATE,  but  only  profile  fit results are saved; KEEP is subject to the
    same restrictions as UPDATE.
1 LINES
        FIT\LINES [N [Guesses]] [/NOCURSOR] [/INPUT File_Name] [/SHOW]

    Enter the initial values for the profile fit.   If  argument  "AUTO"  is
    given  instead  of  a number, then the number of lines found in the last
    read spectrum will be used for ITERATE command.

    If N is not specified, then the last value for N is used.  If  N  is  0,
    MINIMIZE  will attempt to guess initial values for a single line by com-
    puting the moments of the spectrum.  If N is not 0, the user has to pro-
    vide  the  initial  values for line parameters. N is limited to 5. These
    values should be separated by spaces and can be entered as  SIC  expres-
    sions as follows:

    Method   Code,Value     Code,Value   Code,Value     Code,Value

    GAUSS    Temperature    Position     Width

    SHELL    Area (K.MHz)   Offset (MHz) Width (MHz)    Horn/Center

    NH3      Temperature    Position     Width (MHz)    Opacity

    HFS      Temperature    Position     Width (MHz)    Opacity

    The code is an integer interpreted as follows :
            0       adjustable parameter
            1       fixed parameter
            2       adjustable parameter (head of group)
            3       parameter fixed with respect to parameter coded 2 or 4
            4       fixed parameter (head of group)
    Codes 2 3 and 4 are used to fit dependent lines (e.g. HCN, for which the
    displacements are 4.842 and -7.064 km/s, or -1.431 and  2.088  MHz,  and
    line  ratios  1:0.6:0.2). Codes 0 and 1 only are allowed for NH3 method.
    The value for a parameter with code 3 should be either the ratio to  the
    head  of  group value (for both intensity and width), or the offset from
    head of group (for the position).

    There are 4 possibilities for the user to provide the line parameters:
      - If /INPUT File_Name is used, guesses are read from the  input  file.
        "Free"  format  is  used  to read in this input file. The first line
        must contain the number of lines, others are as  the  input  at  the
        keyboard.
      - The  guesses  can  also be entered from the command line, as double-
        quoted strings, one per line, e.g.
            FIT\LINES 2 "0 0.20  0 0.00  0 25.00" "0 0.10  0 0.00  0 50.00"
      - If the cursor is available, you will have to  set  interactively  on
        the  plot  the  boundaries of the N lines. The program then computes
        the moments of the spectra between these boundaries as input values.
        You  cannot  change  the codes in this way which is meaningfull ONLY
        FOR FREE and INDEPENDENT lines. This cursor selection is not used if
        you specify the /NOCURSOR option.
      - If none of the 3 methods above is used, then the user is prompted in
        the terminal for the guesses. The parameters must be entered togeth-
        er, separated by blanks, one set of guesses per line.
    The option /SHOW can be used for a feedback of what initial guesses have
    just been defined.

    Command LINES is not supported for method CONTINUUM.
1 METHOD
        FIT\METHOD Arg [Parameters ...]

    Select the line profile for fits. Five type of profiles are available.
      - GAUSS     Select gaussian profiles.
        Up to 5 Gaussian, dependent or independent can be fitted in a  spec-
        trum,  according  to  command lines. Variables are Area Velocity and
        Width (FWHM).
      - SHELL     Horn-type profiles for Circumstellar Shells.
        Variables are 1) Area [K.MHz] 2) Center  offset  [in  MHz]  3)  Full
        Width  at  zero level, and 4) Horn-to-center ratio (-1 for parabolic
        optically thick lines, 0 for flat-topped lines,  Infinity  for  per-
        fectly  double peaked lines). Profiles are symmetric. Up to 5 depen-
        dent or independent lines may be fitted. X axis must be frequency.
      - NH3(1,1) or NH3(2,2) or NH3(3,3)
        Compute ammonia line profiles, with the assumptions of gaussian  ve-
        locity distribution and equal excitation temperatures. Variables are
        1) Main group opacity times (  Excitation  temperature  minus  Back-
        ground    temperature),    2)    Velocity,    3)   Width   (FWHM   =
        sqrt(8.0*alog(2.0)) * line 2nd order  moment),  and  4)  Main  group
        opacity.  Up  to  3  independent  lines may be fitted, but it may be
        slow...
      - HFS FileName    for HyperFine Structure
        This is very similar to the NH3 method, but the coefficient  to  de-
        scribe  the  hyperfine structure are read in the file FileName.  The
        first line of this file must contain the number of hyperfine  compo-
        nents (< 40).  The other lines must contain, for each component, the
        velocity offset and the relative intensity. The parameters  are  the
        same as for NH3 method.
      - CONTINUUM       for Continuum drifts.
        Fit  a  single gaussian and a linear baseline at the same time, with
        automatic determination of the parameters. Uses beam-switched infor-
        mation  for  two-component  fitting  if required. The command METHOD
        CONTINUUM accept additional arguments, which can  be  used  to  cus-
        tomize the fit.

    METHOD CONTINUUM [Width [Area_Ratio [Width_Ratio]]]
    where
      -  Width is the width of the beam in arc seconds. By default, Width is
        a free parameter.
      - Area_Ratio is the reference to main beam area ratio, used for  beam-
        switch observing. By default, Area_Ratio is 1.
      -  Width_Ratio  is  the  reference  to main beam width ratio, used for
        beam-switch observing. By default, Width_Ratio is 1.
    A * can be used instead of a numerical value for each parameter, and in-
    dicates that the parameter is free.

    Note that in command LINES, one enters the peak line antenna temperature
    instead of the first variable in the guesses, except for  SHELL  method.
    Command LINES has no effect for CONTINUUM.

    CONTINUUM  and GAUSS methods only are relevant for continuum data, while
    GAUSS, SHELL, NH3 and HFS methods can be used for spectroscopic data.
1 MINIMIZE
        FIT\MINIMIZE

    Performs a fit of a theoretical profile in the R spectrum using  initial
    values  specified by the command LINES. The profile is determined by the
    METHOD command (GAUSS, SHELL or NH3 lines are currently implemented, and
    a special method, CONTINUUM, may be used for continuum data).

    MINIMIZE  performs  the fit only on the part of the spectrum selected by
    SET MODE X. It also ignores the regions under the masks defined  by  SET
    MASK.

    If  LINES  is 0, an attempt to guess initial values for a single line is
    done by computing the moments of the spectrum.  A first minimisation  is
    performed  using the Simplex technique; the results are improved and the
    uncertainties computed using the Gradient technique. If MINIMIZE did not
    converge,  the  errors  quoted  in  the results are meaningless, and you
    should use command ITERATE to try to do better.

    For CONTINUUM method, although a linear  baseline  is  fitted  with  the
    gaussian,  only  the gaussian parameters are displayed.  If the observa-
    tion was made using beam-switching method and the reference beam appears
    in the drifts, a two-component gauss fit is done using separation speci-
    fied in the data.

    The fitting results are saved in the R% variable, for e.g. reuse in pro-
    cedures:
      Method      Structure
      GAUSS       R%HEAD%GAU%
      SHELL       R%HEAD%SHE%
      NH3/HFS     R%HEAD%HFS%
      ABSORPTION  R%HEAD%ABS%
      CONTINUUM   R%HEAD%POI%
    See  HELP  SET  VARIABLE for the detailed meaning of each component. For
    example, the gaussian fit parameters can be found in:
      Parameter       Variable
      Area            R%HEAD%GAU%RESULT['(ILINE-1)*3+1']
      Error(Area)     R%HEAD%GAU%ERROR['(ILINE-1)*3+1']
      Position        R%HEAD%GAU%RESULT['(ILINE-1)*3+2']
      Error(Position) R%HEAD%GAU%ERROR['(ILINE-1)*3+2']
      Width           R%HEAD%GAU%RESULT['(ILINE-1)*3+3']
      Error(Width)    R%HEAD%GAU%ERROR['(ILINE-1)*3+3']
    where ILINE is the number of one of the  fitted  lines,  between  1  and
    R%HEAD%GAU%NLINE.
1 RESIDUAL
        FIT\RESIDUAL [n]

    Compute  the  residuals  of the last MINIMIZE fit. Copies R into T, then
    subtract the line profile number N from the spectrum in R. If  N  is  0,
    the sum of all components is subtracted.
1 VISUALIZE
        FIT\VISUALIZE [N] [/PEN [i]]

    Plot  the  current  fitted  profile. The Nth line obtained the last time
    MINIMIZE was executed, or  recovered  by  DISPLAY,  is  plotted  on  the
    screen. If N is 0, the sum of all lines is plotted, and if N is not giv-
    en, the last value of N is used.

          /PEN [ipen]: if ipen is present, use the given pencil 'ipen' prop-
    erties (defined with "pen ipen"), otherwise use the last defined pencil.
    Without option, use pencil 2 properties.
1 ENDOFHELP














































