Modeling the background

On linear detectors, the value measured at each pixel is the sum of a "background" signal and light coming from the sources of interest. To be able to detect the faintest objects and make accurate measurements, SExtractor needs first computing a precise estimate of the background level at any position of the image: a background map. Strictly speaking, there should be one background map per source, that is, what would the image look like if that very source was missing. But, at least for detection, one can start by assuming that most discrete sources do not overlap too severely — which is generally the case for high galactic latitude fields —, and that the background varies smoothly across the field.

Background estimation

To compute the background map, SExtractor makes a first pass through the pixel data, estimating the local background in each mesh of a rectangular grid that covers the whole frame. The background estimator is a combination of \(\kappa\,\sigma\) clipping and mode estimation, similar to Stetson’s DAOPHOT program [7, 8].

Briefly, the local background histogram is clipped iteratively until convergence at \(\pm 3\sigma\) around its median. The mode of the histogram is estimated using the semi-empirical relation

(4)\[\mbox{Mode} - \mbox{Mean} \approx \alpha_{\rm{Pearson}} \times (\mbox{Median} - \mbox{Mean}),\]

and therefore

(5)\[\mbox{Mode} \approx \alpha_{\rm{Pearson}} \times \mbox{Median} - (\alpha_{\rm{Pearson}} - 1) \times \mbox{Mean},\]

with \(\alpha_{\rm{Pearson}} \approx 3\) [9, 10, 11].

Using simulated images, [12] found \(\alpha_{\rm{Pearson}} \approx 2.5\) more appropriate for determining the mode of the background histogram in SExtractor. However, extensive photometric assessments carried out in the context of the Dark Energy Survey later showed that this value leads to a slight overestimation of the local background [13], and a higher \(\alpha_{\rm{Pearson}} \approx 3.5\) was adopted in Dark Energy Survey. Since SExtractor v2.28, \(\alpha_{\rm{Pearson}}\) can be changed using the BACK_PEARSON configuration parameter. However, for the sake of compatibility with previous results, the default value of BACK_PEARSON remains 2.5.

Fig. 2 shows that the mode estimation in (5) is considerably less affected by source crowding than a simple clipped mean [14, 15] but it is \(\approx 30\%\) noisier. Obviously (5) is not valid for any distribution; SExtractor falls back to a simple median for estimating the local background value if the mode and the median disagree by more than 30%.


Fig. 2 Simulations of \(32\times32\) pixels background meshes contamined by random Gaussian profiles. The true background lies at 0 ADUs. While being a bit noisier, the clipped "mode" gives a more robust estimate than the clipped mean in crowded regions.

Background map

Once the grid is set up, a median filter can be applied to suppress possible local overestimations due to bright stars. The final background map is simply a (natural) bicubic-spline interpolation between the meshes of the grid. Median filtering helps reducing possible ringing effects of the bicubic-spline around bright features.

In parallel with the making of the background map, an RMS background map, that is, a map of the background noise standard deviation in the image is produced. It may be used as an internal weight map if the WEIGHT_TYPE configuration parameter is to BACKGROUND (see Weight-map formats).

Configuration and tuning


All background configuration parameters also affect background-RMS maps.

The choice of the mesh size BACK_SIZE is very important. If it is too small, the background estimation is affected by the presence of objects and random noise. Most importantly, part of the flux of the most extended objects can be absorbed into the background map. If the mesh size is too large, it cannot reproduce the small scale variations of the background. Therefore a good compromise must be found by the user. Typically, for reasonably sampled images, a width [1] of 32 to 512 pixels works well.

The user has some control over background map filtering by specifying the size of the median filter BACK_FILTERSIZE. A width and height of 1 means that no filtering is applied to the background grid. A \(3\times3\) filtering is sufficient in most cases. Larger dimensions may occasionally be used to compensate for small background mesh sizes, or in the presence of large image artifacts. In some specific cases it is desirable to median-filter only background meshes that have values exceeding some threshold above the filtered value. This differential threshold is set by the BACK_FILTERTHRESH parameter, in ADUs.

By default, the computed background maps are automatically subtracted from input images. However there are some situations where it is more appropriate to subtract a constant from the image (e.g., images with strongly non-Gaussian background noise pdfs). The BACK_TYPE configuration parameter (set to AUTO by default) may be switched to MANUAL to force the value specified by the BACK_VALUE parameter to be subtracted from the input image, instead of the background map. BACK_VALUE is 0 by default.

Computing cost

The background estimation operation is generally I/O-bound, unless the image file already resides in the disk cache.