robust_mean

sofia_redux.scan.utilities.utils.robust_mean(array, tails=None)[source]

Performs a mean calculation with optional tails.

NaNs are automatically excluded from the mean calculation. The tails parameter should be between 0 and 0.5, and will exclude tails * array.size from both the beginning and end of the sorted array values.

Parameters:
arraynumpy.ndarray or Quantity
tailsfloat, optional

The fraction of tails to discount from the mean calculation. The default (None), does not exclude any tails and considers the entire population.

Returns:
meanfloat or Quantity

The mean of the array.