2016-12-28 65 views
3

我试图获得使用Simbad类从astroquery所有帧坐标,就像它是在SIMBAD web page (基本数据部分)显示Astroquery SIMBAD:获取坐标对于所有帧

我有以下代码:

from astroquery.simbad import Simbad 

def get(): 
    Simbad.reset_votable_fields() 
    Simbad.remove_votable_fields('coordinates') 

    Simbad.add_votable_fields('ra(:;A;ICRS;J2000)', 'dec(:;D;ICRS;2000)') 
    Simbad.add_votable_fields('ra(:;A;FK5;J2000)', 'dec(:;D;FK5;2000)') 

    table = Simbad.query_object("Betelgeuse", wildcard=False) 

,但我得到的错误:

KeyError: 'ra(:;A;FK5;J2000): field already present. Fields ra,dec,id,otype, and bibcodelist can only be specified once. To change their options, first remove the existing entry, then add a new one.'

一切我可以鳍d约操纵可投票字段中的文档,特别是协调是这样的:

http://astroquery.readthedocs.io/en/latest/simbad/simbad.html#specifying-the-format-of-the-included-votable-fields

有没有办法让发送一个查询SIMBAD所有帧的坐标?

回答

1

而是查询多个坐标(与astroquery似乎是不可能的),从SIMBAD您可以通过使用astropy.coordinates.SkyCoord坐标转换的。

例如:

from astroquery.simbad import Simbad 
from astropy.coordinates import SkyCoord 

Simbad.reset_votable_fields() 
Simbad.remove_votable_fields('coordinates') 
Simbad.add_votable_fields('ra(:;A;ICRS;J2000)', 'dec(:;D;ICRS;2000)') 
table = Simbad.query_object("Betelgeuse", wildcard=False) 
coords = SkyCoord(ra=['{}h{}m{}s'.format(*ra.split(':')) for ra in table['RA___A_ICRS_J2000']], 
        dec=['{}d{}m{}s'.format(*dec.split(':')) for dec in table['DEC___D_ICRS_2000']], 
        frame='icrs', equinox='J2000') 

其是可以转化为其它帧一个现在SkyCoord对象:

>>> coords 
<SkyCoord (ICRS): (ra, dec) in deg 
    (88.79293875, 7.40706389)> 
>>> coords.fk4 
<SkyCoord (FK4: equinox=J2000.000, obstime=B1950.000): (ra, dec) in deg 
    (88.79274075, 7.40705223)> 
>>> coords.fk5 
<SkyCoord (FK5: equinox=J2000.000): (ra, dec) in deg 
    (88.79294545, 7.40705842)> 

这可以在hms dms格式再次转换为字符串,例如:

>>> coords.fk5.to_string('hmsdms') 
['05h55m10.3069s +07d24m25.4103s'] 

如果你想要这些额外的列在你的ta您可以简单地添加下列内容:

>>> table['RA FK5'] = coords.fk5.ra 
>>> table['DEC FK5'] = coords.fk5.dec 
>>> table['FK4'] = coords.fk4.to_string('hmsdms') 
>>> table 
MAIN_ID RA___A_ICRS_J2000 DEC___D_ICRS_2000  RA FK5  DEC FK5     FK4    
       "h:m:s"   "d:m:s"   deg   deg  
--------- ----------------- ----------------- ------------- ------------- ----------------------------- 
* alf Ori  05:55:10.3053  +07:24:25.430 88.7929454548 7.40705841559 05h55m10.2578s +07d24m25.388s 
+0

非常感谢您的详细解答!不知道我实际上可以从一个框架转换为另一个框架与宇宙。 – Civa

1

由于我无法确定的原因,astroquery不支持多个可配置的添加VO选项。但很快,请参阅this pull request。你发布的代码没有问题,只是在astroquery中的一个错误。