% @(#)defineeche.hlq	19.1 (ESO-IPG) 02/25/03 14:18:32 
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      defineeche.hlq
%.AUTHOR     JDP, IPG/ESO
%.KEYWORDS   MIDAS, help files, DEFINE/ECHE
%.PURPOSE    On-line help file for the command: DEFINE/ECHE
%.VERSION    1.0  17-DEC-1986 : Creation, JDP
%----------------------------------------------------------------
\se
SECTION./ECHE
\es\co
DEFINE/ECHE						29-JUL-1991 PB
\oc\su
DEFINE/ECHE  [ordref] [width1,thres1,slope] [defmtd] [defpol]
	define echelle order positions
\us\pu
Purpose:    
            Search for order positions in a 2-D echelle frame. The positions 
            of points located in order and in interorder space are stored 
            in an auxiliary table, named order.
\up\sy
Syntax:     
            DEFINE/ECHE [ordref] [width1,thres1,slope] [defmtd] [defpol]
\ys\pa
            ordref = raw flat field used as input image
                     Echelle keyword is ORDREF.
\ap\pa
            width1 = is the full width at half maximum of the orders accross 
                     the dispersion direction (in pixels). 
                     Echelle keyword is WIDTH1 and default is 8.
\ap\pa
            thres1 = is the absolute threshold for the order detection
                     (see note). Echelle keyword is THRES1 and default 
                     value is 1000.
\ap\pa      
            slope  = initial estimate of the mean slope of the orders.
                     If the spectra have been correctly rotated to
                     the standard orientation (see ROTATE/ECHELLE),
                     the slope must be slightly positive.
                     Echelle keyword is SLOPE and default value is 0.05
\ap\pa
            defmtd = defines the method used to detect the orders. Possible
                     methods are :\\
                     STD: the standard (default) method, recommended for well 
                          separated orders (e.g., for CASPEC above 4700 A).\\
                     COM: thresholding is done after complementing pixel 
                          values. Useful where orders are more crowded 
                          (interorder space less than order width).\\
                     Echelle keyword is DEFMTD. Default is STD.
\ap\pa
            defpol = degree of the 2D polynomial used to approximate the
                     position of the orders as y = f(x,m), where\\
                         y: is the line number in pixels;\\
                         x: is the sample number in pixels;\\
                         m: a relative order number.\\
                     Echelle keyword is DEFPOL. Default is 3,4
\ap\sa
See also:   DEFINE/HOUGH. 
\as\no
Note:         
            The auxiliary table order is used as intermediate storage
            Parameters can be defaulted to the corresponding session
            values (SHOW/ECHELLE to display the current values).

            The performance of the algorithm depends sensitively on 
            the value entered for the width of the order profile. 

            In its present version, the algorithm will crash if the 
            exposure level of a detected order drops below the detection 
            threshold. This can cause problems if, as can be the case 
            with the Echellec, in the center of the frame the scattered 
            light level in the interorder region is higher than the 
            exposure level within the orders towards their end(s). Use 
            {\tt EXTRACT/IMAGE} to extract the useful part of the frame.
\on\exs
Examples:
\ex
             DEFINE/ECHELLE stdframe  6,10
\xe \sxe

