find_outliers¶
- sofia_redux.toolkit.stats.stats.find_outliers(data, threshold=5, keepnans=False, axis=None)[source]¶
Determines the outliers in a distribution of data
Computes the median and the median absolute deviation (MAD) 1.482 * median(abs(x_i-x_med)) of the data and identifies data values as outliers if abs(x_i - x_med) / MAD > threshold where x_med is the median.
Taken from mc_findoutliers in spextool
- Parameters:
- dataarray_like of (int or float)
- thresholdint or float, optional
The sigma threshold
- keepnansbool, optional
If True, do not flag NaNs as outliers
- axisint, optional
If axis is set, outliers are determined for each slice along the set axis. i.e. if axis=0 for a 2-d array, then outliers will be determined by using statistics derived along each row rather than over the entirety of the data set. This could be is useful when each “row” contains a unique dataset such as a spectrum.
- Returns:
- numpy.ndarray
boolean array of the same shape as
data
. False indicates an outlier