hats.pixel_math.validators
==========================

.. py:module:: hats.pixel_math.validators


Classes
-------

.. autoapisummary::

   hats.pixel_math.validators.ValidatorsErrors


Functions
---------

.. autoapisummary::

   hats.pixel_math.validators.validate_radius
   hats.pixel_math.validators.validate_declination_values
   hats.pixel_math.validators.validate_polygon
   hats.pixel_math.validators.check_polygon_is_valid
   hats.pixel_math.validators.validate_box


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

.. py:class:: ValidatorsErrors

   Bases: :py:obj:`str`, :py:obj:`enum.Enum`


   
   Error messages for the coordinate validators
















   ..
       !! processed by numpydoc !!

   .. py:attribute:: INVALID_DEC
      :value: 'declination must be in the -90.0 to 90.0 degree range'



   .. py:attribute:: INVALID_RADIUS
      :value: 'cone radius must be positive'



   .. py:attribute:: INVALID_NUM_VERTICES
      :value: 'polygon must contain a minimum of 3 vertices'



   .. py:attribute:: DUPLICATE_VERTICES
      :value: 'polygon has duplicated vertices'



   .. py:attribute:: DEGENERATE_POLYGON
      :value: 'polygon is degenerate'



   .. py:attribute:: INVALID_RADEC_RANGE
      :value: 'invalid ra or dec range'



   .. py:attribute:: INVALID_COORDS_SHAPE
      :value: 'invalid coordinates shape'



   .. py:attribute:: INVALID_CONCAVE_SHAPE
      :value: 'polygon must be convex'



.. py:function:: validate_radius(radius_arcsec: float)

   
   Validates that a cone search radius is positive


   :Parameters:

       **radius_arcsec** : float
           The cone radius, in arcseconds







   :Raises:

       ValueError
           if radius is non-positive







   ..
       !! processed by numpydoc !!

.. py:function:: validate_declination_values(dec: float | list[float])

   
   Validates that declination values are in the [-90,90] degree range


   :Parameters:

       **dec** : float | list[float]
           The declination values to be validated







   :Raises:

       ValueError
           if declination values are not in the [-90,90] degree range







   ..
       !! processed by numpydoc !!

.. py:function:: validate_polygon(vertices: list[tuple[float, float]])

   
   Checks if the polygon contain a minimum of three vertices, that they are
   unique and that the polygon does not fall on a great circle.


   :Parameters:

       **vertices** : list[tuple[float, float]]
           The list of vertice coordinates for the polygon, (ra, dec), in degrees.







   :Raises:

       ValueError
           exception if the polygon is invalid.







   ..
       !! processed by numpydoc !!

.. py:function:: check_polygon_is_valid(vertices: numpy.ndarray)

   
   Check if the polygon has no degenerate corners and it is convex.


   :Parameters:

       **vertices** : np.ndarray
           The polygon vertices, in cartesian coordinates







   :Raises:

       ValueError
           exception if the polygon is invalid.







   ..
       !! processed by numpydoc !!

.. py:function:: validate_box(ra: tuple[float, float], dec: tuple[float, float])

   
   Checks if ra and dec values are valid for the box search.

   - Both ranges for ra or dec must have been provided.
   - Ranges must be defined by a pair of values, in degrees.
   - Declination values must be unique, provided in ascending order, and belong to
     the [-90,90] degree range.

   :Parameters:

       **ra** : tuple[float, float]
           Right ascension range, in degrees

       **dec** : tuple[float, float]
           Declination range, in degrees







   :Raises:

       ValueError
           exception if the box is invalid.







   ..
       !! processed by numpydoc !!

