astro py:docs

- Index
- Modules

### Navigation

- next »
- « previous |
- Astropy v1.1.1 »
- Astrostatistics Tools (`astropy.stats`) »
- mad_std

# mad_std

`astropy.stats.``mad_std`(data)

  Calculate a robust standard deviation 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:

  data : array-like

  > Data array or object that can be converted to an array.

  Returns:

  result : float

  > The robust standard deviation of the data.

  Examples

      >>> from astropy.stats import mad_std
      >>> from astropy.utils import NumpyRNGContext
      >>> from numpy.random import normal
      >>> with NumpyRNGContext(12345):
      ...     data = normal(5, 2, size=(100, 100))
      ...     mad_std(data)
      2.02327646594