%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1994 European Southern Observatory
%.IDENT      wldefmos.hlq
%.AUTHOR     SM/LSW
%.KEYWORDS   MIDAS, help files, WLDEF/MOS
%.PURPOSE    On-line help file for the command: WLDEF/MOS
%.VERSION    1.0  4-AUG-1994 : Creation, SM
%----------------------------------------------------------------
\se
SECTION./MOS
\es\co
WLDEF/MOS					04-AUG-1994 SM
\oc\su
	WLDEF/MOS [wlc] [t,w] [ybin] [meth] [tol] [wlcord] [wlcmtd] [plotc]
	
\us\pu
Purpose:   
	  Search for lines in MOS slitlets, centers them and fits the
	  dispersion relation	
\up\sy
Syntax:	
	  WLDEF/MOS [wlc] [t,w] [ybin] [meth] [tol] [wlcord] [wlcmtd] [plotc]
\ys\pa
	  wlc = wavelength calibration image. \\
	      Session Keyword: WLC \\
              Default value: wlc
	  t,w = threshold, window \\.
	      Session Keyword: SEAPAR \\
              Default value: 200,5   
	  ybin = step, binning factor in y-direction.
	      Session Keyword: YBIN \\
              Default value: 3,3
	  meth = centering method (gaussian or gravity).  \\
	      Session Keyword: CENTMET \\
              Default value: gravity
	  tol = tolerance for line identification\\
              (> 0 pixels, < 0 wavelength units)\\ 
	      Session keyword: TOL\\
              Default value: 2
	  wlcord = degree of fit to dispersion relation\\
	      Session keyword: WLCORD(1)\\
              Default value: 2
	  wlcmtd = method of fit\\
	      Session keyword: WLCMTD\\               
              Default value: FC
              operation mode:
              L(inear) central wavelength and dispersion are given
              F(ors)   mode for FORS observations: grism number,
                  central wavelength and average linear dispersion
                  are stored
              fit mode:
              C(onstant linelist) - in each slitlet the lines are
                  identified for the first row and kept for the
                  whole slitlet. In this mode, the dispersion
                  relation may gradually evolve throughout the
                  slitlet, because the dispersion relation from
                  one row is used to identify the lines in the
                  next row. But all lines are kept, you cannot
                  throw out bad lines this way!
              V(ariable linelist) - for each row the dispersion
                  relation of the first row is used to identify
                  the lines and bad lines are thrown out.
              F(it all)  - This mode is a combination of V and C: the
                  dispersion relation may evolve gradually along the
                  slitlet AND bad lines are thrown out. As this mode
                  may produce rather  unstable fits you should only
                  use it for  very good-natured data!
	  plotc  = plot of residuals (y or n)\\
	      Session keywords: PLOTC\\
              Default value: N
\ap\sa
See also:
          SEARCH/MOS, CALIBRATE/MOS
\as\no
Note:       
	  This command combines SEARCH/MOS and CALIBR/MOS. At first it
	  searches the frame WLC, using the parameters threshold, window,
	  binning and step in y, and centering method as giving in 
	  parameters 2 -- 4 (or the resp. keywords). The results
	  are written to table given the keyword LINPOS and the
	  slitlet positions are taken from table given keyword MOS.
	  Then it takes either the grism number from the header of
	  WLC (WLCMTD(1) = F) or reads the keywords AVDISP (average 
  	  dispersion) and WCENTER (central wavel.) (WLCMTD(1) = L).
	  Using the numbers obtained this way it performs the 
	  identification of the lines and fits the dispersion 
	  relation with a polynomial (type keyword POLTYP) of
	  degree given by parameter 6. The resulting coefficients
  	  are stored in the table given by keyword LINFIT and
	  - depending on the last parameter - plotted.
          For a detailed description of the fitting procedure see
          on-line help of CALIBRATE/MOS.
\on\exs
Examples:
\ex
	WLDEF/MOS ? ? 10,3 ? -2 3 FC y
        Takes the frame name from keyword WLC and does a line search with
        threshold and width of search window defined by keyword SEAPAR and
        centers the detected lines with the method defined in keyword
        CENTMET. It scans every 10th CCD row and averages 3 rows before
        searching the lines. It takes central wavelength and average
        dispersion/pixel from the keyword belonging to the grism used
        (e.g. FORS01 for grism #1) and does not throw out any bad lines
        during the fit and identification procedure. The tolerance for
        identification is 2 wavelength units and the fit is a 3rd order
        polynomial. The residuals are plotted.
\xe \sxe
