%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      calibwfors.hlq
%.AUTHOR     SM, LSW
%.KEYWORDS   MIDAS, help files, CALIBRATE/MOS
%.PURPOSE    On-line help file for the command: IDENT/MOS
%.VERSION    1.0  09-SEP-1993 : Creation, SM
%----------------------------------------------------------------
\se
SECTION./MOS
\es\co
CALIBRATE/MOS					09-SEP-1993 SM
\oc\su
CALIBRATE/MOS [tol] [degree] [mode] [wcenter],[avdisp] [plotc] display
	determination of calibration coefficients
\us\pu
Purpose:   
	  Computes wavelength dispersion coefficients
\up\sy
Syntax:
	  CALIBRATE/MOS [tol] [degree] [mode] [wcenter],[avdisp] [plotc] [disp]
\ys\pa

	  tol = tolerance (> 0 in pixels, < 0 in wavelength units)
              Session keyword: TOL
              Default: 2
	  degree = order of fit for dispersion relation
              Session keyword: WLCORD(1)
              Default: 2
	  mode = two-character flag: 
              Session keyword: WLCMTD
              Default: RC
	      operation mode:
	      I(dent)  lines have been identified by IDENTIFY/MOS
	      L(inear) central wavelength and dispersion are given
	      R(ecall) central wavelength and dispersion are given, for
		  one slitlet method linear is applied. Then the first
		  successfull dispersion relation is recalled for the other
		  slitlets.	
	      fit mode:
              C(onstant linelist) - in each slitlet the lines are 
		  identified for all rows and a global fit for the
		  whole slitlet is achieved. 
	      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.
	      T(wo-dimensional fit) - The dispersion relation is fitted in
	 	  two dimensions - the dispersion and the spatial direction.
		  In dispersion direction polynoms like given in POLYPE 
		  are fitted but in spatial direction normal polynoms.
	  wcenter = central wavelength (for mode LINEAR and RECALL)          
              Session keyword: WCENTER
              Default: 0
	  avdisp = average dispersion (wavelength/pixel) (only for mode 
	      LINEAR and RECALL)
              Session keyword: AVDISP
              Default: 0
	  plotc = plot option for residuals (default: N)
              Session keyword: PLOTC
              Default: N
	  disp = display level for results
              Session keyword: DISP
              Default: 0
	      < 50        no display (except positions of bad lines)
	      >= 50 ... < 100 additional display of parameters
	 		  and first results for each slitlet
	      >= 100  additional display of results for each
			  scanned line
\ap\sa
See also:
          SEARCH/MOS, IDENTIFY/MOS
\ap\no
Note:       
          This command takes the arc lines found by SEARCH/MOS from the
          table given by the keyword LINPOS (default: linpos) and tries
          to identify them with the lines listed in the table given by the 
          keyword LINCAT (default: hear). A first guess is obtained either
          from the lines identified with IDENTIFY/MOS or by the central
          wavelength and average dispersion, which may be provided by
          keywords WCENTER, AVDISP, on the command line.

	  With these first estimates a line identification is performed 
	  and after this the dispersion relation is fitted again. Lines 
	  with residuals larger than the tolerance are thrown out 
	  iteratively. The fit procedure is repeated until either the
	  number of identified lines does not change anymore (and the
	  minimum number of iterations has been performed (see 
  	  WLCNITER(1)) or the maximum number of iterations (see 
	  WLCNITER(2)) has been performed. At the end of each slitlet a 
          linear fit to the selected lines is performed to allow an 
          estimation of the mean linear dispersion.  This is needed
	  in order to take into account the offsets between the slitlets:
	  these offsets are transformed into wavelength offsets using
	  the mean linear dispersion. 

	  Any selection made for table LINPOS will be taken into account,
	  but no selection of table MOS. Taking into account selections 
	  of both tables could lead to confusion. If you want the 
	  selection flag of table MOS to be effective here, you should
	  redo SEARCH/MOS with the selected MOS table.

	  For any method an appropiate wavelength catalog (LINECAT) is
	  required. Any lines that are not present in the light source 
	  should be removed as well as any line blends that occur at the 
	  given spectral resolution. 
	  
	  The output coeficients are stored in table LINFIT (default: coerbr)
\on\exs
Examples:
\ex
          CALIBRATE/MOS 2 4 RC 5370,3.0 n 50\\
          Uses mode RC (Recall/Constant).  The central wavelength (5370 
	  Angstroem) and mean linear dispersion 3.0 Angstroem/Pixel is given
          in the command line. Tries to identify the lines in the table
          given by keyword LINPOS (default: linpos) by comparing to the line
          catalog given by keyword LINCAT (default: hear) with a tolerance of
          2 pixels and to fit a polynomial of 4th order to the identified 
	  lines. The type of the polnom is taken from keyword POLTYPE.
          No residuals are plotted plotted. 

          CALIBRATE/MOS -2 3 iv ? y 50
          Uses mode IV (Ident/Variable) and takes the pixel positions of
          identified lines from keyword XPOS and the resp. wavelengths from
          keyword LID and performs a first fit of 3rd degree. Tries to 
	  identify the remaining lines in the table given by keyword LINPOS 
	  (default: linpos) by comparing to the line catalog given by keyword 
          LINCAT (default: hear) with a tolerance of 2 wavelength units (e.g. 
          Angstroem) and redo fit. Bad lines are thrown out.
          The results are given for the first row of each slitlet and plotted. 

	  CALIBRATE/MOS -2 3 LT ? n 50
          Same as above but a linear dispersion is assumed in any slitlet
	  to identify the lines during the first iteration. The wavelengths
	  are fitted by polynoms in two dimensions - it depends on x and y.
	  The output is stored row by row in table LINFIT (default: coerbr).
\xe \sxe
