# Path: photutils/background/_utils.py
# def nanmean(array, axis=None):
#     """
#     A nanmean function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanmean(array, axis=axis))
#         else:
#             return bn.nanmean(array, axis=axis)
#     else:
#         return np.nanmean(array, axis=axis)
# 
# def nanmedian(array, axis=None):
#     """
#     A nanmedian function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanmedian(array, axis=axis))
#         else:
#             return bn.nanmedian(array, axis=axis)
#     else:
#         return np.nanmedian(array, axis=axis)
# 
# def nanstd(array, axis=None, ddof=0):
#     """
#     A nanstd function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanstd(array, axis=axis, ddof=ddof))
#         else:
#             return bn.nanstd(array, axis=axis, ddof=ddof)
#     else:
#         return np.nanstd(array, axis=axis, ddof=ddof)


import abc
import warnings
import numpy as np
from astropy.stats import (biweight_location, biweight_scale, mad_std,
                           SigmaClip)
from ._utils import nanmean, nanmedian, nanstd
        \sigma \approx \frac{{\textrm{{MAD}}}}{{\Phi^{{-1}}(3/4)}}
            \approx 1.4826 \ \textrm{{MAD}}

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

    Parameters
    ----------
    sigma_clip : `astropy.stats.SigmaClip` object, optional
        A `~astropy.stats.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)  # doctest: +FLOAT_CMP
    37.06505546264005

    Alternatively, the background RMS value can be calculated by calling

# Path: photutils/background/_utils.py
# def nanmean(array, axis=None):
#     """
#     A nanmean function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanmean(array, axis=axis))
#         else:
#             return bn.nanmean(array, axis=axis)
#     else:
#         return np.nanmean(array, axis=axis)
# 
# def nanmedian(array, axis=None):
#     """
#     A nanmedian function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanmedian(array, axis=axis))
#         else:
#             return bn.nanmedian(array, axis=axis)
#     else:
#         return np.nanmedian(array, axis=axis)
# 
# def nanstd(array, axis=None, ddof=0):
#     """
#     A nanstd function that uses bottleneck if available.
#     """
#     if HAS_BOTTLENECK:
#         if isinstance(axis, tuple):
#             array = move_tuple_axes_first(array, axis=axis)
#             axis = 0
# 
#         if isinstance(array, u.Quantity):
#             return array.__array_wrap__(bn.nanstd(array, axis=axis, ddof=ddof))
#         else:
#             return bn.nanstd(array, axis=axis, ddof=ddof)
#     else:
#         return np.nanstd(array, axis=axis, ddof=ddof)


# Path: photutils/background/core.py
import abc
import warnings
import numpy as np
from astropy.stats import (biweight_location, biweight_scale, mad_std,
                           SigmaClip)
from ._utils import nanmean, nanmedian, nanstd

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

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

    Parameters
    ----------
    sigma_clip : `astropy.stats.SigmaClip` object, optional
        A `~astropy.stats.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)  # doctest: +FLOAT_CMP
    37.06505546264005

    Alternatively, the background RMS value can be calculated by calling

    the class instance as a function, e.g.: