MADStdBackgroundRMS

class photutils.background.MADStdBackgroundRMS(sigma_clip=SigmaClip(sigma=3.0, sigma_lower=3.0, sigma_upper=3.0, maxiters=10, cenfunc='median', stdfunc='std', grow=False))[source]

Bases: BackgroundRMSBase

Class to calculate the background RMS in an array as using the median absolute deviation (MAD).

The standard deviation estimator is given by:

\[\sigma \approx \frac{{\textrm{{MAD}}}}{{\Phi^{{-1}}(3/4)}} \approx 1.4826 \ \textrm{{MAD}}\]

where \(\Phi^{{-1}}(P)\) is the normal inverse cumulative distribution function evaluated at probability \(P = 3/4\).

Parameters:
sigma_clipastropy.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.0 and maxiters=5.

Examples

>>> from astropy.stats import SigmaClip
>>> from photutils.background import MADStdBackgroundRMS
>>> data = np.arange(100)
>>> sigma_clip = SigmaClip(sigma=3.0)
>>> bkgrms = MADStdBackgroundRMS(sigma_clip)

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

>>> bkgrms_value = bkgrms.calc_background_rms(data)
>>> print(bkgrms_value)  
37.06505546264005

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

>>> bkgrms_value = bkgrms(data)
>>> print(bkgrms_value)  
37.06505546264005

Methods Summary

__call__(data[, axis, masked])

Call self as a function.

calc_background_rms(data[, axis, masked])

Calculate the background RMS value.

Methods Documentation

__call__(data, axis=None, masked=False)

Call self as a function.

calc_background_rms(data, axis=None, masked=False)[source]

Calculate the background RMS value.

Parameters:
dataarray_like or MaskedArray

The array for which to calculate the background RMS value.

axisint or None, optional

The array axis along which the background RMS is calculated. If None, then the entire array is used.

maskedbool, optional

If True, then a MaskedArray is returned. If False, then a ndarray is returned, where masked values have a value of NaN. The default is False.

Returns:
resultfloat, ndarray, or MaskedArray

The calculated background RMS value. If masked is False, then a ndarray is returned, otherwise a MaskedArray is returned. A scalar result is always returned as a float.