healpix_geo.nested.vertices#
- healpix_geo.nested.vertices(ipix, depth, ellipsoid, step=1, num_threads=0)#
Get the longitudes and latitudes of the vertices of some HEALPix cells at a given depth.
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.
depth (
int, or numpy.ndarray) – The depth of the HEALPix cells. If given as an array, should have the same shape than ipixellipsoid (ellipsoid-like, default:
"sphere") – Reference ellipsoid to evaluate healpix on. If the reference ellipsoid is spherical, this will return the same result ascdshealpix.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 is4 * 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.nested import vertices >>> import numpy as np >>> ipix = np.array([42, 6, 10]) >>> depth = 12 >>> lon, lat = vertices(ipix, depth, ellipsoid="sphere") >>> np.stack([lon, lat], axis=-1) array([[[4.49230957e+01, 6.52784088e-02], [4.49340820e+01, 7.46039007e-02], [4.49230957e+01, 8.39293945e-02], [4.49121094e+01, 7.46039007e-02]], [[4.50109863e+01, 2.79764560e-02], [4.50219727e+01, 3.73019424e-02], [4.50109863e+01, 4.66274299e-02], [4.50000000e+01, 3.73019424e-02]], [[4.49670410e+01, 2.79764560e-02], [4.49780273e+01, 3.73019424e-02], [4.49670410e+01, 4.66274299e-02], [4.49560547e+01, 3.73019424e-02]]])