astroquery:docs

SIMBAD Queries (astroquery.simbad)

Getting started

This module can be used to query the Simbad service. Presented below are examples that illustrate the different types of queries that can be formulated. If successful all the queries will return the results in an astropy.table.Table.

Query an Identifier

This is useful if you want to query a known identifier. For instance to query the messier object m1:

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_object("m1")
>>> print(result_table)

MAIN_ID      RA         DEC     RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
------- ----------- ----------- ------- -------- ------------ ------------ ------------- -------- -------------- -------------------
M   1 05 34 31.94 +22 00 52.2       6        6          nan          nan             0        C              R 2011A&A...533A..10L

Wildcards are supported. So for instance to query messier objects from 1 through 9:

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_object("m [1-9]", wildcard=True)
>>> print(result_table)

MAIN_ID      RA         DEC     RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
------- ----------- ----------- ------- -------- ------------ ------------ ------------- -------- -------------- -------------------
M   1 05 34 31.94 +22 00 52.2       6        6          nan          nan             0        C              R 2011A&A...533A..10L
M   2 21 33 27.02 -00 49 23.7       6        6      100.000      100.000             0        C              O 2010AJ....140.1830G
M   3 13 42 11.62 +28 22 38.2       6        6      200.000      200.000             0        C              O 2010AJ....140.1830G
M   4 16 23 35.22 -26 31 32.7       6        6      400.000      400.000             0        C              O 2010AJ....140.1830G
M   5 15 18 33.22 +02 04 51.7       6        6          nan          nan             0        C              O 2010AJ....140.1830G
M   6    17 40 20    -32 15.2       4        4          nan          nan             0        E              O 2009MNRAS.399.2146W
M   7    17 53 51    -34 47.6       4        4          nan          nan             0        E              O 2009MNRAS.399.2146W
M   8    18 03 37    -24 23.2       4        4    18000.000    18000.000           179        E
M   9 17 19 11.78 -18 30 58.5       6        6          nan          nan             0        D                2002MNRAS.332..441F

Wildcards are supported by other queries as well - where this is the case, examples are presented to this end. The wildcards that are supported and their usage across all these queries is the same. To see the available wildcards and their functions:

>>> from astroquery.simbad import Simbad
>>> Simbad.list_wildcards()

* : Any string of characters (including an empty one)

[^0-9] : Any (one) character not in the list.

? : Any character (exactly one character)

[abc] : Exactly one character taken in the list. Can also be defined by a range of characters: [A-Z]

Query a region

Queries that support a cone search with a specified radius - around an identifier or given coordinates are also supported. If an identifier is used then it will be resolved to coordinates using online name resolving services available in astropy.

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_region("m81")
>>> print(result_table)

            MAIN_ID                 RA           DEC      RA_PREC DEC_PREC ... COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
-------------------------- ------------- ------------- ------- -------- ... ------------- -------- -------------- -------------------
[VV2006c] J095534.0+043546 09 55 33.9854 +04 35 46.438       8        8 ...             0        B              O 2009A&A...505..385A
...

When no radius is specified, the radius defaults to 20 arcmin. A radius may also be explicitly specified - it can be entered either as a string that is acceptable by astropy.coordinates.Angle or by using the Quantity object from astropy.units:

