1
私は銀河の座標を持つヒープスマップを持っています。私はその地図を赤道座標系に変換したいと思います。私はmollview()関数を使って赤道座標でマップをプロットできることを知っています。そのような変換された地図を保存する方法はありますか?ヒラルピーマップを異なる座標系に変換して保存するには?
おかげVinu
私は銀河の座標を持つヒープスマップを持っています。私はその地図を赤道座標系に変換したいと思います。私はmollview()関数を使って赤道座標でマップをプロットできることを知っています。そのような変換された地図を保存する方法はありますか?ヒラルピーマップを異なる座標系に変換して保存するには?
おかげ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]
の例では、あなたのケース
です