healpy.pixelfunc.get_neighbours¶
- healpy.pixelfunc.get_neighbours(nside, theta, phi=None, nest=False)¶
Return the 4 nearest pixels and corresponding weights.
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.
Returns: res : tuple of length 2
contains pixel numbers in res[0] and weights in res[1]. Usual numpy broadcasting rules apply.
See also
Examples
>>> import healpy as hp >>> hp.get_neighbours(1, 0) (array([0, 1, 4, 5]), array([ 1., 0., 0., 0.]))
>>> hp.get_neighbours(1, 0, 0) (array([1, 2, 3, 0]), array([ 0.25, 0.25, 0.25, 0.25]))
>>> hp.get_neighbours(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. ]]))