A new access to SIMBAD TAP in astroquery

Created: April 05, 2024 - 12:32 CEST
Updated: April 09, 2024 - 14:04 CEST

The latest version of the python library astroquery (v0.4.7) ships a new access to SIMBAD TAP.

The detailed documentation is on astroquery's page, but here is a quick preview of some of the new functionalities:

Simple SIMBAD TAP access

You can now call query_tap directly. Let's, for example, look for stars in 5 degrees around M13 where SIMBAD references a flux in the U band:

from astroquery.simbad import Simbad
from astropy.coordinates import SkyCoord
# first, we call sesame to find M13 coordinates
m13 = SkyCoord.from_name("M13")
# then we create an ADQL query
adql = rf"""SELECT main_id, otype, flux, filter, bibcode AS flux_reference
-- join the tables "basic" and "flux"
FROM flux JOIN basic ON oidref = oid
-- take the filter 'U'
WHERE filter = 'U' 
-- select any object which main type descends from Star
AND otype = 'Star..'
-- and add the coordinates condition
AND CONTAINS(POINT('ICRS', ra, dec), CIRCLE('ICRS', {m13.ra.deg}, {m13.dec.deg}, 5)) = 1
"""
Simbad.query_tap(adql)
<Table length=58>
        main_id         otype    flux  filter    flux_reference  
         object         object float32 object        object      
----------------------- ------ ------- ------ -------------------
              HD 151428     **    7.85      U 1986A&AS...65..405O
       LSPM J1639+4124E    PM*   16.13      U 2005MNRAS.358..333G
                 GD 358    WD*  12.511      U 2013AJ....146..131L
       UCAC4 625-052116      *  18.075      U 2013AJ....146..131L
       UCAC4 613-056337      *  15.186      U 2013AJ....146..131L
            * nu.02 CrB    PM*     8.8      U 2002yCat.2237....0D
                    ...    ...     ...    ...                 ...
2MASS J16342453+4059547    PM*   15.11      U 2005MNRAS.358..333G
2MASS J16382119+4122543    PM*   15.05      U 2005MNRAS.358..333G
        TYC 3066-2095-1      *   13.43      U 2005MNRAS.358..333G
        TYC 3074-1095-1      *   13.22      U 2005MNRAS.358..333G
              V* HZ Her    LXB    11.9      U 2007A&A...469..807L
            PG 1636+351    WD*  13.585      U 2013AJ....146..131L

Mix your own tables in the query

This new method also provides an easy way to join your own table(s) with Simbad tables within an ADQL query (this is like the upload table functionality on the SIMBAD TAP webpage):

from astroquery.simbad import Simbad
from astropy.table import Table
list_of_objects = Table([["M1", "M2", "M3"]], names=["messier_id"])
adql = """SELECT main_id, messier_id, ra, dec, otype FROM basic
JOIN messiers
ON basic.main_id = messiers.messier_id
"""
Simbad.query_tap(adql, messiers=list_of_objects)
<Table length=3>
main_id messier_id         ra                 dec         otype 
                          deg                 deg               
 object   object        float64             float64       object
------- ---------- ------------------ ------------------- ------
  M   1         M1            83.6287             22.0147    SNR
  M   2         M2 323.36258333333336 -0.8232499999999998    GlC
  M   3         M3  205.5484166666666   28.37727777777778    GlC

Note that we created an astropy Table from scratch so that the example would be self-contained, but you can also do this with a table read from any file format that astropy understands.

If you have any feedback, don't hesitate to contact us!