healpix_geo.zuniq.vertices#

healpix_geo.zuniq.vertices(ipix, ellipsoid, step=1, num_threads=0)#

Get the longitudes and latitudes of the vertices of some HEALPix cells in zuniq encoding.

This method returns the 4 vertices of each cell in ipix.

Parameters:
  • ipix (numpy.ndarray) – The HEALPix cell indexes given as a np.uint64 numpy array.

  • ellipsoid (ellipsoid-like, default: "sphere") – Reference ellipsoid to evaluate healpix on. If the reference ellipsoid is spherical, this will return the same result as cdshealpix.nested.vertices().

  • step (int, default: 1) – The number of vertices returned per HEALPix side. By default it is set to 1 meaning that it will only return the vertices of the cell. 2 means that it will return the vertices of the cell plus one more vertex per edge (the center of the edge). More generally, the number of vertices returned is 4 * step.

  • num_threads (int, optional) – Specifies the number of threads to use for the computation. Default to 0 means it will choose the number of threads based on the RAYON_NUM_THREADS environment variable (if set), or the number of logical CPUs (otherwise)

Returns:

longitude, latitude (numpy.ndarray) – The sky coordinates of the 4 vertices of the HEALPix cells. lon and lat are of shape \(N\) x \(4\) numpy arrays where N is the number of HEALPix cell given in ipix.

Raises:

ValueError – When the HEALPix cell indexes given have values out of \([0, 4^{29 - depth}[\).

Examples

>>> from healpix_geo.zuniq import vertices
>>> import numpy as np
>>> ipix = np.array([42, 6, 10])
>>> depth = 12
>>> lon, lat = vertices(ipix, ellipsoid="sphere")
>>> np.stack([lon, lat], axis=-1)
array([[[4.49999997e+01, 2.13443412e-07],
        [4.49999998e+01, 2.84591215e-07],
        [4.49999997e+01, 3.55739019e-07],
        [4.49999997e+01, 2.84591215e-07]],

       [[4.50000001e+01, 7.11478039e-08],
        [4.50000002e+01, 1.42295608e-07],
        [4.50000001e+01, 2.13443412e-07],
        [4.50000000e+01, 1.42295608e-07]],

       [[4.49999999e+01, 7.11478039e-08],
        [4.50000000e+01, 1.42295608e-07],
        [4.49999999e+01, 2.13443412e-07],
        [4.49999998e+01, 1.42295608e-07]]])