1
我有一個與銀河座標healpix地圖。我想將該地圖轉換爲赤道座標系。我知道我可以使用mollview()函數在赤道座標上繪製地圖。你有什麼辦法來保存這種轉換後的地圖嗎?如何轉換並保存healpy地圖到不同的座標系?
由於 Vinu
我有一個與銀河座標healpix地圖。我想將該地圖轉換爲赤道座標系。我知道我可以使用mollview()函數在赤道座標上繪製地圖。你有什麼辦法來保存這種轉換後的地圖嗎?如何轉換並保存healpy地圖到不同的座標系?
由於 Vinu
下面的函數改變地圖的座標系統。
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]
的例子是你的情況