>>> from astroquery.simbad import Simbad
>>> import astropy.units as u
>>> result_table = Simbad.query_region("m81", radius=5 * u.deg)
>>> # another way to specify the radius.
>>> result_table = Simbad.query_region("m81", radius='5d0m0s')
>>> print(result_table)

                MAIN_ID               RA  ...     COO_WAVELENGTH     COO_BIBCODE
    ----------------------- ------------- ... -------------- -------------------
                      M  81 09 55 33.1730 ...              R 2004AJ....127.3587F
                  [F88] X-5   09 55 33.32 ...                2001ApJ...554..202I
              [SPZ2011] 264  09 55 32.618 ...              X 2011ApJ...735...26S
              M81N 2002-12b   09 55 32.30 ...                2008A&A...492..301H
              [SGM2003] 109  09 55 34.296 ...              X 2011ApJ...735...26S
    [RW2000] NGC  3031 X-13    09 55 34.2 ...                2000MNRAS.315...98R
              [SPZ2011] 113  09 55 33.108 ...              X 2011ApJ...735...26S
              [SGM2003] 112  09 55 34.698 ...              X 2011ApJ...735...26S
              [SPZ2011] 103  09 55 34.292 ...              X 2011ApJ...735...26S
               [PR95] 50530  09 55 34.679 ...
              M81N 2010-06d   09 55 34.96 ...                2010CBET.2338....1H

If coordinates are used, then they should be entered using an astropy.coordinates object. Limited support for entering the coordinates directly as a string also exists - only for ICRS coordinates (though these may just as well be specified by the astropy.coordinates.ICRSCoordinates object)

>>> from astroquery.simbad import Simbad
>>> import astropy.coordinates as coord
>>> # works only for ICRS coordinates:
>>> result_table = Simbad.query_region("05h35m17.3s -05h23m28s", radius='5d0m0s')
>>> print(result_table)

MAIN_ID           RA           DEC      RA_PREC DEC_PREC ... COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
--------------- ------------- ------------- ------- -------- ... ------------ ------------- -------- -------------- -------------------
HD  38875 05 34 59.7297 -80 51 09.082       9        9 ...        5.270             0        A              O 2007A&A...474..653V
TYC 9390-799-1 05 33 58.2222 -80 50 18.575       8        8 ...       58.480            90        B                1998A&A...335L..65H
TYC 9390-646-1  05 35 02.830  -81 00 04.28       7        7 ...       58.000            90        B              O 2000A&A...355L..27H
TYC 9390-629-1  05 35 20.419  -81 00 30.51       7        7 ...       60.000            90        B              O 2000A&A...355L..27H
TYC 9390-857-1  05 30 58.989  -80 54 39.41       7        7 ...       93.000            90        B              O 2000A&A...355L..27H
TYC 9390-1171-1 05 37 35.9623 -80 42 56.794       8        8 ...       45.540            90        B                1998A&A...335L..65H

For other coordinate systems, use the appropriate astropy.coordinates object:

>>> from astroquery.simbad import Simbad
>>> import astropy.coordinates as coord
>>> import astropy.units as u
>>> result_table = Simbad.query_region(coord.GalacticCoordinates(l=31.0087, b=14.0627,
...                                    unit=(u.deg, u.deg)), radius='0d0m2s')
>>> print(result_table)

            MAIN_ID             RA      ... COO_WAVELENGTH     COO_BIBCODE
------------------- ------------- ... -------------- -------------------
NAME Barnard's star 17 57 48.4980 ...              O 2007A&A...474..653V

Two other options can also be specified - the epoch and the equinox. If these are not explicitly mentioned, then the epoch defaults to J2000 and the equinox to 2000.0. So here is a query with all the options utilized:

>>> from astroquery.simbad import Simbad
>>> import astropy.coordinates as coord
>>> import astropy.units as u
>>> result_table = Simbad.query_region(coord.FK5Coordinates(ra=11.70, dec=10.90,
...                                    unit=(u.deg, u.deg)),
...                                    radius=5 * u.degree,
...                                    epoch='B1950',
...                                    equinox=1950)
>>> print(result_table)

MAIN_ID               RA      ... COO_WAVELENGTH     COO_BIBCODE
----------------------- ------------- ... -------------- -------------------
PHL  6696       00 49.4 ...
BD+10    97 00 49 25.4553 ...              O 2007A&A...474..653V
TYC  607-238-1  00 48 53.302 ...              O 2000A&A...355L..27H
PHL  2998       00 49.3 ...
2MASS J00492121+1121094  00 49 21.219 ...              I 2003yCat.2246....0C
TYC  607-1135-1 00 48 46.5838 ...                1998A&A...335L..65H

