cdshealpix.ring.healpix_to_lonlat

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

Get the longitudes and latitudes of the center of some HEALPix cells at a given depth.

This method does the opposite transformation of lonlat_to_healpix. 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:
lon, lat(astropy.coordinates.Longitude, astropy.coordinates.Latitude)

The sky coordinates of the center of the HEALPix cells given as a longitude, latitude tuple.

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_lonlat
>>> import numpy as np
>>> ipix = np.array([42, 6, 10], dtype=np.uint64)
>>> depth = np.array([2, 12])
>>> nside = 2 ** depth
>>> lon, lat = healpix_to_lonlat(ipix[:, np.newaxis], nside[np.newaxis, :])