% @(#)fit_flat.hlq	19.1 (ESO-IPG) 02/25/03 14:03:22 
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      fit_flat.hlq
%.AUTHOR     KB, IPG/ESO
%.KEYWORDS   MIDAS, help files, FIT/FLAT_SKY
%.PURPOSE    On-line help file for the command: FIT/FLAT_SKY
%.VERSION    1.0  20-MAR-1984 : Creation, KB
%----------------------------------------------------------------
\se
SECTION./FLAT
\es\co
FIT/FLAT_SKY						20-MAR-1984  KB
\oc\su
FIT/FLAT_SKY outframe = inframe [in_specs] [order] [back_surface]
FIT/FLAT_SKY inframe [in_specs] [order] [back_surface]
	Approximate background of image by a surface
\us\pu
Purpose: 
           Approximate background of an image by a surface created from a
           2dim polynomial, using the least-squares method.
\up\sy
Syntax: 
           FIT/FLAT_SKY outframe = inframe [in_specs] [order] [back_surface]
           FIT/FLAT_SKY inframe [in_specs] [order] [back_surface]
\ys\pa
           outframe = the computed background will be subtracted from the input
               image and stored in outframe
\ap\pa
           inframe = image where the reference points are taken from
\ap\pa
           in_specs = specifications for defining the background areas,
               (a) CURSOR if the subimages are chosen via the cursor rectangle;
               (b) name if the table 'name' holds the background area
               definitions in the columns :XSTART, :YSTART, XEND and :YEND;
               defaulted to CURSOR
\ap\pa
           order = x-ord,y-ord, the orders in x and y of the approximating
                polynomial; 
	       defaulted to 1,1 (max. order: 6,6)
\ap\pa
           back_surface = name of frame to hold the background surface, if not
                given, the background is not saved
\ap\sa
See also: 
           CONVERT/TABLE
\as\no
Note:    
           The "average" value in the background areas will be computed via a
           kappa-sigma clipping algorithm.
           Kappa = 2, i.e. we reject all pixels with values differing more than
           two sigma from the mean.
\on\exs
Examples:
\ex
           FIT/FLAT ccd005 = ccd004 cursor 2,2 ccdback
             Use polynomial of order 2 in x and y to approximate the background
             of image `ccd004.bdf'. The areas with the background are chosen
             interactively via the cursor rectangle.
             The approximated background is saved in image `ccdback.bdf' .
             Finally the background is subtracted from `ccd004.bdf' and the
             result stored into frame `ccd005.bdf' .
\xe\ex
           FIT/FLAT ccd004 CURSOR 2,2 ccdback
             As above, but do not subtract background from `ccd004.bdf' .
\xe\ex
           FIT/FLAT ccd004 backgr 2,2 ccdback
             As above, but use the table `backgr.tbl' to obtain the background
             areas of `ccd004.bdf' .
\xe \sxe
