healpy.pixelfunc.get_all_neighbours

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

Return the 8 nearest pixels.

Parameters :

nside : int

the nside to work with

theta, phi : scalar or array-like

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

nest : bool

if True, pixel number will be NESTED ordering, otherwise RING ordering.

Returns :

ipix : int, array

pixel number of the SW, W, NW, N, NE, E, SE and S neighbours, shape is (8,) if input is scalar, otherwise shape is (8, N) if input is of length N. If a neighbor does not exist (it can be the case for W, N, E and S) the corresponding pixel number will be -1.

Examples

>>> import healpy as hp
>>> hp.get_all_neighbours(1, 4)
array([11,  7,  3, -1,  0,  5,  8, -1])
>>> hp.get_all_neighbours(1, np.pi/2, np.pi/2)
array([ 8,  4,  0, -1,  1,  6,  9, -1])

Project Versions

Previous topic

healpy.pixelfunc.get_neighbours

Next topic

healpy.pixelfunc.nest2ring

This Page