robust_mask¶
- sofia_redux.toolkit.stats.stats.robust_mask(data, threshold, mask=None, axis=None, mask_data=False, cval=nan)[source]¶
Computes a mask derived from data Median Absolute Deviation (MAD).
Calculates a robust mask based on the input data and optional input mask. If \(threshold > 0\), the dataset is searched for outliers. Outliers are identified for point \(i\) if
\[\frac{|y_i - median[y]|}{MAD} > threshold\]where \(MAD\) is the Median Absolute Deviation defined as
\[MAD = 1.482 * median[|y_i - median[y]|]\]- Parameters:
- dataarray_like of float
The data on which to derive a robust mask.
- thresholdfloat
Threshold as described above.
- maskarray_like of bool, optional
If supplied, must be the same shape as
data
. Any masked (False
)data
values will not be included in the \(MAD\) calculation. Additionally, masked elements will also be masked (False
) in the output mask.- axisint, optional
Axis over which to calculate the \(MAD\). The default (
None
) derives the \(MAD\) from the entire set ofdata
.- mask_databool, optional
If
True
, return a copy ofdata
with masked values replaced bycval
in addition to the output mask. The default isFalse
. Note that the output type will- cvalint or float, optional
if
mask_data
is set toTrue
, masked values will be replaced bycval
. The default isnumpy.nan
.
- Returns: