skyfit


 SKYFIT -- fits polynomials to sky and evaluates them in the object region. 

 'skyfit' is pamela's only method for sky estimation. It assumes that
 the slit is near-parallel to horizontal rows of pixels. If it is not 
 quite parallel then a sky line will gradually move across the row and 
 the resulting variation is taken out using higher order poly fits. An 
 important benefit of this method of background estimation is that cosmic 
 rays can be fairly well removed so long as there are more than a few 
 pixels. This is done with a cautious one at a time reject cycle.


 Bad pixels: skyfit checks for bad pixels in both the flat field and
             object frames. This allows the user to eliminate regions 
             once and for all (by setting appropriate region of the
             flat field) or on a frame by frame basis. If insufficient
             pixels on a particular row are found to fit, then in the
             fitted output file, the entire row will be set to the bad
             value.

 Dark frame: if a dark frame is used, the skyfit result is returned
             applying to true sky only, so you must use the same dark
             frame during extraction.
 
 Parameters:

  IMAGE  -- The data under analysis

  FLAT   -- Balance frame

  DLOAD     -- TRUE if dark frame is required.

  DARK      -- Dark frame representing counts unaffected by slit
               profile. This will be subtracted off data before applying
               the balance factors. 

  REGION -- file defining sky and object regions.  

  TRACE  -- Is a poly fit to be used to define the spectrum position?

  If TRACE

     TRACK -- The file containing the poly fit.

  SKY    -- Output file containing the polyfit to the sky evaluated over
            the object region only. This file will only cover the specified
            region of the file to save space.

  XSTART, XEND -- Valid range in X. Anything outside will be ignored.

  YSTART, YEND -- Range over which to fit polys.

  NPOLY  -- Number of coefficients to fit (1=constant, 2=linear etc).
            The correct number to be used here is best estimated by trial
            and error. If you end up with marked P-Cyg type residuals on
            sky lines then maybe you have NPOLY too small, however too
            high a value can cause excess noise especially if you are 
            effectively attempting to interpolate across a large gap.
            You should have a very good reason for anything above 3.
            Remember that often there may only be a few sky lines and you
            may be able to accept imperfect subtraction on them if it 
            improves the rest of the spectrum.

 THRESH  -- Threshold in sigma for rejection of cosmic rays, bad pixels etc.

 READOUT -- Readout noise, RMS ADU

 PHOTON  -- electrons/ADU.

 Converted to NDF by TRM 23/01/98

This command belongs to the classes: tilted , sky , fitting


Tom Marsh, Warwick