healpy.pixelfunc.get_interp_weights

healpy.pixelfunc.get_interp_weights(nside, theta, phi=None, nest=False, lonlat=False)

Return the 4 closest pixels on the two rings above and below the location and corresponding weights. Weights are provided for bilinear interpolation along latitude and longitude

Parameters:

nside : int

the healpix nside

theta, phi : float, scalar or array-like

if phi is not given, theta is interpreted as pixel number, otherwise theta[rad],phi[rad] are angular coordinates

nest : bool

if True, NESTED ordering, otherwise RING ordering.

lonlat : bool

If True, input angles are assumed to be longitude and latitude in degree, otherwise, they are co-latitude and longitude in radians.

Returns:

res : tuple of length 2

contains pixel numbers in res[0] and weights in res[1]. Usual numpy broadcasting rules apply.

Examples

>>> import healpy as hp
>>> hp.get_interp_weights(1, 0)
(array([0, 1, 4, 5]), array([ 1.,  0.,  0.,  0.]))
>>> hp.get_interp_weights(1, 0, 0)
(array([1, 2, 3, 0]), array([ 0.25,  0.25,  0.25,  0.25]))
>>> hp.get_interp_weights(1, 0, 90, lonlat=True)
(array([1, 2, 3, 0]), array([ 0.25,  0.25,  0.25,  0.25]))
>>> hp.get_interp_weights(1, [0, np.pi/2], 0)
(array([[ 1,  4],
       [ 2,  5],
       [ 3, 11],
       [ 0,  8]]), array([[ 0.25,  1.  ],
       [ 0.25,  0.  ],
       [ 0.25,  0.  ],
       [ 0.25,  0.  ]]))