hats.pixel_tree.pixel_tree#

Classes#

PixelTree

Sparse Quadtree of HEALPix pixels that make up the HATS catalog

Module Contents#

class PixelTree(tree: numpy.ndarray, order: int)[source]#

Sparse Quadtree of HEALPix pixels that make up the HATS catalog

This class stores each node in the tree, with leaf nodes corresponding to pixels with data files.

There are a number of methods in this class which allow for quickly navigating through the tree and performing operations to filter the pixels in the catalog.

pixels[source]#

Nested dictionary of pixel nodes stored in the tree. Indexed by HEALPix order then pixel number

tree_order[source]#
tree[source]#
pixels[source]#
__len__()[source]#

Gets the number of nodes in the tree

Returns:

The number of nodes in the tree

contains(pixel: hats.pixel_math.HealpixPixel | tuple[int, int]) bool[source]#

Check if tree contains a node at a given order and pixel

Parameters:

pixel – HEALPix pixel to check. Either of type HealpixPixel or a tuple of (order, pixel)

Returns:

True if the tree contains the pixel, False if not

__contains__(item)[source]#
get_max_depth() int[source]#

Get the max depth (or highest healpix order) represented in the list of pixels.

Returns:

max depth (or highest healpix order) of the pixels in the tree

get_healpix_pixels() list[hats.pixel_math.HealpixPixel][source]#

Creates a list of HealpixPixels in the tree

Returns (List[HealpixPixel]):

A list of the HEALPix pixels in the tree

to_moc() mocpy.MOC[source]#

Returns the MOC object that covers the same pixels as the tree

to_depth29_ranges() numpy.ndarray[source]#

Returns the ranges of the pixels in the tree at depth 29

classmethod from_healpix(healpix_pixels: collections.abc.Sequence[hats.pixel_math.HealpixPixel | tuple[int, int]], tree_order=None) PixelTree[source]#

Build a tree from a list of constituent healpix pixels

Parameters:
  • healpix_pixels – list of healpix pixels

  • tree_order (int) – (Default = None) order to generate the tree at. If None, will use the highest order from input pixels

Returns:

The pixel tree with the leaf pixels specified in the list