HEALPy:在 cartview 旋转后获取数组的新索引

HEALPy: Get new indices of array after cartview rotation

我正在尝试了解应用 cartview 旋转后 HEALPix 数组的新索引是什么。所以我有:

latra = [-90,90]
lonra = [-180,180]
nside = 16
pixels = np.arange(12*nside**2)
newPixIndex = hp.cartview(pixels, rot=(45,0), lonra=lonra,latra=latra, return_projected_map=True)

如何从返回的 newPixIndex 地图执行 cartview 旋转后获取 pixels 的新订单?

我通过执行以下操作在此处 (Apply rotation to HEALPix map in healpy) 找到了解决方案:

def rotate_map(hmap, rot_theta, rot_phi):
    """
    Take hmap (a healpix map array) and return another healpix map array
    which is ordered such that it has been rotated in (theta, phi) by the
    amounts given.
    """
    nside = hp.npix2nside(len(hmap))

    # Get theta, phi for non-rotated map
    t,p = hp.pix2ang(nside, np.arange(hp.nside2npix(nside))) #theta, phi

    # Define a rotator
    r = hp.Rotator(deg=False, rot=[rot_phi,rot_theta])

    # Get theta, phi under rotated co-ordinates
    trot, prot = r(t,p)

    # Interpolate map onto these co-ordinates
    rot_map = hp.get_interp_val(hmap, trot, prot)

    return rot_map

nside = 64
indices = np.arange(12*nside**2)
rot = [0, 15, 30, 45, 60, 75, 90]

for i in range(len(rot)):
    newIndex = np.array(rotate_map(indices,0,np.rad2deg(rot[i])),dtype='int')