healpy.pixelfunc.get_all_neighbours¶
-
healpy.pixelfunc.
get_all_neighbours
(nside, theta, phi=None, nest=False, lonlat=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.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: 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.
See also
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])
>>> hp.get_all_neighbours(1, 90, 0, lonlat=True) array([ 8, 4, 0, -1, 1, 6, 9, -1])