% @(#)integrline.hlq	19.1 (ESO-IPG) 02/25/03 13:19:17 
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      integrline.hlq
%.AUTHOR     RHW, IPG/ESO
%.KEYWORDS   MIDAS, help files, INTEGRATE/LINE
%.PURPOSE    On-line help file for the command: INTEGRATE/LINE
%.VERSION    1.0  900430 RHW creation (koninginnedag !!)
%.VERSION    1.1  910309 RHW document improved a.t. verification form
%.VERSION    1.1  960116 RHW Update descriotion
%----------------------------------------------------------------
\se
SECTION./LINE
\es\co
INTEGRATE/LINE                                                 30-APR-1990  RHW
\oc\su
INTEGRATE/LINE frame [y_coo] [x_sta,x_end] [n_cur,deg] [batch] [x-pos,range]
	integrate area in a (spectral) line
\us\pu
Purpose:  
        Integrate area a (spectral) line interactively via cursor input, or 
        in batch, by interpolating polynomially between cursor positions.
\up\sy
Syntax:   
        INTEGRATE/LINE frame [y_coo] [x_sta,x_end] [n_cur,deg] [batch]
                         [x-pos,range]
\ys\pa
        frame       = input frame name
\ap\pa
        y_coo       = y-coordinate in frame (default @1). Both pixel number
                      (@) or the world coordinate can be used.
\ap\pa
        x_sta,x_end = first and last point on the line to be displayed 
	              (either as @pixel_number or as real world coordinate).
		      Defaults first and last image pixels.
\ap\pa
        n_cur,deg   = no. of cursor positions for determining the continuum
	              (smaller than 100; default 2, and degree of the 
		      polynomial fit for the interpolation (default 1).
\ap\pa
        batch       = B (for batch), anything else (for interactive use, 
	              default). In case the batch mode is used the third
                      and fourth parameter are meaningless.
\ap\pa
        x-pos,range = independent world(!) coordinate positions along the 
                      x-axis, and the range around these positions within 
                      which the average pixel value is determined that will 
                      be used for the fit (default 0.0,0.0,0.0).
\ap\sa
See also: 
        STATIST/IMAGE, READ/KEY
\as\no
Note:
        For each integration the results, x-start and x-end (pixel and world 
        coordinates), step size (pixel separation), total flux, cont. flux, 
        line flux, fraction line to continuum, and equivalent width are 
        written into the first 10 locations of the keyword OUTPUTR.\\
\\
	The algorithm works as follows.\\
 	1. For all input cursors positions x, the mean intensity over the 
	   range [x-range,x+range] is determined;\\
	2. A linear or polynomial fit (depending on the degre) is computed
	   that goes through these calculated mean intensities. This fit
	   then defines the continuum between over the range between the 
	   first and last cursor input position.\\
	3. For calculating the line integrals in the first and last bins the 
	   first/last input cursor position and the middle of the (first 
	   and second) / (one but last and last) real image pixel are used.
	   So the algorithm computes here an integral over a fraction of a 
	   pixel.\\
	4. The other line and continuum integrals are determined by simply 
	   subtracting the fitted contnuum from the real pixel intensity and
	   by multiplying this differences by the pixel separation.
	5. Steps 4 and 5 are identical with the calculations in the interactive
	   mode.\\
\\
        Interactive use: Use any key except (incl. RETURN), or the mouse 
        enter button to validate the cursor (both x and y) positions. When 
        the specified number of cursor positions has been entered, the 
        interpolated line is drawn and the integration is done. Use the space
        bar or the mouse exit button to terminate.
\\
        Batch use: No graphics terminal required; just give a `B' value for 
        the batch parameter, and relevant x-values and range. Contrary to 
        the interactive integration, where the y-positions of the cursor are 
        used to determine in the intergration interval, in batch mode the 
        y-positions are equal to the pixel values of the corresponding input 
        x-coordinates. If the x-coordinate falls between two frame pixels 
        the y-position is obtained from a straight average of both pixel 
        values.
\\     
        In case the interactive mode is used, the maximum number of pixels 
        that can be plotted is 100000, in case bin mode is on, 50000. 
        A fatal error occurs if this number is exceeded.
\\
        Note, that for batch use, the third parameter (x-start, x-end) is
	irrelevant.
\on\exs
Examples:
\ex
        INTEGRATE/LINE GL @1 5,50 2,1
        Do the integration(s) on line 1 of frame GL between world coordinates
        5 and 50, using two cursor positions and linear interpolation.
\xe\ex
        INTEGRATE/LINE GL @1 ? ? B 23.5,26.5,0.05
        Batch version, with x-coordinates (and tolerance) specified.
        Look at the output: READ/KEY OUTPUTR.
\xe \sxe
