% @(#)extracfero.hlq	19.1 (ESO-IPG) 02/25/03 14:20:55
% @(#)extractfero.hlq 1.0 (ESO-IPG) 13-11-1997
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1997 European Southern Observatory
%.IDENT      extracfero.hlq
%.AUTHOR     AM, LSW Heidelberg, IPG/ESO
%.KEYWORDS   MIDAS, help files, EXTRACT/FEROS 
%.PURPOSE    On-line help file for the command: EXTRACT/FEROS
%.VERSION    1.0  13-NOV-97 : Creation, AM
%----------------------------------------------------------------
\se
SECTION./FEROS
\es\co
EXTRACT/FEROS                                        23-FEB-99 AM/OS
\oc\su
EXTRACT/FEROS straimage extimage extparams otherparams ccdparams copcoefftbl
        extract spectrum
\us\pu
Purpose:    
            Extract straightened echelle spectrum using the standard or
            optimum extraction algorithm.
\up\sy
Syntax:     
            EXTRACT/FEROS [straightimage] [extimage] [extparams]
              [otherparams] [ccdparams] [copcoefftable]

\ys\pa
            straightimage = root name of input file

\ap\pa
            extimage = root name of output file

\ap\pa
            extparams = spectrograph extractmode getprofile writeimages
            Extraction parameters
                spectrograph = spectrograph type
                valid values are
                F for single fiber and
                G for double fiber (default)
                
                extractmode = extraction mode
                valid values are
                S for standard extraction, (default)
                O for optimum extraction with cosmic masking and
                M for standard extraction with cosmic masking
                
                getprofile = get spatial profile
                valid values are
                Y for yes (default) and
                N for no

                writeimages = write additional images with fitted profile
                              and masked pixels (optimum extraction only)
                              this is intended for debugging purposes
                valid values are
                Y for yes and
                N for no (default)

\ap\pa
            otherparams = fitdeg,iterations
            Other parametres
                fitdeg = degree of the polynomial that is fitted to the orders
                iterations = number of iterations in optimum extraction

\ap\pa
            ccdparams = ccd_ron,ccd_gain,ccd_thres
            CCD parameters
                ccd_ron = CCD readout noise (electrons)
                ccd_gain = CCD gain (electrons / ADU)
                ccd_thres = threshold value for optimum extraction (ADU)

\ap\pa
            copcoefftable = root name of table with coefficients for the
                            cross order profile

\ap\sa
See also: 
            RECTIFY/FEROS, BACKGR/FEROS, DEFINE/FEROS
\as\no


Note:       
           
            1) extimage is the root name of the output image. For  single
               fiber spectrographs this is also the complete name of the
               output image. For double fiber spectra two output files are
               created. Their names are generated from the root name and
               the appendices 1 and 2.

            2) extparams: The four values must be entered without separators.
               If getprofile is set to N, then a table named copcoefftable
               with prevoiusly determined cross order profile coefficients
               must exist on disk. If writeimages is set to Y, then images
               with the fitted cross order profile and the masked pixels
               are written to files named fitted_img.bdf and mask_img.bdf.

            3) otherparams: iterations can be used to limit the number of
               masked pixels when using optimum extraction. It is the maximum
               number of pixels that are allowed to be masked.

            4) straightimage is only used, if spectrograph is set to F or G.
               straightimage is the root name of the input image. For single
               fiber spectrographs the names of the files to be used are
               generated from the root name and the appendices _C, _D, _X.
               For double fiber spectrographs  the names of the files to be
               used are generated from the root name and the appendices _C1,
               _D1, _X1, _C2, _D2, _X2. straightimage can be created with
               the command STARIGHTEN/FEROS.

            5) copcoefftable is the root name of the cross order coefficient
               file. For single fiber spectrographs this is also the
               complete name of the coefficient file. For double fiber spectra
               two coefficient files are created. Their names are generated
               from the root name and the appendices 1 and 2. If getprofile
               is set to Y, then the spatial profile is determined from
               straightimage and the coefficients are saved to copcoefftable.
               If getprofile is set to N, then a table named copcoefftable
               with prevoiusly determined cross order profile coefficients
               must exist on disk.

            6) The distinction between single fiber and double fiber is
               made via the keyword FIBER_MODE.

            7) If writeimages is set to Y, then additional images with
               fitted cross order profiles with root name specified by
               the keyword FIT_IMG  and with maskd pixels with root name 
               specified by the keyword MASK_IMG are written to disk. For
               single fiber spectrographs the root names are also the complete
               filenames. For double fiber spectrographs the filenames are
               generated from the root names and the appendices 1 and 2.

\on\exs
Examples:
\ex
            EXTRACT/FEROS  ? extracted GOYN ? ? cop_coeffs
            A double fiber spectrum with root file name straightened
            is extracted with the optimum exctraction alogrithm and
            stored in files with root name extracted. The cross order
            profile is determined from files with root name straghtened
            and the cross order coefficients are stored in files with
            root name cop_coeffs. No images with fitted cross order
            profiles or masked pixels are written.
\xe\ex
            EXTRACT/FEROS ? ? FONY
            A single fiber spectrum is extracted with the optimum
            extraction algorithm. The cross order profile coefficients
            are taken from a previously saved file. Default values for
            the file names and other parametrs are used. Images with
            fitted cross order profiles and with masked pixels are written
            to disk.
\xe \sxe
