csep.utils.calc.bin1d_vec

csep.utils.calc.bin1d_vec(p, bins, tol=None, right_continuous=False)[source]

Efficient implementation of binning routine on 1D Cartesian Grid.

Returns the indices of the points into bins. Bins are inclusive on the lower bound and exclusive on the upper bound. In the case where a point does not fall within the bins a -1 will be returned. The last bin extends to infinity when right_continuous is set as true.

Parameters:
  • p (array-like) – Point(s) to be placed into b

  • bins (array-like) – bins to considering for binning, must be monotonically increasing

  • right_continuous (bool) – if true, consider last bin extending to infinity

Returns:

indexes hashed into grid

Return type:

idx (array-like)

Raises:

ValueError