liger_iris_pipeline.utils.math

Functions

all_sc(arr)

Optimized version of np.all which short circuits, unlike numpy.all.

any_sc(arr)

Optimized version of np.any which short circuits, unlike numpy.any.

biweight_location(data[, c, M])

biweight_midvariance(data[, c, M])

mad(x)

Calculate the median absolute deviation of an array.

median_absolute_deviation(data[, M])

robust_mean(x[, w, n_sigma])

Calculate robust mean using outlier rejection.

robust_stddev(x[, w, n_sigma])

Calculate robust standard deviation using outlier rejection.

weighted_mean(x, w)

Computes the weighted mean of a dataset.

weighted_quantile(values, weights[, q])

weighted_stddev(x, w[, M])

Calculate the weighted standard deviation of an array.

liger_iris_pipeline.utils.math.all_sc(arr: ndarray) bool[source]

Optimized version of np.all which short circuits, unlike numpy.all.

liger_iris_pipeline.utils.math.any_sc(arr: ndarray) bool[source]

Optimized version of np.any which short circuits, unlike numpy.any.

liger_iris_pipeline.utils.math.biweight_location(data: ndarray, c: float | None = 6.0, M: float | None = None) float[source]
liger_iris_pipeline.utils.math.biweight_midvariance(data: ndarray, c: float = 9.0, M: float | None = None) float[source]
liger_iris_pipeline.utils.math.mad(x: ndarray)[source]

Calculate the median absolute deviation of an array.

Parameters:
  • x – Array of values.

  • w – Array of weights.

Returns: - Weighted standard deviation or NaN if no valid data

liger_iris_pipeline.utils.math.median_absolute_deviation(data: ndarray, M: float | None = None)[source]
liger_iris_pipeline.utils.math.robust_mean(x, w=None, n_sigma=4)[source]

Calculate robust mean using outlier rejection.

Parameters: - x: Array of values - w: Array of weights (default: uniform weights) - n_sigma: Number of sigma for outlier rejection

Returns: - Robust mean or NaN if insufficient valid data

liger_iris_pipeline.utils.math.robust_stddev(x, w=None, n_sigma=4)[source]

Calculate robust standard deviation using outlier rejection.

Parameters: - x: Array of values - w: Array of weights (default: uniform weights) - n_sigma: Number of sigma for outlier rejection

Returns: - Robust standard deviation or NaN if insufficient valid data

liger_iris_pipeline.utils.math.weighted_mean(x, w)[source]

Computes the weighted mean of a dataset.

Parameters:
  • x (np.ndarray) – The input array.

  • w (np.ndarray) – The input weights, same shape as x.

  • axis (int) – Axis or tuple of axes along which to compute the mean. Default is None.

Returns:

float – The weighted mean.

liger_iris_pipeline.utils.math.weighted_quantile(values: ndarray, weights: ndarray, q: float = 0.5)[source]
liger_iris_pipeline.utils.math.weighted_stddev(x: ndarray, w: ndarray, M: float | None = None)[source]

Calculate the weighted standard deviation of an array.

Parameters:
  • x – Array of values.

  • w – Array of weights.

Returns: - Weighted standard deviation or NaN if no valid data