% @(#)rectiflong.hlq	19.1 (ESO-IPG) 02/25/03 14:24:06
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      rectiflong.hlq
%.AUTHOR     DB/KB, IPG/ESO
%.KEYWORDS   MIDAS, help files, RECTIFY/LONG
%.PURPOSE    On-line help file for the command: RECTIFY/LONG
%.VERSION    1.0  20-AUG-1985 : Creation, DB/KB
%----------------------------------------------------------------
\se
SECTION./LONG
\es\co
RECTIFY/LONG    					20-AUG-1985  DB/KB
\oc\su
RECTIFY/LONG  in out [reference] [nrep] [deconvol_flag] [line]
	rectify geometrically a distorted 2-D spectrum
\us\pu
Purpose:     
             Geometrically rectify a distorted 2-D spectrum (e.g. obtained
             with an image tube) and rebin it to constant step in wavelength
\up\sy
Syntax:     
             RECTIFY/LONG  in out [reference] [nrep] [deconvol_flag]
\ys\pa
             in            = input frame
\ap\pa
             out           = output frame
\ap\pa
             reference     = a) image to define the output sampling domain.
                             b) start,step,npix to define along X axis the 
                                start and step in wavelength and the number 
                                of pixels.
                             c) if no value is provided, start,step and npix
                                are automatically computed.
\ap\pa
             nrep          = additional sub-stepping factor (cf. "note" below)
                             default: 1, maximum: 5
\ap\pa
             deconvol_flag = deconvolution flag. Y=YES, N=NO. Default: N.
\ap\sa
See also:   
             SEARCH/LONG, IDENTIFY/LONG, CALIBRATE/LONG, REBIN/LONG,\\
             APPLY/DISPERSION
\as\no
Note:       
             The photometric accuracy per pixel is thought to be better than
             about 1% for a PCD or ST-FOC frame with constant uniform flux.
             The flux conservation is perfect if also nearest neighbours are
             considered. At the expense of further CPU time consumption, the
             said 1% level can be reduced to 0.1% if nrep is increased to 5.
             This seems justified only for observations of the highest S/N.
             The programme routinely performs a simple 'deconvolution'
             assuming a fixed point spread function (PSF) of about one pixel
             which appears appropriate for a wide range of applications.
             This can be suppressed (deconvol_flag = N) for test purposes
             or low-resolution data, i.e. data with a FWHM of the PSF of a
             few pixels, but even for high-resolution data the results are
             not bad. With deconvol_flag = N (and nrep = 1), the execution
             time is reduced by a factor of 5 !
             The DIFFERENCE to RECTIFY/IMAGE is that in this version the
             number of pixels along the "x" (wavelength) axis in output is
             forced to be the same as in input thus roughly preserving the
             identity of the resolution elements. The geometric rectification
             and the rebinning to constant step in wavelength are done
             simultaneously which avoids the degradation of the data due to
             the twofold rebinning that otherwise would be necessary. Tests
             show that with a set of carefully selected comparison lines
             an accuracy of the wavelength calibration of better than 0.2
             pixels (RMS error) can easily be achieved with nrep = 1 and
             deconvol_flag='Y'.
             The dispersion coefficients defining the geometric transformation
             are stored in the keywords KEYLONGC (character), KEYLONGI 
             (integer) and KEYLONGD (double precision) to model the distortion
             in the wavelength axis, and in the keywords COEFYC (character), 
             COEFYI (integer) and COEFYD (double precision) to model the 
             distortion perpendicular to the wavelengths.
             These coefficients are generated with the command 
             REGRESSION/POLYNOMIAL.
             The resampling step (keyword REBSTP) should preferably 
             be close to or larger than the average dispersion per pixel, 
             as provided by the command CALIBRATE/LONG. 
 
             The descr. START of the input frame must be set to 1.0 .
\on\exs
Examples:
\ex          
\\{\tt
             >SET/LONG WLC=wlc LINCAT=hear  WIDTH=5 THRES=15. \\
             >SEARCH/LINE \\
             >IDENTIFY/LONG\\
             >CALIBRATE/LONG\\
             >RECTIFY/LONG  object output    ! resample the object
\\}
             This example shows how to prepare all the required 
             information for RECTIFY/LONG.
\xe \sxe

