This documentation is for astroML version 0.2

This page


astroML Mailing List

GitHub Issue Tracker


Scipy 2012 (15 minute talk)

Scipy 2013 (20 minute talk)


If you use the software, please consider citing astroML.

11.6.6. astroML.stats.mean_sigma

astroML.stats.mean_sigma(a, axis=None, dtype=None, ddof=0, keepdims=False)

Compute mean and standard deviation for an array

Parameters :

a : array_like

Array containing numbers whose mean is desired. If a is not an array, a conversion is attempted.

axis : int, optional

Axis along which the means are computed. The default is to compute the mean of the flattened array.

dtype : dtype, optional

Type to use in computing the standard deviation. For arrays of integer type the default is float64, for arrays of float types it is the same as the array type.

keepdims : bool, optional

If this is set to True, the axes which are reduced are left in the result as dimensions with size one. With this option, the result will broadcast correctly against the original arr.

Returns :

mu : ndarray, see dtype parameter above

array containing the mean values

sigma : ndarray, see dtype parameter above.

array containing the standard deviation

See also

robust rank-based version of this calculation.


This routine simply calls np.mean and np.std, passing the keyword arguments to them. It is provided for ease of comparison with the function median_sigmaG()