def ang2pix_ring(nside, theta, phi):
"""Calculate the pixel indexes in RING ordering scheme for each
pair of angular coordinates on the sphere.
Parameters
----------
theta : 1D or 2D `~numpy.ndarray`
The polar angles (i.e., latitudes), ? ? [0, ?]. (unit: rad)
phi : 1D or 2D `~numpy.ndarray`
The azimuthal angles (i.e., longitudes), ? ? [0, 2?). (unit: rad)
Returns
-------
ipix : 1D or 1D `~numpy.ndarray`
The indexes of the pixels corresponding to the input coordinates.
The shape is the same as the input array.
NOTE
----
* Only support the *RING* ordering scheme
* This is the JIT-optimized version that partially replaces the
``healpy.ang2pix``
"""
shape = theta.shape
size = theta.size
theta = theta.flatten()
phi = phi.flatten()
ipix = np.zeros(size, dtype=np.int64)
for i in range(size):
ipix[i] = ang2pix_ring_single(nside, theta[i], phi[i])
return ipix.reshape(shape)
评论列表
文章目录