### FINDBACK

Estimate the background in an NDF by removing small scale structure

#### Description:

This application uses spatial filtering to remove structure with a scale size less than a specified size from a 1, 2, or 3 dimensional NDF, thus producing an estimate of the local background within the NDF.

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.

#### Usage:

findback in out box

#### Parameters:

The dimensions of each of the filters, in pixels. Each value should be odd (if an even value is supplied, the next higher odd value will be used). The number of values supplied should not exceed the number of significant (i.e. more than one element) pixel axes in the input array. If any trailing values of 1 are supplied, then each pixel value on the corresponding axes will be fitted independently of its neighbours. For instance, if the data array is 3-dimensional, and the third BOX value is 1, then each x-y plane will be fitted independently of the neighbouring planes. If the NDF has more than 1 pixel axis but only 1 value is supplied, then the same value will be used for the both the first and second pixel axes (a value of 1 will be assumed for the third axis if the input array is 3-dimensional).
Controls the amount of diagnostic information reported. This is the standard messaging level. The default messaging level is NORM (2). A value of NONE or 0 will suppress all screen output. VERB (3) will indicate progress through the various stages of the algorithm. [NORM]
The input NDF.
Specifies a value to use as the global RMS noise level in the supplied data array. The suggested default value is the square root of the mean of the values in the input 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.