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

2024-09-28 17:18:28 发布

您现在位置:Python中文网/ 问答频道 /正文

我试图了解在应用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的新顺序


Tags: mapreturnnp数组hphealpixnsidepixels
1条回答
网友
1楼 · 发布于 2024-09-28 17:18:28

通过执行以下操作,我在这里(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')

相关问题 更多 >