hipscat.pixel_math.validators#

Module Contents#

Classes#

ValidatorsErrors

Error messages for the coordinate validators

Functions#

validate_radius(radius_arcsec)

Validates that a cone search radius is positive

validate_declination_values(dec)

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

validate_polygon(vertices)

Checks if the polygon contain a minimum of three vertices, that they are

is_polygon_degenerate(→ bool)

Checks if all the vertices of the polygon are contained in a same plane.

validate_box_search(ra, dec)

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

class ValidatorsErrors[source]#

Bases: str, enum.Enum

Error messages for the coordinate validators

INVALID_DEC = 'declination must be in the -90.0 to 90.0 degree range'[source]#
INVALID_RADIUS = 'cone radius must be positive'[source]#
INVALID_NUM_VERTICES = 'polygon must contain a minimum of 3 vertices'[source]#
DUPLICATE_VERTICES = 'polygon has duplicated vertices'[source]#
DEGENERATE_POLYGON = 'polygon is degenerate'[source]#
INVALID_RADEC_RANGE = 'invalid ra or dec range'[source]#
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: numpy.ndarray)[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 (np.ndarray) – The polygon vertices, in cartesian coordinates

Raises:

ValueError – exception if the polygon is invalid.

is_polygon_degenerate(vertices: numpy.ndarray) bool[source]#

Checks if all the vertices of the polygon are contained in a same plane. If the plane intersects the center of the sphere, the polygon is degenerate.

Parameters:

vertices (np.ndarray) – The polygon vertices, in cartesian coordinates

Returns:

A boolean, which is True if the polygon is degenerate, i.e. if it falls on a great circle, False otherwise.

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

  • At least one range of ra or dec must have been provided

  • Ranges must be pairs of non-duplicate minimum and maximum values, in degrees

  • Declination values, if existing, must be in ascending order

  • Declination values, if existing, must be in the [-90,90] degree range

Parameters:
  • ra (Tuple[float, float]) – Right ascension range, in degrees

  • dec (Tuple[float, float]) – Declination range, in degrees