% @(#)continspec.hlq	19.1 (ESO-IPG) 02/25/03 14:28:40
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1993 European Southern Observatory
%.IDENT      continspec.hlq
%.AUTHOR     PB, IPG/ESO
%.KEYWORDS   MIDAS, help files, 
%.PURPOSE    On-line help file for the command: CONTINUUM/SPEC
%.VERSION    1.0  22-MAR-95 : Creation, PB
%----------------------------------------------------------------
\se
SECTION./SPEC
\es\co
CONTINUUM/SPEC					      08-AUG-95  PB
\oc\su
CONTINUUM/SPEC  in  out  [radius/meth] [type] [smooth] [degree]
	Fitting of a spectrum continuum by smoothing splines
\us\pu
Purpose:    
            This command allows to fit the continuum of a spectrum by
            smoothing splines. A preliminary selection of continuum 
            regions is performed using a min/max filtering. Interactive
            definition of the continuum regions is also possible. 
            A smoothing spline is fitted through the continuum regions.
\up\sy
Syntax:     
            CONTINUUM/SPEC in  out  [radius/meth] [type] [smooth] [degree]
 \\
\ys\pa
            in     = Name of the input spectrum  (1D or 2D)
 \\
\ap\pa
            out    = Name of the output spectrum
 \\
\ap\pa
            radius/meth = This parameter can be given as a number, 
                     in which case it will be interpreted as the radius 
                     of the min/max filter. Once a continuum has been 
                     obtained for a given radius, it is possible to
                     skip the filter step by providing a method name 
                     (SELECT or FIT). In this case the procedure will start
                     directly with the interactive selection (SELECT)
                     or with the fitting (FIT). Points selection and 
                     fitting parameters can then be iteratively refined.  \\
                     Default value: 3
 \\
\ap\pa      
            type   = Spectrum type (ABSORPTION, EMISSION, ALL, Default: ABS).
                     The type EMISSION must always be given on-line for
                     emission spectra, in particular if one uses the methods 
                     Select or Fit. \\
                     The type ALL is used for pure continuum
                     spectra, like flat-fields. In that case the full 
                     spectrum will be retained for the fit. \\ 
                     For all types, some sections of the spectrum can
                     be interactively removed with the interactive selection.
 \\
\ap\pa      
            smooth = Smoothing factor for spline fitting. The default value
                     (10000.) will usually provide a polynomial approximation.
                     The spline can be constrained closer to the data by
                     decreasing this value. Several iterations to determine
                     the optimal value can be performed with the syntax: \\
                      CONTINUUM/SPEC  in  out  FIT s=...
 \\
\ap\pa 
            degree = Spline degree (Default: 3).
 \\
\ap\sa
See also: 
            INTERPOLATE/TT, WRITE/IMAGE
\as\no
Note:       
            1) The dispersion direction is exepected to be parallel to
               the rows of the spectrum. If the input spectrum is a
               two-dimensional frame, all rows will be averaged before
               fitting and the result fitted continuum will be growed
               to the size of the input image.
 \\
            2) For Flat-Field normalisation, use the options Type=ALL
               and a small smoothing factor to enforce spline interpolation.\\
               e.g.  CONTIN/SPEC  lnflat  nff  ? ALL 1. 3
 \\
            3) After a preliminary filtering and selection of continuum   
               points is performed, the user will be prompted for interactive
               correction. The message: \\
               > Interactive Correction (y/n/v/q, default: yes): \\
               will appear. Four answers are possible: \\
 \\
               a) Yes (y): A graphic cursor will be used to enter the lower,
               then the upper limit of one spectral region to be rejected
               (because it contains spectral features). \\
 \\
               b) No (n): No more correction wanted, the procedure will go 
               to spline fitting. \\
 \\
               c) Values (v): The lower and upper limits of one region to be
               rejected will be entered by values. The syntax is of the command
               WRITE/IMAGE is accepted (first pixel identified by <, last pixel
               by >, real number means world coordinates, sign @ indicates
               pixel numbers). \\
 \\
               d) Quit (q): The procedure will abort here. \\
 \\
\on\exs
Examples:
\ex
            CONTINUUM/SPEC  a1ss ca1  12  4
\xe\ex
            CONTINUUM/SPEC  a1ss ca1  select
\xe\ex
            CONTINUUM/SPEC  a1ss ca1  fit EMI s=1200. d=2
\xe \sxe
