A special case occurs if TUNE_SKYPOLY=0, in which case the sky model is set to zero everywhere.
This version of the module has additions to allow improved estimates to be made by fitting polynomials in the X-direction also. This is enabled using the variable 'vari_sim' and is CPU intensive.
If enabled then each offset from the order trace has a separate sky fit done in the X-direction. These fits are then subjected to a simulation process to estimate the variance on the fitted sky values. These variances and then used to weight the values used to fit in the spatial direction (between dekker limits).
Regions suspected of containing sky lines are selected as those where the observed value deviates from the fit by more than 'line_thresh' sigma, and for such values (and their 'xwin' neighbours on either side) the 'improved' estimates are not used in the per-X-increment fits.
Martin Clayton