hp.write_map 函数只是将内存中预先存在的 healpix 映射写入 fit 文件。
根据您的问题,尚不清楚您拥有什么样的数据。但是假设你有一个二维数据网格,因为你使用了imshow。在使用 hp.write_map 之前,您需要将其转换为 healpix 地图。
根据您的坐标系,您需要知道每个网格点的坐标,才能将网格转换为 healpix 地图。
要将一些数据(标量)转换为 healpix 地图,在找到坐标后,您可以编写这样的函数,它获取坐标并为您制作 healpix 地图。
def make_map_vec(theta, phi, data):
assert len(theta) == len(phi) == len(data)
e1map = np.full(hp.nside2npix(NSIDE), hp.UNSEEN, dtype=np.float)
index = hp.ang2pix(NSIDE, theta, phi)
values = np.fromiter((np.sum(data[index==i]) for i in np.unique(index)), float, count=len(np.unique(index)))
e1map[np.unique(index)] = values
return e1map
This 链接为您提供了 healpix 使用的坐标系。