Query a catalogue

Queries can also be formulated to return all the objects from a catalogue. For instance to query the ESO catalog:

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_catalog('eso')
>>> print(result_table)

MAIN_ID              RA      ... COO_WAVELENGTH     COO_BIBCODE
----------------------- ------------ ... -------------- -------------------
2MASS J08300740-4325465  08 30 07.41 ...              I 2003yCat.2246....0C
NGC  2573 01 41 35.091 ...              I 2006AJ....131.1163S
ESO   1-2   05 04 36.8 ...                1982ESO...C......0L
ESO   1-3 05 22 36.509 ...              I 2006AJ....131.1163S
ESO   1-4 07 49 28.813 ...              I 2006AJ....131.1163S
ESO   1-5 08 53 05.006 ...              I 2006AJ....131.1163S

Query a bibcode

This retrieves the reference corresponding to a bibcode.

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_bibcode('2005A&A.430.165F')
>>> print(result_table)

References
------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2005A&A...430..165F  --  ?
Astron. Astrophys., 430, 165-186 (2005)
FAMAEY B., JORISSEN A., LURI X., MAYOR M., UDRY S., DEJONGHE H. and TURON C.
Local kinematics of K and M giants from CORAVEL/Hipparcos/Tycho-2 data. Revisiting the concept of  superclusters.
Files: (abstract)
Notes: <Available at CDS: tablea1.dat notes.dat>

Wildcards can be used in these queries as well. So to retrieve all the bibcodes from a given journal in a given year:

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_bibcode('2013A&A*', wildcard=True)
>>> print(result_table)

References
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
2013A&A...549A...1G  --  ?
Astron. Astrophys., 549A, 1-1 (2013)
GENTILE M., COURBIN F. and MEYLAN G.
Interpolating point spread function anisotropy.
Files: (abstract) (no object)

2013A&A...549A...2L  --  ?
Astron. Astrophys., 549A, 2-2 (2013)
LEE B.-C., HAN I. and PARK M.-G.
Planetary companions orbiting M giants HD 208527 and HD 220074.
Files: (abstract)

2013A&A...549A...3C  --  ?
Astron. Astrophys., 549A, 3-3 (2013)
COCCATO L., MORELLI L., PIZZELLA A., CORSINI E.M., BUSON L.M. and DALLA BONTA E.
Spectroscopic evidence of distinct stellar populations in the  counter-rotating stellar disks of NGC 3593 and NGC 4550.
Files: (abstract)

2013A&A...549A...4S  --  ?
Astron. Astrophys., 549A, 4-4 (2013)
SCHAERER D., DE BARROS S. and SKLIAS P.
Properties of z ~ 3-6 Lyman break galaxies. I. Testing star formation  histories and the SFR-mass relation with ALMA and near-IR spectroscopy.
Files: (abstract)

2013A&A...549A...5R  --  ?
Astron. Astrophys., 549A, 5-5 (2013)
RYGL K.L.J., WYROWSKI F., SCHULLER F. and MENTEN K.M.
Initial phases of massive star formation in high infrared extinction  clouds. II. Infall and onset of star formation.
Files: (abstract)

2013A&A...549A...6K  --  ?
Astron. Astrophys., 549A, 6-6 (2013)
KAMINSKI T., SCHMIDT M.R. and MENTEN K.M.
Aluminium oxide in the optical spectrum of VY Canis Majoris.
Files: (abstract)

Query a bibobj

These queries can be used to retrieve all the objects that are contained in the article specified by the bibcode:

>>> from astroquery.simbad import Simbad
>>> result_table = Simbad.query_bibobj('2005A&A.430.165F')
>>> print(result_table)

