如何使用Healpy部分绘制Healpix映射?

2024-05-23 18:41:07 发布

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

当使用healpy时,我可以在Mollview中使用

import healpy
map = 'filename.fits'
healpy.visufunc.mollview(map)

或者在教程中

^{pr2}$

哪些输出

enter image description here

有没有办法只显示地图的某些区域?例如,只有上半球,还是只有左半球?在

我的想法是只观察天空的小块区域来观察小的点源,或者类似LSST的“半天空”投影

enter image description here


Tags: import区域map地图教程filenamefits办法
1条回答
网友
1楼 · 发布于 2024-05-23 18:41:07

可以使用遮罩,它是相同大小的布尔映射,其中1被遮罩,0不遮罩:

http://healpy.readthedocs.org/en/latest/tutorial.html#masked-map-partial-maps

示例:

import numpy as np
import healpy as hp
NSIDE = 32
m = hp.ma(np.arange(hp.nside2npix(NSIDE), dtype=np.double))
mask = np.zeros(hp.nside2npix(NSIDE), dtype=np.bool)
pixel_theta, pixel_phi = hp.pix2ang(NSIDE, np.arange(hp.nside2npix(NSIDE)))
mask[pixel_theta > np.pi/2] = 1
m.mask = mask
hp.mollview(m)

enter image description here

相关问题 更多 >