moments

sofia_redux.toolkit.stats.stats.moments(data, threshold=None, mask=None, axis=None, get_mask=False)[source]

Computes statistics on a data set avoiding deviant points if requested

Moments are calculated for a given set of data. If a value is passed to threshold, then the dataset is searched for outliers. A data point is identified as an outlier if abs(x_i - x_med)/MAD > threshold, where x_med is the median, MAD is the median absolute deviation defined as 1.482 * median(abs(x_i - x_med)).

Parameters:
dataarray_like of float

(shape1) Data on which to calculate moments

maskarray_like of bool

(shape1) Mask to apply to data

thresholdfloat, optional

Sigma threshold over which values are identified as outliers

axisint, optional

Axis over which to calculate statistics

get_maskbool, optional

If True, only return the output mask

Returns:
dict or numpy.ndarray

If get_mask is False, returns a dictionary containing the following statistics: mean, var, stddev, skew, kurt, stderr, mask. Otherwise, returns the output mask.