utils.define_density_level_grid(density, num_levels=None)

Create an evenly spaced grid of density levels. The levels are uniformly spaced between 0 and the maximum value of the input ‘density’.


density : numpy array[float] or list[float]

Values of a density estimate. The coordinates of the observation are not needed for this function.

num_levels : int, optional

Number of density levels in the grid. This is essentially the vertical resolution of a level set tree built from the ‘density’ input.


levels : numpy array

Grid of density levels that will define the iterations in level set tree construction.


  • The level set tree is constructed by filtering a similarity graph according to this grid. This function simply defines the density levels, but it does not do the actual tree construction.