Healpix

ducc0.healpix

Python interface for some of the HEALPix C++ functionality

All angles are interpreted as radians. The theta coordinate is measured as co-latitude, ranging from 0 (North Pole) to pi (South Pole).

All 3-vectors returned by the functions are normalized. However, 3-vectors provided as input to the functions need not be normalized.

Floating point input arrays can be provided as numpy.float64 or numpy.float32, but the returned floating point arrays will always be of type numpy.float64.

Integer input arrays can be provided as numpy.int64 or numpy.int32, but the returned integer arrays will always be of type numpy.int64.

Error conditions are reported by raising exceptions.

class ducc0.healpix.Healpix_Base

Functionality related to the HEALPix pixelization

ang2pix(self: ducc0.healpix.Healpix_Base, ang: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns the index of the containing pixel for every (co-latitude, longitude) tuple in ang. ang must have a last dimension of size 2; the result array has the same shape as ang, except that ang’s last dimension is removed.

max_pixrad(self: ducc0.healpix.Healpix_Base) float

Returns the maximum angular distance (in radian) between a pixel center and its corners for this pixelisation.

neighbors(self: ducc0.healpix.Healpix_Base, pix: numpy.ndarray, nthreads: int = 1) numpy.ndarray
nest2ring(self: ducc0.healpix.Healpix_Base, nest: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns the pixel index in RING scheme for every entry of nest. The result array has the same shape as nest.

npix(self: ducc0.healpix.Healpix_Base) int

Returns the total number of pixels of the pixelisation.

nside(self: ducc0.healpix.Healpix_Base) int

Returns the Nside parameter of the pixelisation.

order(self: ducc0.healpix.Healpix_Base) int

Returns the ORDER parameter of the pixelisation. If Nside is a power of 2, this is log_2(Nside), otherwise it is -1.

pix2ang(self: ducc0.healpix.Healpix_Base, pix: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns a (co-latitude, longitude) tuple for each value in pix. The result array has the same shape as pix, with an added last dimension of size 2.

pix2vec(self: ducc0.healpix.Healpix_Base, pix: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns a normalized 3-vector for each value in pix. The result array has the same shape as pix, with an added last dimension of size 3.

pix2xyf(self: ducc0.healpix.Healpix_Base, pix: numpy.ndarray, nthreads: int = 1) numpy.ndarray
pix_area(self: ducc0.healpix.Healpix_Base) float

Returns the area (in steradian) of a single pixel.

query_disc(self: ducc0.healpix.Healpix_Base, ptg: numpy.ndarray, radius: float) numpy.ndarray

Returns a range set of all pixels whose centers fall within “radius” of “ptg”. “ptg” must be a single (co-latitude, longitude) tuple. The result is a 2D array with last dimension 2; the pixels lying inside the disc are [res[0,0] .. res[0,1]); [res[1,0] .. res[1,1]) etc.

ring2nest(self: ducc0.healpix.Healpix_Base, ring: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns the pixel index in NEST scheme for every entry of ring. The result array has the same shape as ring.

scheme(self: ducc0.healpix.Healpix_Base) ducc0::detail_healpix::Ordering_Scheme

Returns a string representation of the pixelisation’s ordering scheme (“RING” or “NEST”).

sht_info(self: ducc0.healpix.Healpix_Base) dict

Returns a dictionary containing information necessary for spherical harmonic transforms on a HEALPix grid of the given nside parameter.

The dictionary keys are chosen in such a way that the dictionary can be used directly as kwargs in calls to ducc0.sht.synthesis and similar.

Returns:

  • theta (numpy.ndarray(numpy.float64, shape=(nrings,))) – the colatitudes of all rings

  • nphi (numpy.ndarray(numpy.uint64, shape=(nrings,))) – the number of pixels for every ring

  • phi0 (numpy.ndarray(numpy.float64, shape=(nrings,))) – the azimuth of the first pixel in every ring

  • ringstart (numpy.ndarray(numpy.uint64, shape=(nrings,))) – the index of the first pixel in every ring in a typical HEALPix map array.

vec2pix(self: ducc0.healpix.Healpix_Base, vec: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns the index of the containing pixel for every 3-vector in vec. vec must have a last dimension of size 3; the result array has the same shape as vec, except that vec’s last dimension is removed.

xyf2pix(self: ducc0.healpix.Healpix_Base, xyf: numpy.ndarray, nthreads: int = 1) numpy.ndarray
ducc0.healpix.ang2vec(ang: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns a normalized 3-vector for every (co-latitude, longitude) tuple in ang. ang must have a last dimension of size 2; the result array has the same shape as ang, except that its last dimension is 3 instead of 2.

ducc0.healpix.v_angle(v1: numpy.ndarray, v2: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns the angles between the 3-vectors in v1 and v2. The input arrays must have identical shapes. The result array has the same shape as v1 or v2, except that their last dimension is removed. The employed algorithm is highly accurate, even for angles close to 0 or pi.

ducc0.healpix.vec2ang(vec: numpy.ndarray, nthreads: int = 1) numpy.ndarray

Returns a (co-latitude, longitude) tuple for every 3-vector in vec. vec must have a last dimension of size 3; the result array has the same shape as vec, except that its last dimension is 2 instead of 3.