A spectrum can be extracted from each trace found. It supports tophat and optimal extraction. In both cases, the sky background is fitted in one dimention only. The uncertainty at each pixel is also computed, but the values are only meaningful if correct gain and read noise are provided.
The extraction loops over each pixel (x) position along the spectral direction. At pixel x, a slice with
apwidth on either side of the
trace (y), rounded to the nearest pixel, is summed to get the combined signal, sky and noise ADU. The slices of length
skyidth with a spearation of
skysep from the spectral slice are used to model the sky background fitted with a polynomial with an order of
A LOWESS or Gaussian profile can be used for optimal extraction. Then at each step of the iteration, the new weighted model and data are compared until the difference is less than 0.01%. Detailed descriptions can be found in Horne 1986.