def ang2pix(nside,theta,phi,nest=False): """ang2pix : nside,theta[rad],phi[rad],nest=False -> ipix (default:RING) """ if nest: return pixlib._ang2pix_nest(nside,theta,phi) else: return pixlib._ang2pix_ring(nside,theta,phi)
def ang2pix(nside, theta, phi, nest=False): """ang2pix : nside,theta[rad],phi[rad],nest=False -> ipix (default:RING) """ if nest: return pixlib._ang2pix_nest(nside, theta, phi) else: return pixlib._ang2pix_ring(nside, theta, phi)
def ang2pix(nside, theta, phi, nest=False): """ang2pix : nside,theta[rad],phi[rad],nest=False -> ipix (default:RING) Parameters ---------- nside : int, scalar or array-like The healpix nside parameter, must be a power of 2 theta, phi : float, scalars or array-like Angular coordinates of a point on the sphere nest : bool, optional if True, assume NESTED pixel ordering, otherwise, RING pixel ordering Returns ------- pix : int or array of int The healpix pixel numbers. Scalar if all input are scalar, array otherwise. Usual numpy broadcasting rules apply. See Also -------- pix2ang, pix2vec, vec2pix Examples -------- >>> import healpy as hp >>> hp.ang2pix(16, np.pi/2, 0) 1440 >>> hp.ang2pix(16, [np.pi/2, np.pi/4, np.pi/2, 0, np.pi], [0., np.pi/4, np.pi/2, 0, 0]) array([1440, 427, 1520, 0, 3068]) >>> hp.ang2pix(16, np.pi/2, [0, np.pi/2]) array([1440, 1520]) >>> hp.ang2pix([1, 2, 4, 8, 16], np.pi/2, 0) array([ 4, 12, 72, 336, 1440]) """ check_theta_valid(theta) check_nside(nside) if nest: return pixlib._ang2pix_nest(nside, theta, phi) else: return pixlib._ang2pix_ring(nside, theta, phi)
def ang2pix(nside, theta, phi, nest=False): """ang2pix : nside,theta[rad],phi[rad],nest=False -> ipix (default:RING) Parameters ---------- nside : int, scalar or array-like The healpix nside parameter, must be a power of 2 theta, phi : float, scalars or array-like Angular coordinates of a point on the sphere nest : bool, optional if True, assume NESTED pixel ordering, otherwise, RING pixel ordering Returns ------- pix : int or array of int The healpix pixel numbers. Scalar if all input are scalar, array otherwise. Usual numpy broadcasting rules apply. See Also -------- pix2ang, pix2vec, vec2pix Examples -------- >>> import healpy as hp >>> hp.ang2pix(16, np.pi/2, 0) 1440 >>> hp.ang2pix(16, [np.pi/2, np.pi/4, np.pi/2, 0, np.pi], [0., np.pi/4, np.pi/2, 0, 0]) array([1440, 427, 1520, 0, 3068]) >>> hp.ang2pix(16, np.pi/2, [0, np.pi/2]) array([1440, 1520]) >>> hp.ang2pix([1, 2, 4, 8, 16], np.pi/2, 0) array([ 4, 12, 72, 336, 1440]) """ check_theta_valid(theta) if nest: return pixlib._ang2pix_nest(nside, theta, phi) else: return pixlib._ang2pix_ring(nside, theta, phi)