% @(#)illflaccd.hlq	19.1 (ESO-IPG) 02/25/03 14:15:01
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1993 European Southern Observatory
%.IDENT      illflaccd.hlq
%.AUTHOR     RHW, IPG/ESO
%.KEYWORDS   MIDAS, ccd package, SKYFLAT/CCD
%.PURPOSE    On-line help file for the command: SKYFLAT/CCD
%.VERSION    930827 RHW Documentation created
%.VERSION    930922 RHW Improved documentation
%.VERSION    931101 RHW Released
%---------------------------------------------------------------------
\se
SECTION./CCD
\es\co
ILLFLAT/CCD                                                     1-Nov-1993 RHW
\oc\su
ILLFLAT/CCD [in_spec] [out_frm] [xboxmn,xboxmx] [yboxmn,yboxmx] [clip] 
           [lowsig,higsig]
	Apply correction to a flat field to remove illumination pattern
\us\pu
Purpose: 
	Apply correction to flat field to remove illumination pattern
\up\sy
Syntax:     
        ILLFLAT/CCD [in_spec] [out_frm] [xboxmn,xboxmx] [yboxmn,yboxmx]
                    [clip] [lowsig,higsig]
\ys\pa
        in_spec = single flat frame or MIDAS CCD reduction table (with the 
                  extension .tbl) containing the names of the flat frame(s)
                  in the column :FF. Default input is taken from the keyword 
                  CCD_IN.
\ap\pa
        out_frm = name of the illumination corrected flat field. Default 
                  the output file the same as the input frame: hence by 
                  default the input flat frame will be OVERWRITTEN.
                  This parameter is only used is case of single frame input 
                  for the first parameter. In case the output is taken a 
                  reduction table the output frame(s) will replace the input 
                  flat frames: hence the input flat frame will be OVERWRITTEN.
\ap\pa  
        xboxmn,xboxmx = minimum and maximum smoothing box size along the x 
                  axes.  The minimum box size is used at the edges and grows 
                  to the maximum size in the middle of the image.  This 
                  allows the smoothed image to better represent gradients 
                  at the edge of the image. If a size is less then 1 it is 
                  interpreted as a fraction of the image size. If a size is
                  greater than or equal to 1 then it is the box size in 
                  pixels.  A size greater than the size of image selects a 
                  box equal to the size of the image. Default values are taken
                  from the keyword IL_XBOX.
\ap\pa
        yboxmn,yboxmx = see above. Default values are taken from IL_YBOX.
\ap\pa
        clip =    Clean the input frame(s) of objects? If yes then a clipping 
                  algorithm is used to detect and exclude objects from the 
                  smoothing. Defaault taken from IL_CLIP.
\ap\pa
        lowsig,higgsig = sigma clipping thresholds above and below the 
                  smoothed illumination. Default values are taken from
                  the keyword IL_SIGMA. The keyword is only read in case 
                  clip=yes.
\ap\no
Note:     
        The command operates very similar to the command REDUCE/CCD, which
        the exception that the command not check for the exposure type of 
        the input frame.

        In case the input is an association table the command will check for
        the existence of the flat frames in the column :FF in the association
        table. Flat frames that do not exit will be created first, provided 
        the association table contain the :FF column. Other relevant 
        calibration frames for processing the flat frames, will be taken from 
        the corresponding calibration columns. From the reduced flat field, 
        an illumination correction frame is produced by smoothing the 
        calibrated flat frame using a moving "boxcar" average.\\

        The reduced flat frame is then divided by the scaled illumination 
        correction to produce the illumination corrected flat. The output 
        will OVERWRITE the original (reduced) flat frames. Hence, the output 
        illumination flat will automatically be used as flat in subsequent 
        calibration procedure(s).\\
        NOTE: THE MASTER FLAT FIELDS WILL BE SUBSTITUTED BY THE CORRECTED ONES.
\\
        In the case of single frame input and all calibration frames input 
        will be taken from the SC_ keywords and must exist. Also here, the
        default is that the output illumination corrected flat will replace 
        the input flat.\\

        The IM_SEC keyword may be used to assign a region of interest for which
        the correction has to be done.\\

        For more information see the CCD chapter in Volume B of the User's 
        manual.
\on\see
See also:   
        SET/CCD, SHOW/CCD, HELP/CCD, REDUCE/CCD, SKYCOR/CCD
\ees\exs
Examples:
\ex
        ILLFLAT/CCD redtbl.tbl
        Reduce all flat frames in the the ccd reduction table redtbl.tbl. All 
        master calibration frames will be obtained from that reduction table. 
        Do the calibration according to the keyword settings. After calibration
        produce an illumination frame, using the  `IL_' keyword settings.
        Hereafter the illumination corrected flat field is computed by dividing
        the original flat by the illumination frame. All calibration frames are
        taken from the table redtbl.tbl. The output corrected flats will have 
        the same name as the original flat except for the extension `_if'.
\xe\ex
        ILLFLAT/CCD m100rraw_ff m100rraw_if
        Do the illumination correction for the frame m100rraw_ff. Check if the 
        input was already reduced, and do the reduction if needed. Hereafter 
        produce the output output frame m100rraw_if. In case calibration frames
        are to be applied the names of these frames will be obtained from the 
        keyword SC_xxFRM and SC_xxFRM, where `xx stands for the exposure type
        of the calibration frame (BS, DK).
\xe\sxe



