edges_analysis.averaging.averaging.weighted_sorted_metric

edges_analysis.averaging.averaging.weighted_sorted_metric(data, weights=None, metric='median', **kwargs)[source]

Semi-weighted integrator of data.

This function will perform integrations of data that rely on sorting the data (eg. median or percentile). These are ony able to partial weighting – i.e. weights of zero ensure that datum is ignored, while other weights all count the same.

Parameters:
  • data (array-like) – The data over which the weighted mean is to be taken.

  • weights (array-like, optional) – Same shape as data, giving the weights of each datum.

  • metric (str, optional) – One of (‘median’, ‘argmax’, ‘argmin’,’max’, ‘min’, ‘percentile’, ‘quantile’), specifying which metric to take.

  • kwargs – Extra arguments to the function np.nan<metric>.

Returns:

array-like – The weighted mean over axis, where elements with zero total weight are set to nan.