pynbody.util.equipartition

Contents

pynbody.util.equipartition#

pynbody.util.equipartition(ar, nbins, vmin=None, vmax=None)[source]#

Return nbins+1 monotonically increasing bin edges such that the number of items from ar in each bin is ~equal

Parameters:
  • ar (array-like) – The array to bin

  • nbins (int) – The number of bins to create

  • vmin (float, optional) – The minimum value to consider

  • vmax (float, optional) – The maximum value to consider

Returns:

The bin edges

Return type:

array-like