% @(#)skyfitlong.hlq	19.1 (ESO-IPG) 02/25/03 14:24:08
%++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
%.COPYRIGHT  (c)  1990 European Southern Observatory
%.IDENT      skyfitlong.hlq
%.AUTHOR     OS, IPG/ESO
%.KEYWORDS   MIDAS, help files, SKYFIT/LONG
%.PURPOSE    On-line help file for the command: SKYFIT/LONG
%.VERSION    1.0  22-APR-1988 : Creation, OS
%            2.0     SEP-1991 : Cosmic rays rejection (C. Levin)
%----------------------------------------------------------------
\se
SECTION./LONG
\es\co
SKYFIT/LONG						01-APR-1993  PB
\oc\su
SKYFIT/LONG  input output [sky] [degree] [mode] [r,g,t] [radius]
	fit polynomial to spatial flux distribution in windows of every column
\us\pu
Purpose:    Fit a polynomial to the data in two windows along the y-axis.
            Two modes can be selected:

            MODE 0: It is assumed, that the normalized spatial profile
            is constant with x, i.e. only one polynomial is fitted to the
            mean spatial profile and in all columns scaled to the actual flux.
            MODE 1: For every column, an independent polynomial is fitted.

            In either mode, the fitted polynomial(s) is (are) evaluated
            for every increment in x. The output frame contains the
            evaluation of the polynomial(s) all along the associated
            column(s), not only in the windows used for the fitting.
            The command is designed to provide a frame that approximates
            the sky contamination of spectra at the y-position of the
            object.
\up\sy
Syntax:     
            SKYFIT/LONG  input output [sky] [degree] [mode] [g,r,t] [radius]
\ys\pa
            input   = input image
\ap\pa
            output  = output image (sampled as the input spectrum)
\ap\pa
            sky     = sky limits in pixel numbers, for ranges a1 to a2
                          and b1 to b2 to be entered as a1,a2,b1,b2. \\
                      Session keywords: LOWSKY, UPPSKY; default: 0,0
\ap\pa
            degree  = order of the polynomial fit. \\
                      Session keyword: SKYORD; default: 1
\ap\pa
            mode    = same spatial profile for all columns (0)
                      or independent profile for every column (1) \\
                      Session keyword: SKYMOD; default: 0
\ap\pa
            g,r,t   = gain, ron, threshold for cosmic rays rejection.
                      (used only if mode=1).
                      gain is in e-/ADU, ron in ADU, threshold in units 
                      of the standard deviation.
                      Session keywords: GAIN, RON, SIGMA; defaults: 2, 7, 3
\ap\pa
            radius  = Radius for cosmics rejection , in pixels.
                      (used only if mode=1).
                      Session keyword: RADIUS; default:  2
\ap\no
Note:       a) It is also possible to remove cosmic rays 
            beforehand with a median filter working only along the
            y-axis (use rady = 0 in command FILTER/MEDIAN).

            b) If possible night sky lines are not well aligned with
            the y-axis, mode 1 is to be preferred.

            c) Cosmics rays rejection is only performed in mode=1.
\on\exs
Examples:
\ex
            SKY/LONG  mysky myobject 10,15,35,40 3 0
\xe \sxe




