CostDistribution.calculate_weighted_averages#

static CostDistribution.calculate_weighted_averages(matrix, cost_matrix, bin_edges)[source]#

Calculate weighted averages of bins in a cost distribution.

Parameters:
  • matrix (np.ndarray) – The matrix to calculate the cost distribution for. This matrix should be the same shape as cost_matrix

  • cost_matrix (np.ndarray) – A matrix of cost relating to matrix. cost_matrix should be the same shape as matrix

  • bin_edges (list[float] | np.ndarray) – Defines a monotonically increasing array of bin edges, including the rightmost edge, allowing for non-uniform bin widths. This argument is passed straight into numpy.histogram

Returns:

An array to be passed into a dataframe as a column.

Return type:

np.ndarray