我有一张带有银河坐标的healpix 地图。我想将该地图转换为赤道坐标系。我知道我可以使用 mollview() 函数在赤道坐标中绘制地图。你有什么办法保存这样的转换后的地图吗?
谢谢
维努
以下函数更改地图的坐标系。
def change_coord(m, coord):
""" Change coordinates of a HEALPIX map
Parameters
----------
m : map or array of maps
map(s) to be rotated
coord : sequence of two character
First character is the coordinate system of m, second character
is the coordinate system of the output map. As in HEALPIX, allowed
coordinate systems are 'G' (galactic), 'E' (ecliptic) or 'C' (equatorial)
Example
-------
The following rotate m from galactic to equatorial coordinates.
Notice that m can contain both temperature and polarization.
>>>> change_coord(m, ['G', 'C'])
"""
# Basic HEALPix parameters
npix = m.shape[-1]
nside = hp.npix2nside(npix)
ang = hp.pix2ang(nside, np.arange(npix))
# Select the coordinate transformation
rot = hp.Rotator(coord=reversed(coord))
# Convert the coordinates
new_ang = rot(*ang)
new_pix = hp.ang2pix(nside, *new_ang)
return m[..., new_pix]
例子就是你的情况
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)