weights_by_edges¶
-
hep_spt.
weights_by_edges
(values, edges, weights)[source]¶ Assign a weight to the values in an input array using a set of edges. It will return a new array of length equal to that of “values” assigning a weight from “weights” depending on the bin they belong to. Values can coincide with the left(right)-most edge so “edges[0] <= x <= edges[-1]”.
- Parameters
values (numpy.ndarray) – values to process.
edges (numpy.ndarray) – edges of the bins to consider.
weights – weights associated to each bin defined by “edges”.
- Returns
weights associated to the input values.
- Return type
- Raises
TypeError – if the dimensions of the array do not match.
ValueError – if values are found outside the edges.