cdshealpix.ring.healpix_to_skycoord

cdshealpix.ring.healpix_to_skycoord(ipix, nside, dx=0.5, dy=0.5, num_threads=0)

Get the sky coordinates of the center of some HEALPix cells at a given nside.

This method does the opposite transformation of lonlat_to_healpix. It is the equivalent of healpix_to_lonlat except that it returns astropy.coordinates.SkyCoord instead of astropy.units.Quantity. It’s wrapped around the center method from the cdshealpix Rust crate.

Parameters:
ipixnumpy.ndarray

The HEALPix cell indexes given as a np.uint64 numpy array.

nsidenumpy.ndarray

The nside of the HEALPix cells.

dxfloat, optional

The offset position \(\in [0, 1[\) along the X axis. By default, dx=0.5

dyfloat, optional

The offset position \(\in [0, 1[\) along the Y axis. By default, dy=0.5

num_threadsint, 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:
skycoordastropy.coordinates.SkyCoord

The sky coordinates of the center of the HEALPix cells given as a SkyCoord object.

Raises:
ValueError

When the HEALPix cell indexes given have values out of \([0, 12\) x \(N_{side} ^ 2[\).

Examples

>>> from cdshealpix.ring import healpix_to_skycoord
>>> import numpy as np
>>> ipix = np.array([42, 6, 10])
>>> depth = 12
>>> nside = 2 ** depth
>>> skycoord = healpix_to_skycoord(ipix, nside)