healpy.pixelfunc.pix2ang

healpy.pixelfunc.pix2ang(nside, ipix, nest=False, lonlat=False)

pix2ang : nside,ipix,nest=False,lonlat=False -> theta[rad],phi[rad] (default RING)

Parameters:
nsideint or array-like

The healpix nside parameter, must be a power of 2, less than 2**30

ipixint or array-like

Pixel indices

nestbool, optional

if True, assume NESTED pixel ordering, otherwise, RING pixel ordering

lonlatbool, optional

If True, return angles will be longitude and latitude in degree, otherwise, angles will be co-latitude and longitude in radians (default)

Returns:
theta, phifloat, scalar or array-like

The angular coordinates corresponding to ipix. Scalar if all input are scalar, array otherwise. Usual numpy broadcasting rules apply.

See also

ang2pix, vec2pix, pix2vec

Examples

>>> import healpy as hp
>>> hp.pix2ang(16, 1440)
(1.5291175943723188, 0.0)
>>> hp.pix2ang(16, [1440,  427, 1520,    0, 3068])
(array([ 1.52911759,  0.78550497,  1.57079633,  0.05103658,  3.09055608]), array([ 0.        ,  0.78539816,  1.61988371,  0.78539816,  0.78539816]))
>>> hp.pix2ang([1, 2, 4, 8], 11)
(array([ 2.30052398,  0.84106867,  0.41113786,  0.2044802 ]), array([ 5.49778714,  5.89048623,  5.89048623,  5.89048623]))
>>> hp.pix2ang([1, 2, 4, 8], 11, lonlat=True)
(array([ 315. ,  337.5,  337.5,  337.5]), array([-41.8103149 ,  41.8103149 ,  66.44353569,  78.28414761]))