hats.pixel_math.spatial_index#

Attributes#

Functions#

compute_spatial_index(→ numpy.ndarray)

Compute the healpix index field.

spatial_index_to_healpix(→ numpy.ndarray)

Convert _healpix_29 values to the healpix pixel at the specified order

healpix_to_spatial_index(→ numpy.int64 | numpy.ndarray)

Convert a healpix pixel to the healpix index

Module Contents#

SPATIAL_INDEX_COLUMN = '_healpix_29'[source]#
SPATIAL_INDEX_ORDER = 29[source]#
compute_spatial_index(ra_values: float | list[float], dec_values: float | list[float]) numpy.ndarray[source]#

Compute the healpix index field.

Parameters:
  • ra_values (float|list[float]) – celestial coordinates, right ascension in degrees

  • dec_values (float|list[float]) – celestial coordinates, declination in degrees

Returns:

one-dimensional numpy array of int64s with healpix NESTED pixel numbers at order 29

Raises:

ValueError – if the length of the input lists don’t match.

spatial_index_to_healpix(ids: list[int], target_order: int = SPATIAL_INDEX_ORDER) numpy.ndarray[source]#

Convert _healpix_29 values to the healpix pixel at the specified order

Parameters:
  • ids (List[int64]) – list of well-formatted _healpix_29 values

  • target_order (int64) – Defaults to SPATIAL_INDEX_ORDER. The order of the pixel to get from the healpix index.

Returns:

numpy array of target_order pixels from the healpix index

healpix_to_spatial_index(order: int | list[int], pixel: int | list[int]) numpy.int64 | numpy.ndarray[source]#

Convert a healpix pixel to the healpix index

This maps the healpix pixel to the lowest pixel number within that pixel at order 29.

Useful for operations such as filtering by _healpix_29.

Parameters:
  • order (int64 | List[int64]) – order of pixel to convert

  • pixel (int64 | List[int64]) – pixel number in nested ordering of pixel to convert

Returns:

healpix index or numpy array of healpix indices