% @(#)reduceccd.hlq	19.1 (ESO-SDAG) 02/25/03 14:15:03
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1993 European Southern Observatory
%.IDENT      reduceccd.hlq
%.AUTHOR     RHW, IPG/ESO
%.KEYWORDS   MIDAS, ccd package, REDUCE/CCD
%.PURPOSE    On-line help file for the command: REDUCE/CCD
%.VERSION    920910 RHW created
%.VERSION    930325 RHW Documentation update
%.VERSION    950113 RHW Update according to modification for DO
%---------------------------------------------------------------------
\se
SECTION./CCD
\es\co
REDUCE/CCD                                                     25-Mar-1993 RHW
\oc\su
REDUCE/CCD [in_spec] [out_frm]
	Do the (partial) calibration of one or more frames
\us\pu
Purpose:    
	Do the (partial) calibration of one or more frames
\up\sy
Syntax:     
        REDUCE/CCD [in_spec] [out_frm] [o_flag]
\ys\pa
        in_spec = single (science) frame or MIDAS CCD input table (with 
                  the extension .tbl) containing the names of the frames 
                  and the names of the master calibration frame(s) to be used
                  for the calibration. Default is the input specification 
                  stored in the CCD keyword CCD_IN.
\ap\pa
        out_frm = name of the (partially) reduced science frame. The default 
                  name is the name stored in the keyword CCD_OUT is used. If
                  that is empty the output frame name is the same as the input
                  with the extension "_reduc".
                  NOTE: This parameter is only used is case of single frame
                        input for the first parameter.
\ap\pa
        o_flag =  Overwrite flag. If "Y" existing reduced will be overwritten.
                  Default N.
\ap\no
Note:       
        The command can be used to reduce a single frame or a list of 
        frames stored in a MIDAS input table. The default input is taken 
        from the keyword CCD_IN.\\

        First, the case of a single frame reduction:\\
        In this case the first parameter should contain the name of the frame
        (without the extension .bdf). The command assumes that the name of 
        the calibration frames are stored in the keyword SC_expFRM, where 
        `exp' is the two letter code for the exposure type, AND that these
        calibration frame are available.\\
        The default output name is the identical to the name of the input 
        frame with the extension "_reduc".\\

        In the case multiple frame reductions:\\
        In this case the command expects a MIDAS table as input, including 
        the extension .tbl. The command will take all information from this 
        table. i.e. the input science frames, and the names of the master 
        calibration frames to be used. The name of the output science frame 
        is the identical to the name of the input frame with the extension 
        "_reduc"\\

        This is what the command will do to your data:\\
        1. The command will look in the SC_ keywords (see below) to determine 
           what corrections are to be applied (for the keywords, see below);\\
        2. As far as the master calibration frames concern, it checks for the 
           existence of these frames. \\
           In the case of table input, if a calibration frame of a particular 
           exposure type is required but not available, the calibration 
           process will be suspended, and the command will first try the 
           create that calibration frame, assuming the CCD naming convention
           and using the command COMBINE/CCD. Thereafter, the calibration will 
           continue. \\
           In case of single frame input, if the calibration frame is not 
           available this calibratiob step will not be executed.
        3. By reading the CCD descriptor of the science and calibration frames
           the command checks if a calibration step was already done. If so, 
           this step will not be executed, even if it was asked for. \\
        4. After all calibration frames are present it will, in a sequential 
           order do the requested calibration (if not done already, see
           below). The following steps can be executed:\\
           \ \ \ correct for overscan (keyword SC_SCAN);\\
           \ \ \ trimming (keyword SC_TRIM)\\
           \ \ \ bad pixel correction (keyword SC_FXPIX);\\
           \ \ \ bias correction (keywords SC_BSCOR and SC_BSFRM);\\
           \ \ \ dark correction (keywords SC_DKCOR and SC_DKCOR);\\
           \ \ \ flat fielding (keywords SC_FFCOR and SC_FFCOR);\\
           \ \ \ illumination correction (keywords SC_ILCOR and SC_ILFRM);\\
           \ \ \ fringing correction (keywords SC_FRCOR and SC_FRFRM).\\
        5. After a calibration step has finished successfully the command 
           will write a flag into the frame descriptor, indicating that the 
           calibration step(s) was (were) completed.\\

         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
\ees\exs
Examples:
\ex
        REDUCE/CCD rost_asso.tbl
        Start the ccd reduction sequence. Use the reduction table redtbl.tbl.
        All calibration frames will be obtained from that reduction table. 
        Do the calibration according to the keyword settings.
\xe\ex
        REDUCE/CCD m100rraw ?
        Start the ccd reduction sequence for the frame m100rraw. The output
        frame will be m100raw_reduc. The command will read the keywords 
        SC_xxCOR to find out which calibration are wanted. The names 
        of the calibration frame are taken from the keywords SC_xxFRM.
\xe\ex
        REDUCE/CCD 
        Start the ccd reduction sequence. Use the reduction table stored in 
        the keyword CCD_IN. Use the settings of the keywords SC_xxCOR to get 
        the calibration options.
\xe\sxe







