# MMMBackground¶

class photutils.MMMBackground[source]

Class to calculate the background in an array using the DAOPHOT MMM algorithm.

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

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 MMMBackground
>>> data = np.arange(100)
>>> sigma_clip = SigmaClip(sigma=3.)
>>> bkg = MMMBackground(sigma_clip=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