Estimate the background in an NDF by removing small scale structure
The algorithm proceeds as follows. A filtered form of the input data is first produced by replacing every input pixel by the minimum of the input values within a rectangular box centred on the pixel. This filtered data is then filtered again, using a filter that replaces every pixel value by the maximum value in a box centred on the pixel. This produces an estimate of the lower envelope of the data, but usually contains unacceptable sharp edges. In addition, this filtered data has a tendency to hug the lower envelope of the noise, thus under-estimating the true background of the noise-free data. The first problem is minimised by smoothing the background estimate using a filter that replaces every pixel value by the mean of the values in a box centred on the pixel. The second problem is minimised by estimating the difference between the input data and the background estimate within regions well removed from any bright areas. This difference is then extrapolated into the bright source regions and used as a correction to the background estimate. Specifically, the residuals between the input data and the initial background estimate are first formed, and residuals which are more than three times the RMS noise are set bad. The remaining residuals are smoothed with a mean filter. This smoothing will replace a lot of the bad values rejected above, but may not remove them all. Any remaining bad values are estimated by linear interpolation between the nearest good values along the first axis. The interpolated residuals are then smoothed again using a mean filter, to get a surface representing the bias in the initial background estimate. This surface is finally added onto the initial background estimate to obtain the output NDF.
’
s Variance
component. If the NDF has no Variance component, the suggested default is based on the
differences between neighbouring pixel values, measured over the entire input NDF. If
multiple slices within the NDF are to be processed independently (see parameter BOX), it may
be more appropriate for a separate default RMS to be calculated for each slice. This will
normally be the case if the noise could be different in each of the slices. In such cases a null
(!) can be supplied for the RMS parameter, which forces a separate default RMS value to
be found and used for each slice. Any pixel-to-pixel correlation in the noise can result in
these defaults being too low. If a null (!) value is used for WLIM, the pattern of bad pixels is propagated from the input NDF to the output NDF unchanged. In this case, filtered output values are only calculated for those pixels which are not bad in the input NDF.
If a numerical value is given for WLIM, then it specifies the minimum fraction of good pixels which must be present in the filter box in order to generate a good output pixel. If this specified minimum fraction of good input pixels is not present, then a bad output pixel will result, otherwise a filtered output value will be calculated. The value of this parameter should lie between 0.0 and 1.0 (the actual number used will be rounded up if necessary to correspond to at least 1 pixel). [0.3]
Smoothing cubes in 3 dimensions can be very slow.