我有一个Healpix像素协调文件 https://wwwmpa.mpa-garching.mpg.de/~ensslin/research/data/faraday2020.html
这包含我想在skyplot中实现的纬度和经度值。 然而,这些值需要首先转换为银河系坐标(l,b)
我的密码是:
from astropy.io import fits
from astropy import units as u
from astropy.coordinates import Galactic
import matplotlib.pyplot as plt
import h5py
from astropy_healpix import HEALPix
filename='pixel_coords_map_ring_galactic_res9.fits'
hdulist=fits.open(filename)
nside = hdulist[1].header['NSIDE']
order = hdulist[1].header['ORDERING']
hp = HEALPix(nside=nside, order=order, frame=Galactic())
print(hdulist[1].header)
ggl = hdulist[1].data['LONGITUDE'] #storing coordinate values in ggl and ggb
ggb = hdulist[1].data['LATITUDE']
gl = ggl * u.degree #convering to galactic coordinates
gb = ggb * u.degree
c = Galactic(l=gl,b=gb)
l_rad = c.l.wrap_at(180 * u.deg).radian
b_rad = c.b.radian
有没有更有效的方法来实现从长lat到galactic或Healpix功能的转换?请帮忙
这段代码来自我之前写的一个答案。在银河系坐标系中,它不是把长纬度转换成u度吗?Ref:Plotting mean and standard dev values on skyplot using astropy
注意:这是我用来获取HEALPix文件的链接:('pixel_coords_map_ring_galactic_res9.fits')
相关问题 更多 >
编程相关推荐