# SExtractorBackground¶

class photutils.background.SExtractorBackground[source]

Class to calculate the background in an array using the SExtractor algorithm.

The background is calculated using a mode estimator of the form (2.5 * median) - (1.5 * mean).

If (mean - median) / std > 0.3 then the median is used instead. Despite what the SExtractor User’s Manual says, this is the method it always uses.

Parameters: sigma_clip : astropy.stats.SigmaClip object, optional A SigmaClip object that defines the sigma clipping parameters. If None then no sigma clipping will be performed. The default is to perform sigma clipping with sigma=3. and iters=5.

Examples

>>> from astropy.stats import SigmaClip
>>> from photutils import SExtractorBackground
>>> data = np.arange(100)
>>> sigma_clip = SigmaClip(sigma=3.)
>>> bkg = SExtractorBackground(sigma_clip)


The background value can be calculated by using the calc_background method, e.g.:

>>> bkg_value = bkg.calc_background(data)
>>> print(bkg_value)
49.5


Alternatively, the background value can be calculated by calling the class instance as a function, e.g.:

>>> bkg_value = bkg(data)
>>> print(bkg_value)
49.5


Methods Summary

 calc_background(data[, axis]) Calculate the background value.

Methods Documentation

calc_background(data, axis=None)[source]

Calculate the background value.

Parameters: data : array_like or MaskedArray The array for which to calculate the background value. axis : int or None, optional The array axis along which the background is calculated. If None, then the entire array is used. result : float or MaskedArray The calculated background value. If axis is None then a scalar will be returned, otherwise a MaskedArray will be returned.