MAIN_ID       RA          DEC      RA_PREC DEC_PREC COO_ERR_MAJA COO_ERR_MINA COO_ERR_ANGLE COO_QUAL COO_WAVELENGTH     COO_BIBCODE
--------- ------------ ------------ ------- -------- ------------ ------------ ------------- -------- -------------- -------------------
NGC   524 01 24 47.707 +09 32 19.65       7        7          nan          nan             0        B              I 2006AJ....131.1163S
NGC  3593 11 14 37.002 +12 49 04.87       7        7          nan          nan             0        B              I 2006AJ....131.1163S
NGC  4138 12 09 29.788 +43 41 07.14       7        7          nan          nan             0        B              I 2006AJ....131.1163S
NGC  4550 12 35 30.612 +12 13 15.44       7        7          nan          nan             0        B              I 2006AJ....131.1163S
NGC  5179 13 29 30.875 +11 44 44.54       7        7          nan          nan             0        B              I 2006AJ....131.1163S
NGC  5713 14 40 11.528 -00 17 21.16       7        7          nan          nan             0        B              I 2006AJ....131.1163S

Customizing the default settings

There may be times when you wish to change the defaults that have been set for the Simbad queries.

Changing the row limit

To fetch all the rows in the result, the row limit must be set to 0. However for some queries, results are likely to be very large, in such cases it may be best to limit the rows to a smaller number. If you want to do this only for the current python session then:

>>> from astroquery.simbad import Simbad
>>> Simbad.ROW_LIMIT = 15 # now any query fetches at most 15 rows

If you would like to make your choice persistent, then you can do this by modifying the setting in the astroquery configuration file.

Changing the timeout

The timeout is the time limit in seconds for estabishing connection with the Simbad server and by default it is set to 100 seconds. You may want to modify this - again you can do this at run-time if you want to adjust it only for the current session. To make it persistent, you must modify the setting in the astroquery configuration file.

>>> from astroquery.simbad import Simbad
>>> Simbad.TIMEOUT = 60 # sets the timeout to 60s

Specifying which VOTable fields to include in the result

The VOTable fields that are currently returned in the result are set to main_id and coordinates. However you can specify other fields that you also want to be fetched in the result. To see the list of the fields:

>>> from astroquery.simbad import Simbad
>>> Simbad.list_votable_fields()

          col0               col1          col2
      ----------------- ------------ --------------
                dim      main_id  propermotions
          dim_angle measurements        ra(opt)
        dim_bibcode       mesplx        ra_prec
           dim_incl        mespm            rot
        dim_majaxis           mk       rv_value

The above shows just a small snippet of the table that is returned and has all the fields sorted lexicographically column-wise. For more information on a particular field:

>>> from astroquery.simbad import Simbad
>>> Simbad.get_field_description('ra_prec')

right ascension precision code (0:1/10deg, ..., 8: 1/1000 arcsec)

To set additional fields to be returned in the VOTable:

>>> from astroquery.simbad import Simbad

# see which fields are currently set

>>> Simbad.VOTABLE_FIELDS

['main_id', 'coordinates']

# To set other fields

>>> Simbad.set_votable_fields('mk', 'rot', 'bibcodelist(1800-2014)')
>>> Simbad.VOTABLE_FIELDS

['main_id', 'coordinates', 'mk', 'rot', 'bibcodelist(1800-2014')]

You can also remove a field you have set or reset Simbad.VOTABLE_FIELDS to its default value. Continuing from the above example:

>>> Simbad.rm_votable_fields('mk', 'coordinates')
>>> Simbad.VOTABLE_FIELDS

['rot', 'main_id']

# reset back to defaults

>>> Simbad.reset_votable_fields()
>>> Simbad.VOTABLE_FIELDS

['main_id', 'coordinates']

Reference/API

astroquery.simbad Module

The SIMBAD query tool creates a script query that returns VOtable XML data that is then parsed into a SimbadResult object. This object then parses the data and returns a table parsed with astropy.io.votable.parse.

Classes

Simbad The class for querying the Simbad web service.