edges_analysis.averaging.averaging.weighted_sum

edges_analysis.averaging.averaging.weighted_sum(data, weights=None, normalize=False, axis=0)[source]

A careful weighted sum.

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.

  • normalize (bool, optional) – If True, normalize weights so that the maximum weight is unity.

  • axis (int, optional) – The axis over which to take the mean.

Returns:

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