% @(#)extraclong.hlq	19.1 (ESO-IPG) 02/25/03 14:24:03
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1993 European Southern Observatory
%.IDENT      extraclong.hlq
%.AUTHOR     23-MAR-93, IPG/ESO
%.KEYWORDS   MIDAS, help files, 
%.PURPOSE    On-line help file for the command: EXTRACT/LONG
%.VERSION    1.0  PB : Creation, 23-MAR-93
%----------------------------------------------------------------
\se
SECTION./LONG
\es\co
EXTRACT/LONG					   PB  23-MAR-93
\oc\su
EXTRACT/LONG  in  out  [sky]  [obj]  [order,niter]  [ron,g,sigma]  
	Optimal extraction of a long-slit spectrum
\us\pu
Purpose:    
            Extract spectrum from CCD frame. The rows of the spectrum are
            added with weights which are chosen for optimal S/N-ratio of
            the resulting spectrum. Cosmic ray hits are removed by
            analyzing the profile perpendicular to the dispersion (assumed
            to be along the x-axis). The method is only suited for
            spectra of (spatially) unresolved sources. The method is very
            similar to the one described by Horne (1986, PASP 98, 609).
\up\sy
Syntax:     
            EXTRACT/LONG in out [sky] [obj] [order,niter] [ron,g,sigma] 
\ys\pa
            in          =  Input long-slit spectrum
\ap\pa
            out         =  Name of the output 1D spectrum
\ap\pa
            sky         =  a) frame with fitted sky spectrum  \\
                           (e.g., as supplied by command SKYFIT/LONG)\\
                        =  b) constant (e.g. 0, if no sky shall be subtracted);
                           Default : 0.
\ap\pa
            obj         =  low,upp. Boundaries (in y) of the object spectrum,\\
                           in pixels. \\
                           Session keyword : OBJECT; no default value.
\ap\pa
            order,niter =  order of polynomial fitted to spatial profile, \\
                           no. of iterations. \\
                           Session keywords : ORDER, NITER; default : 3,3
\ap\pa
            ron,g,sigma = read-out-noise (ADU), inverse gain factor (e-/ADU),
                          threshold for the removal of cosmic ray hits 
                          (in units of the standard deviation calculated 
                          for each pixel from the number of electrons and 
                          the ron) \\
                          Session keywords : RON, GAIN, SIGMA \\
                          Defaults         : 7, 2, 3
\ap\sa
See also: 
            SKYFIT/LONG, EXTRACT/AVERAGE, APPLY/DISPERSION
\as\no
Note:       a) In order for the weighting procedure to work properly, the
            ADU numbers must not differ significantly from the raw ones
            after bias correction. Therefore, any prior flat-fielding
            requires usage of a flat-field normalised to its mean flux
            (command NORMALIZE/FLAT).

            b) Although the extraction must normally be performed after
            spectrum rebinning (using REBIN/LONG or RECTIFY/LONG), 
            it can also be performed on non-rebinned spectra.
\on\exs
Examples:
\ex
            EXTRACT/LONG inframe result skyframe  251,263  3,3  36,6,4
\xe \sxe
