如何在python中将RA Dec坐标转换为银河系坐标
我正在用Python将像素坐标拟合文件转换为世界坐标。标题显示此fits文件位于RA Dec坐标系中。我想把它转换成银河系坐标。这是我试过的如何在python中将RA Dec坐标转换为银河系坐标,python,python-2.7,astropy,fits,Python,Python 2.7,Astropy,Fits,我正在用Python将像素坐标拟合文件转换为世界坐标。标题显示此fits文件位于RA Dec坐标系中。我想把它转换成银河系坐标。这是我试过的 from astropy import coordinates as coord from astropy import units as u c=coord.icrscoord(ra=wx,dec=wy,unit=(u.degree,u.degree)) c.galactic AttributeError: 'module' object has no
from astropy import coordinates as coord
from astropy import units as u
c=coord.icrscoord(ra=wx,dec=wy,unit=(u.degree,u.degree))
c.galactic
AttributeError: 'module' object has no attribute 'icrscoord'
这是行不通的。有什么建议吗?根据,语法是:
from astropy import units as u
from astropy.coordinates import SkyCoord
c = SkyCoord(ra=wx*u.degree, dec=wy*u.degree, frame='icrs')
c.galactic
这不起作用。这个代码的结果如下,我需要银河系坐标的结果。这个GVE的结果是Ra DecCoordinates@LALI不,@HBouy的回答是正确的。你错过了最后一步
c=SkyCoord(ra=wx*u.degree,dec=wy*u.degree,frame='icrs')
从ra-dec中的坐标创建一个SkyCoord
对象。您可以使用该对象查询有关坐标的内容,以及将其转换为其他表示形式c.galactic
提供了天空中同一点的副本,但在银河坐标系中。没有所谓的astropy.coordinates.icrsocord
。AttributeError
表示您试图使用不存在的东西。你是从哪里得到这个主意的?最接近的是ICRS
,但您通常不会直接在SkyCoord
上使用它: