hats.pixel_math.validators#
Classes#
Error messages for the coordinate validators |
Functions#
|
Validates that a cone search radius is positive |
Validates that declination values are in the [-90,90] degree range |
|
|
Checks if the polygon contain a minimum of three vertices, that they are |
|
Check if the polygon has no degenerate corners and it is convex. |
|
Checks if ra and dec values are valid for the box search. |
Module Contents#
- validate_radius(radius_arcsec: float)[source]#
Validates that a cone search radius is positive
- Parameters:
radius_arcsec (float) – The cone radius, in arcseconds
- Raises:
ValueError – if radius is non-positive
- validate_declination_values(dec: float | list[float])[source]#
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
- validate_polygon(vertices: list[tuple[float, float]])[source]#
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.
- check_polygon_is_valid(vertices: numpy.ndarray)[source]#
Check if the polygon has no degenerate corners and it is convex.
- Parameters:
vertices (np.ndarray) – The polygon vertices, in cartesian coordinates
- validate_box(ra: tuple[float, float], dec: tuple[float, float])[source]#
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