healpix.py 文件源码

python
阅读 26 收藏 0 点赞 0 评论 0

项目:fg21sim 作者: liweitianux 项目源码 文件源码
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)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号