hats.pixel_tree.pixel_tree
==========================

.. py:module:: hats.pixel_tree.pixel_tree


Classes
-------

.. autoapisummary::

   hats.pixel_tree.pixel_tree.PixelTree


Module Contents
---------------

.. py:class:: PixelTree(tree: numpy.ndarray, order: int)

   
   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.


   :Attributes:

       **pixels** : np.ndarray
           An array of [order, pixel] in NESTED numbering scheme for each interval in the array.













   ..
       !! processed by numpydoc !!

   .. py:attribute:: tree_order


   .. py:attribute:: tree


   .. py:attribute:: pixels


   .. py:method:: __len__()

      
      Gets the number of nodes in the tree





      :Returns:

          int
              The number of nodes in the tree











      ..
          !! processed by numpydoc !!


   .. py:method:: contains(pixel: hats.pixel_math.HealpixPixel | tuple[int, int]) -> bool

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


      :Parameters:

          **pixel** : HealpixPixel | tuple[int, int]
              HEALPix pixel to check. Either of type `HealpixPixel` or a tuple of (order, pixel)



      :Returns:

          bool
              True if the tree contains the pixel, False if not











      ..
          !! processed by numpydoc !!


   .. py:method:: __contains__(item)


   .. py:method:: get_max_depth() -> int

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





      :Returns:

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











      ..
          !! processed by numpydoc !!


   .. py:method:: get_healpix_pixels() -> list[hats.pixel_math.HealpixPixel]

      
      Creates a list of HealpixPixels in the tree





      :Returns:

          list[HealpixPixel]
              A list of the HEALPix pixels in the tree











      ..
          !! processed by numpydoc !!


   .. py:method:: to_moc() -> mocpy.MOC

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
















      ..
          !! processed by numpydoc !!


   .. py:method:: to_depth29_ranges() -> numpy.ndarray

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
















      ..
          !! processed by numpydoc !!


   .. py:method:: from_healpix(healpix_pixels: collections.abc.Sequence[hats.pixel_math.HealpixPixel | tuple[int, int]], tree_order=None) -> PixelTree
      :classmethod:


      
      Build a tree from a list of constituent healpix pixels


      :Parameters:

          **healpix_pixels** : Sequence[HealpixPixel | tuple[int, int]]
              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:

          PixelTree
              The pixel tree with the leaf pixels specified in the list











      ..
          !! processed by numpydoc !!


