healpy.pixelfunc.get_all_neighbours¶
- healpy.pixelfunc.get_all_neighbours(nside, theta, phi=None, nest=False, lonlat=False)¶
Return the 8 nearest pixels.
- Parameters:
- nsideint
the nside to work with
- theta, phiscalar or array-like
if phi is not given or None, theta is interpreted as pixel number, otherwise, theta[rad],phi[rad] are angular coordinates
- nestbool
if
True
, pixel number will be NESTED ordering, otherwise RING ordering.- lonlatbool
If True, input angles are assumed to be longitude and latitude in degree, otherwise, they are co-latitude and longitude in radians.
- Returns:
- ipixint, 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.
See also
Examples
>>> import healpy as hp >>> print(hp.get_all_neighbours(1, 4)) [11 7 3 -1 0 5 8 -1]
>>> print(hp.get_all_neighbours(1, np.pi/2, np.pi/2)) [ 8 4 0 -1 1 6 9 -1]
>>> print(hp.get_all_neighbours(1, 90, 0, lonlat=True)) [ 8 4 0 -1 1 6 9 -1]