def 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. See Also -------- get_neighbours, get_interp_val 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]) """ if not isnsideok(nside): raise ValueError('Wrong nside value. Must be a power of 2.') if phi is not None: theta = ang2pix(nside,theta, phi,nest=nest) if nest: r=pixlib._get_neighbors_nest(nside,theta) else: r=pixlib._get_neighbors_ring(nside,theta) res=np.array(r[0:8]) return res
def 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. See Also -------- get_neighbours, get_interp_val Examples -------- >>> import healpy as hpy >>> hpy.get_all_neighbours(1, 4) array([11, 7, 3, -1, 0, 5, 8, -1]) >>> hpy.get_all_neighbours(1, npy.pi/2, npy.pi/2) array([ 8, 4, 0, -1, 1, 6, 9, -1]) """ if not isnsideok(nside): raise ValueError('Wrong nside value. Must be a power of 2.') if phi is not None: theta = ang2pix(nside,theta, phi,nest=nest) if nest: r=pixlib._get_neighbors_nest(nside,theta) else: r=pixlib._get_neighbors_ring(nside,theta) res=npy.array(r[0:8]) return res
def get_all_neighbours(nside, theta, phi=None, nest=False): """Return the 8 nearest pixels Input: - nside: the nside to work with - ipix: the pixel number (can be an array) in nest scheme Parameters: - nest: if True, NEST scheme. Default: False (RING) Return: - tuple of pixels """ if not isnsideok(nside): raise ValueError('Wrong nside value. Must be a power of 2.') if not (phi is None): theta = ang2pix(nside,theta, phi) if nest: r=pixlib._get_neighbors_nest(nside,theta) else: r=pixlib._get_neighbors_ring(nside,theta) res=npy.array(r[0:8]) return res
def get_all_neighbours(nside, theta, phi=None, nest=False): """Return the 8 nearest pixels Input: - nside: the nside to work with - theta, phi: if phi is not given, theta is actually a pixel number if phi is given, theta[rad],phi[rad] is a direction Parameters: - nest: if True, NEST scheme. Default: False (RING) Return: - tuple of pixels """ if not isnsideok(nside): raise ValueError('Wrong nside value. Must be a power of 2.') if not (phi is None): theta = ang2pix(nside,theta, phi,nest=nest) if nest: r=pixlib._get_neighbors_nest(nside,theta) else: r=pixlib._get_neighbors_ring(nside,theta) res=npy.array(r[0:8]) return res
def get_all_neighbours(nside, theta, phi=None, nest=False): """Return the 8 nearest pixels Input: - nside: the nside to work with - theta, phi: if phi is not given, theta is actually a pixel number if phi is given, theta[rad],phi[rad] is a direction Parameters: - nest: if True, NEST scheme. Default: False (RING) Return: - tuple of pixels """ if not isnsideok(nside): raise ValueError('Wrong nside value. Must be a power of 2.') if not (phi is None): theta = ang2pix(nside, theta, phi, nest=nest) if nest: r = pixlib._get_neighbors_nest(nside, theta) else: r = pixlib._get_neighbors_ring(nside, theta) res = npy.array(r[0:8]) return res