healpix_geo.ring.vertices#
- healpix_geo.ring.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 (
str, default:"sphere") – Reference ellipsoid to evaluate healpix on. If"sphere", this will return the same result ascdshealpix.ring.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.ring 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([[[ 45. , 89.93147196], [ 54. , 89.9428933 ], [ 45. , 89.95431464], [ 36. , 89.9428933 ]], [[120. , 89.96573598], [135. , 89.97715732], [ 90. , 89.98857866], [ 90. , 89.97715732]], [[300. , 89.96573598], [315. , 89.97715732], [270. , 89.98857866], [270. , 89.97715732]]])