In [1]:
import warnings
warnings.filterwarnings('ignore',message='profile')
warnings.filterwarnings('ignore',message='_astropy_init')
warnings.filterwarnings('ignore',message='ConfigurationDefaultMissingWarning ')

Astroquery

Astroquery is a set of related tools for querying different astronomical database services, e.g. SIMBAD, VizieR, and IRSA-IPAC, and for retrieving data from archives, e.g. the ESO, IRSA, and NRAO archives. It also includes tools for querying other astronomy-related databases such as line-list servers at NIST (primarily for optical/NIR electronic transitions) and Splatalogue for mm/radio molecular transitions.

The layout

Each astroquery tool includes a query method, or a set of query_* methods, depending on the capabilities the service offers.

For example, SIMBAD supports queries by source name (query_object) and by region (query_region). The returned values are always astropy tables


In [2]:
from astroquery.simbad import Simbad
from astropy import coordinates
from astropy import units as u


WARNING: ConfigurationDefaultMissingWarning: Could not determine version of package astroquery Cannot install default profile. If you are importing from source, this is expected. [astroquery._astropy_init]
WARNING:astropy:ConfigurationDefaultMissingWarning: Could not determine version of package astroquery Cannot install default profile. If you are importing from source, this is expected.
WARNING: AstropyDeprecationWarning: ConfigurationItem has been deprecated in astropy 0.4. Use ConfigItem objects as members of ConfigNamespace subclasses instead.  See ConfigNamespace for an example. [astropy.config.configuration]
WARNING:astropy:AstropyDeprecationWarning: ConfigurationItem has been deprecated in astropy 0.4. Use ConfigItem objects as members of ConfigNamespace subclasses instead.  See ConfigNamespace for an example.

In [3]:
result1 = Simbad.query_object('M 31')
result1


/Users/adam/anaconda/envs/astropy27/lib/python2.7/site-packages/numpy/ma/core.py:3847: UserWarning: Warning: converting a masked element to nan.
  warnings.warn("Warning: converting a masked element to nan.")
Out[3]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
M 3100 42 44.330+41 16 07.5077nannan0BI2006AJ....131.1163S

In [4]:
result2 = Simbad.query_region("05h35m17.3s -05d23m28s", radius=1*u.arcmin)
result2


/Users/adam/repos/astroquery/astroquery/utils/commons.py:197: UserWarning: Coordinate string is being interpreted as an ICRS coordinate.
  warnings.warn("Coordinate string is being interpreted as an ICRS coordinate.")
WARNING: AstropyDeprecationWarning: 
        Use to_string instead. [astroquery.simbad.core]
WARNING:astropy:AstropyDeprecationWarning: 
        Use to_string instead.
WARNING: AstropyDeprecationWarning: 
        Use to_string instead. [astroquery.simbad.core]
WARNING:astropy:AstropyDeprecationWarning: 
        Use to_string instead.
Out[4]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
M 4205 35 17.3-05 23 28557500.0007500.00090D1981MNRAS.194..693L
[OW94] 172-23705 35 17.20-05 23 26.866nannan0D1999AJ....117.1375S
[OW94] 172-32705 35 17.20-05 23 26.866nannan0D1996AJ....111..846O
DOH 7 175-32805 35 17.5-05 23 2855nannan0D2004AJ....127.3456D
MAX 12605 35 17.11-05 23 29.366nannan0DI2005AJ....129.1534R
DOH 7 171-32705 35 17.1-05 23 2755nannan0D2004AJ....127.3456D
MAX 12505 35 17.11-05 23 26.666nannan0DI2005AJ....129.1534R
[OW94] 171-32605 35 17.1-05 23 2655nannan0D2004AJ....127.3456D
DOH 7 171-32505 35 17.1-05 23 2555nannan0D2004AJ....127.3456D
DOH 7 175-32405 35 17.5-05 23 2455nannan0D2004AJ....127.3456D
GMR 205 35 17.57-05 23 25.066300.000300.00090D
.................................
V* V2370 Ori05 35 20.66-05 22 55.766150.000150.00090CO2009A&A...502..883R
[OW94] 133-32905 35 13.3-05 23 2955nannan0D2004AJ....127.3456D
V* V1399 Ori05 35 21.0498-05 23 49.04188300.000300.00090CM2011ApJ...733...50M
DOH 14 210-35105 35 21.0-05 23 5155nannan0D2004AJ....127.3456D
COUP J053521.2-05231605 35 21.239-05 23 16.9577nannan0D2000ApJ...540.1016L
[H97b] 2007205 35 16.91-05 22 28.466150.000150.00090CO2009A&A...502..883R
[OW94] 134-34205 35 13.4-05 23 4255nannan0DO2003AJ....125..277O
COUP J053519.1-05223405 35 19.12-05 22 34.666nannan0CO2009ApJS..183..261D
[SCB99] 18105 35 17.608-05 22 28.2477nannan0D1999AJ....117.1375S
CXOONC J053518.5-05223205 35 18.590-05 22 31.2377nannan0D2005ApJS..160..319G

In [5]:
co = coordinates.SkyCoord(l=31.0087, b=14.0627,
                          unit=(u.deg, u.deg),
                          frame='galactic')
result3 = Simbad.query_region(co)
result3


Out[5]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
NAME Barnard's star17 57 48.4980+04 41 36.2079915.10010.7200AO2007A&A...474..653V
TYC 425-262-117 57 51.948+04 42 20.257766.00058.0000BO2000A&A...355L..27H
1RXS J175749.5+04395517 57 49.505+04 39 55.0177nannan0D

There are also other query tools for some services, e.g. SIMBAD has a query_catalog feature that allows you to query named catalogs, e.g. the NGC catalog or the ESO catalog


In [6]:
Simbad.ROW_LIMIT = 100
esocat = Simbad.query_catalog('eso')
esocat


Out[6]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
2MASS J08300740-432546508 30 07.41-43 25 46.66660.00060.00090BI2003yCat.2246....0C
NGC 257301 41 35.091-89 20 04.1077nannan0BI2006AJ....131.1163S
ESO 1-205 04 36.8-87 34 19558000.0008000.00090D1982ESO...C......0L
ESO 1-305 22 36.509-87 50 50.0277nannan0BI2006AJ....131.1163S
ESO 1-407 49 28.813-87 56 00.7777nannan0BI2006AJ....131.1163S
ESO 1-508 53 05.006-88 05 23.0077nannan0BI2006AJ....131.1163S
ESO 1-614 27 20.694-87 46 20.0677nannan0BI2006AJ....131.1163S
ESO 1-717 02 45.879-88 55 01.9477nannan0BI2006AJ....131.1163S
ESO 1-823 07 33.618-89 06 59.0777nannan0BI2006AJ....131.1163S
ESO 1-923 12 28.499-89 07 34.4277nannan0BI2006AJ....131.1163S
NGC 257301 41 35.091-89 20 04.1077nannan0BI2006AJ....131.1163S
.................................
ESO 4-303 29 49.8-87 09 41558000.0008000.00090D1982ESO...C......0L
ESO 4-403 42 06.1-83 53 01558000.0008000.00090D1982ESO...C......0L
ESO 4-503 44 16.134-83 09 12.1777nannan0BI2006AJ....131.1163S
ESO 4-603 49 36.9-83 57 41558000.0008000.00090D1982ESO...C......0L
IC 205103 52 00.818-83 49 50.3277nannan0BI2006AJ....131.1163S
ESO 4-803 58 49.162-82 30 56.9977nannan0BI2006AJ....131.1163S
ESO 4-903 57 53.5-84 21 50558000.0008000.00090D1982ESO...C......0L
ESO 4-1003 59 49.135-84 05 37.8877nannan0BI2006AJ....131.1163S
ESO 4-1104 00 37.201-84 22 00.2077nannan0BI2006AJ....131.1163S
ESO 4-1204 22 19.590-85 22 38.9877nannan0BI2006AJ....131.1163S

In [36]:
ngccat = Simbad.query_catalog('ngc')
ngccat


Out[36]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
NGC 100 07 15.825+27 42 29.1377nannan0BI2006AJ....131.1163S
NGC 200 07 17.104+27 40 42.1377nannan0BI2006AJ....131.1163S
NGC 300 07 16.804+08 18 05.8477nannan0BI2006AJ....131.1163S
NGC 400 08 18.905+08 07 15.7977nannan0BI2006AJ....131.1163S
NGC 500 07 48.898+35 21 44.4677nannan0BI2006AJ....131.1163S
NGC 700 08 20.36-29 55 01.266nannan0D2003A&A...399..457S
NGC 800 08 45.3+23 50 2055nannan0D2000A&AS..144..475P
NGC 900 08 54.713+23 49 00.9277nannan0BI2006AJ....131.1163S
NGC 1000 08 34.535-33 51 29.9277nannan0BI2006AJ....131.1163S
NGC 1100 08 42.494+37 26 52.3977nannan0BI2006AJ....131.1163S
NGC 1200 08 44.752+04 36 45.1277nannan0BI2006AJ....131.1163S
.................................
NGC 8900 21 24.355-48 39 55.2877nannan0BI2006AJ....131.1163S
NGC 9000 21 51.409+22 24 00.1577nannan0BI2006AJ....131.1163S
2MASS J00215163+222205500 21 51.633+22 22 05.527770.00060.00090BI2003yCat.2246....0C
NGC 9200 21 31.713-48 37 29.2377nannan0BI2006AJ....131.1163S
NGC 9300 22 03.211+22 24 29.1577nannan0BI2006AJ....131.1163S
NGC 9400 22 13.516+22 28 59.2277nannan0BI2006AJ....131.1163S
NGC 9500 22 13.528+10 29 29.7377nannan0BI2006AJ....131.1163S
NGC 9600 22 17.697+22 32 46.2477nannan0BI2006AJ....131.1163S
NGC 9700 22 29.988+29 44 43.3477nannan0BI2006AJ....131.1163S
NGC 9800 22 49.518-45 16 08.4377nannan0BI2006AJ....131.1163S

In SIMBAD, you can also query a publication to find the sources


In [7]:
gins2012 = Simbad.query_bibobj('2012ApJ...758L..29G')
gins2012


Out[7]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODE
"h:m:s""d:m:s"masmasdeg
M 3100 42 44.330+41 16 07.5077nannan0BI2006AJ....131.1163S
NAME ONC05 35.0-05 2933nannan0E2007MmSAI..78..628M
Cl Westerlund 210 23 58.1-57 45 4955nannan0D2001MNRAS.326.1161M
Cl Trumpler 1410 43 56-59 33.044nannan0EO2009MNRAS.399.2146W
NGC 360311 15 09.1-61 16 17553000.0003000.00090D
NAME ARA CLUSTER16 47 04.00-45 51 04.966nannan0DO2008A&A...478..137B
NAME GAL CENTER17 45 40.04-29 00 28.166nannan0E
GAL 010.472+00.02618 08 38-19 51.944nannan0Es2012ApJ...758L..29G
GAL 012.209-00.10418 12 40-18 24.444nannan0Es2012ApJ...758L..29G
GAL 012.627-00.01618 13 11-17 59.844nannan0Es2012ApJ...758L..29G
SNR G012.8-00.218 14 14.0-17 55 50553000.0003000.00090D
.................................
OH 31.0 +0.018 47 40.97-01 44 55.46680.00080.00090BI2003yCat.2246....0C
GAL 030.820-00.05518 47 47-01 54.344nannan0Es2012ApJ...758L..29G
GAL 032.798+00.19318 50 30-00 01.944nannan0Es2012ApJ...758L..29G
GAL 034.258+00.15418 53 19+01 15.044nannan0Es2012ApJ...758L..29G
GAL 043.169+00.00919 10 14+09 06.344nannan0Es2012ApJ...758L..29G
W 4919 10 20+09 07.744nannan0E2003A&A...397..133R
GAL 043.164-00.03119 10 22+09 04.944nannan0Es2012ApJ...758L..29G
NAME W 51 IRS 219 23 39.9+14 31 0655nannan0D2002ApJ...566..880G
W 5119 23 42.0+14 30 33553000.0003000.00090D
NAME W 51 Main19 23 43.8+14 30 3755nannan0D1998A&AS..132..211H

Finally, you can modify the default parameters of the query tool, such as the TIMEOUT (the maximum wait time before deciding the query has failed) and the ROW_LIMIT (the maximum number of entries returned) by creating a new object. You can also tell SIMBAD to return additional information, e.g. the number of citations for each object.


In [8]:
customSimbad = Simbad()
customSimbad.ROW_LIMIT = 100
customSimbad.add_votable_fields('bibcodelist(1800-2014)')
gins2012b = customSimbad.query_bibobj('2012ApJ...758L..29G')
gins2012b


Out[8]:
MAIN_IDRADECRA_PRECDEC_PRECCOO_ERR_MAJACOO_ERR_MINACOO_ERR_ANGLECOO_QUALCOO_WAVELENGTHCOO_BIBCODEBIBLIST_1800_2014
"h:m:s""d:m:s"masmasdeg
M 3100 42 44.330+41 16 07.5077nannan0BI2006AJ....131.1163S7851
NAME ONC05 35.0-05 2933nannan0E2007MmSAI..78..628M1375
Cl Westerlund 210 23 58.1-57 45 4955nannan0D2001MNRAS.326.1161M157
Cl Trumpler 1410 43 56-59 33.044nannan0EO2009MNRAS.399.2146W299
NGC 360311 15 09.1-61 16 17553000.0003000.00090D704
NAME ARA CLUSTER16 47 04.00-45 51 04.966nannan0DO2008A&A...478..137B293
NAME GAL CENTER17 45 40.04-29 00 28.166nannan0E7030
GAL 010.472+00.02618 08 38-19 51.944nannan0Es2012ApJ...758L..29G1
GAL 012.209-00.10418 12 40-18 24.444nannan0Es2012ApJ...758L..29G1
GAL 012.627-00.01618 13 11-17 59.844nannan0Es2012ApJ...758L..29G1
SNR G012.8-00.218 14 14.0-17 55 50553000.0003000.00090D164
....................................
OH 31.0 +0.018 47 40.97-01 44 55.46680.00080.00090BI2003yCat.2246....0C94
GAL 030.820-00.05518 47 47-01 54.344nannan0Es2012ApJ...758L..29G1
GAL 032.798+00.19318 50 30-00 01.944nannan0Es2012ApJ...758L..29G1
GAL 034.258+00.15418 53 19+01 15.044nannan0Es2012ApJ...758L..29G1
GAL 043.169+00.00919 10 14+09 06.344nannan0Es2012ApJ...758L..29G1
W 4919 10 20+09 07.744nannan0E2003A&A...397..133R408
GAL 043.164-00.03119 10 22+09 04.944nannan0Es2012ApJ...758L..29G1
NAME W 51 IRS 219 23 39.9+14 31 0655nannan0D2002ApJ...566..880G193
W 5119 23 42.0+14 30 33553000.0003000.00090D892
NAME W 51 Main19 23 43.8+14 30 3755nannan0D1998A&AS..132..211H102

Archive Query Services

There are archive query services that return data in addition to catalogs. ESO is among these.

ESO

The ESO service has the following methods:

  • list_instruments to list the available instruments that can be queried
  • list_surveys lists the available large public surveys
  • query_instrument queries for data sets from a specific instrument
  • query_surveys does the same for surveys
  • get_headers gets header information for any datasets listed from a previous query
  • login logs you in with your username, which is required for any data retrieval (even public data)
  • retrieve_datasets or (deprecated) data_retrieval allows you to stage and download any data set your username is allowed to access

Queries are cached, so repeating them should be fast. Downloaded data is also cached to the Eso.cache_location


In [9]:
from astroquery.eso import Eso

In [10]:
Eso.list_instruments()


Out[10]:
[u'fors1',
 u'fors2',
 u'vimos',
 u'omegacam',
 u'hawki',
 u'isaac',
 u'naco',
 u'visir',
 u'vircam',
 u'apex',
 u'uves',
 u'giraffe',
 u'xshooter',
 u'crires',
 u'kmos',
 u'sinfoni',
 u'amber',
 u'midi']

In order to figure out how to construct a query, you can open the form directly


In [11]:
Eso.query_instrument('kmos', open_form=True)

or use the help keyword. The printout will then show what keywords correspond to each form name. For example, the keyword pi_coi corresponds to the form box PI/CoI Name.


In [12]:
Eso.query_instrument('kmos', help=True)


List of the column_filters parameters accepted by the kmos instrument query.
The presence of a column in the result table can be controlled if prefixed with a [ ] checkbox.
The default columns in the result table are shown as already ticked: [x].

Target Information
------------------
    target: 
    resolver: simbad (SIMBAD name), ned (NED name), none (OBJECT as specified by the observer)
    coord_sys: eq (Equatorial (FK5)), gal (Galactic)
    coord1: 
    coord2: 
    box: 
    format: sexagesimal (Sexagesimal), decimal (Decimal)
[x] wdb_input_file: 

Observation  and proposal parameters
------------------------------------
[ ] night: 
    stime: 
    starttime: 01 (01 hrs [UT]), 02 (02 hrs [UT]), 03 (03 hrs [UT]), 04 (04 hrs [UT]), 05 (05 hrs [UT]), 06 (06 hrs [UT]), 07 (07 hrs [UT]), 08 (08 hrs [UT]), 09 (09 hrs [UT]), 10 (10 hrs [UT]), 11 (11 hrs [UT]), 12 (12 hrs [UT]), 13 (13 hrs [UT]), 14 (14 hrs [UT]), 15 (15 hrs [UT]), 16 (16 hrs [UT]), 17 (17 hrs [UT]), 18 (18 hrs [UT]), 19 (19 hrs [UT]), 20 (20 hrs [UT]), 21 (21 hrs [UT]), 22 (22 hrs [UT]), 23 (23 hrs [UT]), 24 (24 hrs [UT])
    etime: 
    endtime: 01 (01 hrs [UT]), 02 (02 hrs [UT]), 03 (03 hrs [UT]), 04 (04 hrs [UT]), 05 (05 hrs [UT]), 06 (06 hrs [UT]), 07 (07 hrs [UT]), 08 (08 hrs [UT]), 09 (09 hrs [UT]), 10 (10 hrs [UT]), 11 (11 hrs [UT]), 12 (12 hrs [UT]), 13 (13 hrs [UT]), 14 (14 hrs [UT]), 15 (15 hrs [UT]), 16 (16 hrs [UT]), 17 (17 hrs [UT]), 18 (18 hrs [UT]), 19 (19 hrs [UT]), 20 (20 hrs [UT]), 21 (21 hrs [UT]), 22 (22 hrs [UT]), 23 (23 hrs [UT]), 24 (24 hrs [UT])
[x] prog_id: 
[ ] prog_type: % (Any), 0 (Normal), 1 (GTO), 2 (DDT), 3 (ToO), 4 (Large), 5 (Short), 6 (Calibration)
[ ] obs_mode: % (All modes), s (Service), v (Visitor)
[ ] pi_coi: 
    pi_coi_name: PI_only (as PI only), none (as PI or CoI)
[ ] prog_title: 

Generic File Information
------------------------
[x] dp_id: 
[x] ob_id: 
[x] obs_targ_name: 
[x] exptime: 
[x] dp_cat: % (Any), ACQUISITION (ACQUISITION), CALIB (CALIB), SCIENCE (SCIENCE)
[x] dp_type: % (Any), DARK% (DARK), FLAT% (any FLAT), FLAT_LAMP% (FLAT_LAMP), FLAT_OFF% (FLAT_OFF), FLAT_SKY% (FLAT_SKY), OBJECT% (any OBJECT), OBJECT_LOOKUP% (OBJECT_LOOKUP), OBJECT_SKY% (OBJECT_SKY), OBJECT_SKY_STD_FLUX% (OBJECT_SKY_STD_FLUX), SKY% (SKY), WAVE% (any WAVE), WAVE_LAMP% (WAVE_LAMP), WAVE_OFF% (WAVE_OFF)
[x] dp_tech: % (Any), IFU% (IFU), IMAGE% (IMAGE), SPECTRUM% (SPECTRUM)

Specific Instrument Information
-------------------------------
[x] ins_grat1_name: % (Any), IZ% (IZ), YJ% (YJ), H% (H), K% (K), HK% (HK)
[x] ins_filt1_name: % (Any), IZ% (IZ), YJ% (YJ), H% (H), K% (K), HK% (HK)
[x] ins_lamp1_name: 
[x] ins_lamp2_name: 
[x] ins_lamp3_name: 
[x] det_seq1_dit: 
[x] det_ndit: 

Ambient Parameters
------------------
[x] fwhm_avg: 
[ ] airmass_range: 
[ ] night_flag: % (Any), 0 (Night), 1 (Twilight), 2 (Daytime)
[ ] moon_illu: 

Result set
----------
    order:  (nothing (faster)), dp_id (Observation Time), dp_cat (DPR.CATG), dp_tech (DPR.TECH), tpl_start (TPL.START)

In [13]:
result = Eso.query_instrument('xshooter', pi_coi='manara')
result


Out[13]:
ObjectTarget Ra DecTarget l bProgIdDP.IDOB.IDOBS.TARG.NAMEEXPTIMEDPR.CATGDPR.TYPEDPR.TECHINS MODESEQ.ARMDET.READ.CLOCKINS.FILT1.NAMEINS.OPTI2.NAMEINS.OPTI3.NAMEINS.OPTI4.NAMEINS.OPTI5.NAMEDIMM S-avg
OBJECT05:35:21.04 -05:31:21.2209.145487 -19.427161288.C-5038(A)XSHOO.2012-02-26T02:41:35.429729629OM-11865.0ACQUISITIONOBJECTIMAGEIMAG--acetecE2V57I_ENG.clkVMIR5.0x115.0x115.0x111.08 [0.29]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:38:24.054729629OM-11861.0CALIBLAMP,AFCECHELLECALIBNIR--VPIN5.0x115.0x115.0x111.15 [0.43]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:37:50.587729629OM-118610.0CALIBLAMP,AFCECHELLECALIBUVB400k/1pt/lg/AFCVSLOTPin_0.5Pin_0.5Pin_0.51.07 [0.27]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:38:45.549729629OM-11861.0CALIBLAMP,AFCECHELLECALIBNIR--VPIN5.0x115.0x115.0x111.15 [0.43]
OBJECT05:35:21.05 -05:31:21.2209.145500 -19.427159288.C-5038(A)XSHOO.2012-02-26T02:42:39.138729629OM-11865.0ACQUISITIONOBJECTIMAGEIMAG--acetecE2V57I_ENG.clkVMIR5.0x115.0x115.0x111.06 [0.25]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:38:23.908729629OM-11860.5CALIBLAMP,AFCECHELLECALIBVIS400k/1pt/lg/AFCVPIN5.0x115.0x115.0x111.15 [0.43]
OM-118605:35:21.19 -05:31:22.5209.146118 -19.426783288.C-5038(A)XSHOO.2012-02-26T02:43:29.753729629OM-1186300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECUVB100k/1pt/hgVSLOT0.5x110.4x110.4x110.98 [0.01]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:38:22.688729629OM-118610.0CALIBLAMP,AFCECHELLECALIBUVB400k/1pt/lg/AFCVPIN5.0x115.0x115.0x111.15 [0.43]
LAMP,AFC05:35:20.98 -05:31:21.5209.145458 -19.427436288.C-5038(A)XSHOO.2012-02-26T02:37:51.806729629OM-11860.5CALIBLAMP,AFCECHELLECALIBVIS400k/1pt/lg/AFCVSLOTPin_0.5Pin_0.5Pin_0.51.07 [0.27]
OM-118605:35:21.19 -05:31:22.5209.146118 -19.426783288.C-5038(A)XSHOO.2012-02-26T02:43:38.418729629OM-1186150.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECNIR--VSLOT0.5x110.4x110.4x110.98 [0.01]
OBJECT05:35:21.05 -05:31:21.2209.145500 -19.427159288.C-5038(A)XSHOO.2012-02-26T02:42:08.839729629OM-11865.0ACQUISITIONOBJECTIMAGEIMAG--acetecE2V57I_ENG.clkVMIR5.0x115.0x115.0x111.08 [0.29]
............................................................
LAMP,AFC05:35:21.69 -05:34:46.9209.200829 -19.450582288.C-5038(A)XSHOO.2012-03-07T01:19:29.828729631OM-31251.0CALIBLAMP,AFCECHELLECALIBNIR--UPIN5.0x115.0x115.0x111.21 [0.51]
OM-312505:35:21.83 -05:34:47.2209.201195 -19.450099288.C-5038(A)XSHOO.2012-03-07T01:24:06.503729631OM-3125300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECVIS100k/1pt/hgVSLOT0.5x110.4x110.4x111.07 [0.29]
LAMP,AFC05:35:21.69 -05:34:46.9209.200829 -19.450582288.C-5038(A)XSHOO.2012-03-07T01:19:29.680729631OM-31250.5CALIBLAMP,AFCECHELLECALIBVIS400k/1pt/lg/AFCUPIN5.0x115.0x115.0x111.21 [0.51]
OM-312505:35:21.56 -05:34:44.3209.199891 -19.450737288.C-5038(A)XSHOO.2012-03-07T01:31:58.691729631OM-3125300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECVIS100k/1pt/hgVSLOT0.5x110.4x110.4x111.31 [0.64]
OM-312505:35:21.83 -05:34:47.2209.201195 -19.450099288.C-5038(A)XSHOO.2012-03-07T01:24:09.816729631OM-3125150.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECNIR--VSLOT0.5x110.4x110.4x111.10 [0.34]
OBJECT05:35:21.69 -05:34:45.7209.200538 -19.450416288.C-5038(A)XSHOO.2012-03-07T01:23:19.679729631OM-31253.0ACQUISITIONOBJECTIMAGEIMAG--acetecE2V57I_ENG.clkVMIR5.0x115.0x115.0x111.17 [0.45]
OM-312505:35:21.83 -05:34:47.2209.201195 -19.450099288.C-5038(A)XSHOO.2012-03-07T01:47:32.118729631OM-3125300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECUVB100k/1pt/hgVSLOT0.5x110.4x110.4x111.20 [0.50]
OM-312505:35:21.56 -05:34:44.3209.199891 -19.450737288.C-5038(A)XSHOO.2012-03-07T01:39:45.039729631OM-3125300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECVIS100k/1pt/hgVSLOT0.5x110.4x110.4x111.25 [0.58]
OM-312505:35:21.83 -05:34:47.2209.201195 -19.450099288.C-5038(A)XSHOO.2012-03-07T01:47:40.590729631OM-3125150.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECNIR--VSLOT0.5x110.4x110.4x111.21 [0.50]
OM-312505:35:21.83 -05:34:47.2209.201195 -19.450099288.C-5038(A)XSHOO.2012-03-07T01:47:37.329729631OM-3125300.0SCIENCEOBJECTECHELLE,SLIT,NODDINGSLITSPECVIS100k/1pt/hgVSLOT0.5x110.4x110.4x111.20 [0.50]
LAMP,AFC16:27:10.28 -24:19:12.7353.249489 16.838301089.C-0840(A)XSHOO.2012-04-15T05:27:37.673657274SR210.5CALIBLAMP,AFCECHELLECALIBVIS400k/1pt/lg/AFCVPIN5.0x115.0x115.0x111.00 [0.01]

In [14]:
result.colnames


Out[14]:
['Object',
 'Target Ra Dec',
 'Target l b',
 'ProgId',
 'DP.ID',
 'OB.ID',
 'OBS.TARG.NAME',
 'EXPTIME',
 'DPR.CATG',
 'DPR.TYPE',
 'DPR.TECH',
 'INS MODE',
 'SEQ.ARM',
 'DET.READ.CLOCK',
 'INS.FILT1.NAME',
 'INS.OPTI2.NAME',
 'INS.OPTI3.NAME',
 'INS.OPTI4.NAME',
 'INS.OPTI5.NAME',
 'DIMM S-avg']

A simple python trick: a set is an unordered collection of unique objects (just like in math). np.unique does the same thing, but returns a numpy array, which is ordered.


In [15]:
set(result['ProgId'])


Out[15]:
{'089.C-0840(A)', '288.C-5038(A)'}

The DP.ID row is the Data Product Identifier, which can be used to retrieve (download) the data


In [16]:
result['DP.ID']


Out[16]:
<MaskedColumn name='DP.ID' unit=None format=None description=None>
masked_array(data = ['XSHOO.2012-02-26T02:41:35.429' 'XSHOO.2012-02-26T02:38:24.054'
 'XSHOO.2012-02-26T02:37:50.587' 'XSHOO.2012-02-26T02:38:45.549'
 'XSHOO.2012-02-26T02:42:39.138' 'XSHOO.2012-02-26T02:38:23.908'
 'XSHOO.2012-02-26T02:43:29.753' 'XSHOO.2012-02-26T02:38:22.688'
 'XSHOO.2012-02-26T02:37:51.806' 'XSHOO.2012-02-26T02:43:38.418'
 'XSHOO.2012-02-26T02:42:08.839' 'XSHOO.2012-02-26T02:43:34.973'
 'XSHOO.2012-02-26T02:42:55.629' 'XSHOO.2012-02-26T02:38:45.971'
 'XSHOO.2012-02-26T02:38:44.751' 'XSHOO.2012-02-26T02:37:51.679'
 'XSHOO.2012-02-26T02:42:23.898' 'XSHOO.2012-02-26T03:07:05.077'
 'XSHOO.2012-02-26T02:59:12.608' 'XSHOO.2012-02-26T03:06:59.866'
 'XSHOO.2012-02-26T02:59:15.600' 'XSHOO.2012-02-26T02:51:30.009'
 'XSHOO.2012-02-26T02:51:21.971' 'XSHOO.2012-02-26T02:59:07.438'
 'XSHOO.2012-02-26T03:07:07.855' 'XSHOO.2012-02-26T02:51:27.191'
 'XSHOO.2012-03-07T01:18:53.618' 'XSHOO.2012-03-07T01:18:54.730'
 'XSHOO.2012-03-07T01:24:01.322' 'XSHOO.2012-03-07T01:19:28.460'
 'XSHOO.2012-03-07T01:32:01.407' 'XSHOO.2012-03-07T01:23:08.218'
 'XSHOO.2012-03-07T01:22:57.099' 'XSHOO.2012-03-07T01:39:48.331'
 'XSHOO.2012-03-07T01:31:53.481' 'XSHOO.2012-03-07T01:23:30.828'
 'XSHOO.2012-03-07T01:18:54.838' 'XSHOO.2012-03-07T01:39:39.819'
 'XSHOO.2012-03-07T01:22:29.459' 'XSHOO.2012-03-07T01:19:29.828'
 'XSHOO.2012-03-07T01:24:06.503' 'XSHOO.2012-03-07T01:19:29.680'
 'XSHOO.2012-03-07T01:31:58.691' 'XSHOO.2012-03-07T01:24:09.816'
 'XSHOO.2012-03-07T01:23:19.679' 'XSHOO.2012-03-07T01:47:32.118'
 'XSHOO.2012-03-07T01:39:45.039' 'XSHOO.2012-03-07T01:47:40.590'
 'XSHOO.2012-03-07T01:47:37.329' 'XSHOO.2012-04-15T05:27:37.673'],
             mask = [False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False False False False False False False False False False False
 False False],
       fill_value = N/A)

Eso.login will log you in with your username. It uses the keyring package to store your username/password if you so choose. If not, you will be asked to enter your password.

Warning: If you're using an ipython notebook, the password entry form will appear in the terminal, not in the notebook!


In [17]:
Eso.login('aginsburg')


Authenticating aginsburg on www.eso.org...
Authentication successful!
Out[17]:
True

In [18]:
headers = Eso.get_headers(result['DP.ID'][0:1])

In [19]:
Eso.data_retrieval(result['DP.ID'][0:1])


Found XSHOO.2012-02-26T02:41:35.429.fits...
Done!
Out[19]:
[u'/Users/adam/.astropy/cache/astroquery/Eso/XSHOO.2012-02-26T02:41:35.429.fits']

Line List Tools

The LAMDA, Splatalogue, and NIST services query online resources related to spectroscopic lines.


In [20]:
from astroquery.nist import Nist

In [21]:
table = Nist.query(4000 * u.AA, 7000 * u.AA, linename="H I")
table


Out[21]:
ObservedRitzRel.AkifikAcc.Ei EkLower levelUpper levelTypeTPLine
--4102.85985516--4287700.00.021641AAA10.19880570432 - T8637 |----------
--4102.86191086--245010.00.00061831AAA10.19880570432 - 13.220701047272p | 2P* | 1/26s | 2S | 1/2--T8637--
--4102.8632----------| || |----c57
4102.865034814102.86503481--------10.19881007922431 - 13.220703121292s | 2S | 1/26d | 2D | 5/2E2--L11759
--4102.86579134--2858300.00.014427AAA10.19881007922431 - T8637 |----------
4102.867850744102.86785074--------10.19881007922431 - 13.220701047272s | 2S | 1/26s | 2S | 1/2M1--L11759
--4102.86807252--2858400.00.0072136AAA10.19881007922431 - T8637 |----------
4102.8924102.899170000973200.00.022105AAA10.1988353 - 13.220703312 | |6 | |--T8637L7436c29
--4102.8922----------| || |----c58
--4102.92068748--5145000.00.019477AAA10.19885106866 - 13.220703121292p | 2P* | 3/26d | 2D | 5/2--T8637--
--4102.9208----------| || |----c59
....................................
--6564.564672--2104600.00.013597AAA10.19880570432 - 12.08749443262p | 2P* | 1/23s | 2S | 1/2--T8637--
--6564.579878--------10.19881007922431 - 12.08749443262s | 2S | 1/23s | 2S | 1/2M1----
--6564.583----------| || |----c66
6564.5844046564.584403--22449000.00.14503AAA10.19881007922431 - 12.08749313062s | 2S | 1/23p | 2P* | 1/2--T8637L6891c38
6564.66564.63250000044101000.00.64108AAA10.1988353 - 12.08750462 | |3 | |--T8637L7400c29
--6564.608----------| || |----c69
6564.664646564.66466--64651000.00.62654AAA10.19885106866 - 12.08751102972p | 2P* | 3/23d | 2D | 5/2--T8637L2752
--6564.6662----------| || |----c71
--6564.667----------| || |----c70
--6564.680232--10775000.00.069616AAA10.19885106866 - 12.08750654982p | 2P* | 3/23d | 2D | 3/2--T8637--
--6564.722349--4209700.00.013599AAA10.19885106866 - 12.08749443262p | 2P* | 3/23s | 2S | 1/2--T8637--

In [22]:
from astroquery.splatalogue import Splatalogue

Splatalogue provides access to mm lines.


In [23]:
just_CO = Splatalogue.get_species_ids(' CO ') # note the spaces
just_CO


Out[23]:
{u'02812 CO v = 0 - Carbon Monoxide': u'204',
 u'02813 CO v = 1 - Carbon Monoxide': u'990',
 u'02814 CO v = 2 - Carbon Monoxide': u'991',
 u'02815 CO v = 3 - Carbon Monoxide': u'1343'}

In [24]:
CO2to1 = Splatalogue.query_lines(1*u.mm, 2*u.mm, chemical_name=" CO ",
                                 only_NRAO_recommended=True,
                                 energy_max=50, energy_type='eu_k')
CO2to1


Out[24]:
SpeciesChemical NameFreq-GHzFreq ErrMeas Freq-GHzMeas Freq ErrResolved QNsCDMS/JPL IntensityS<sub>ij</sub>Log<sub>10</sub> (A<sub>ij</sub>)Lovas/AST IntensityE_L (cm^-1)E_L (K)E_U (cm^-1)E_U (K)Linelist
COv=0Carbon Monoxide230.5380230.5381e-062-10.02.0-6.1601170.03.8455.5320711.5349216.59608SLAIM

Vizier

Vizier is the main depository of published catalogs. It provides some very powerful interfaces including an x-match (cross-matching) service.

Vizier queries return TableLists of tables instead of individual tables.


In [25]:
from astroquery.vizier import Vizier

In [26]:
velocity_catalogs = Vizier(columns=['all'], ucd='(spect.dopplerVeloc*|phys.veloc*)',
                           keywords=['Radio','IR'], row_limit=500)
velocity_catalogs


Out[26]:
<astroquery.vizier.core.VizierClass at 0x10c12e250>

A particularly powerful example - search for guide stars within a set radius of your target sources.

The following queries only a specific catalog of AGN - VII/258/vv10 - for sources with $10 < M_V < 11$.

Note the trailing [0] because the return is a TableList


In [27]:
agn = Vizier(catalog="VII/258/vv10").query_constraints(Vmag="10.0..11.0")[0]
agn


/Users/adam/repos/astroquery/astroquery/vizier/core.py:543: UserWarning: VOTABLE parsing raised exception: 
  warnings.warn("VOTABLE parsing raised exception: {0}".format(ex))
Out[27]:
_RAJ2000_DEJ2000ClnRNamen_RAJ2000RAJ2000DEJ2000l_zzSpn_VmagVmagB-Vr_z
degdeg"h:m:s""d:m:s"magmag
10.684641.2694QM 31O00 42 44.3+41 16 100.000S210.571.081936
60.2779-16.1108QNPM1G-16.0168O04 01 06.7-16 06 390.031R10.16nan988
27.23875.9067A*NGC 67601 48 57.3+05 54 240.005S210.50nan1034
40.6696-0.0131ANGC 1068O02 42 40.7-00 00 470.003S1h10.830.8758
139.759626.2697ANGC 2824O09 19 02.3+26 16 110.008S?10.88nan2528
147.592172.2792ANGC 2985O09 50 22.1+72 16 450.004S1.910.610.761033
173.144253.0678ANGC 3718O11 32 34.6+53 04 040.003S3b10.610.741033
184.960829.6139AUGC 7377O12 19 50.6+29 36 500.003S310.470.992500
185.028729.2808ANGC 4278O12 20 06.9+29 16 510.002S3b10.870.981033
186.453733.5467ANGC 4395O12 25 48.9+33 32 480.001S1.810.270.531033
192.719641.1194ANGC 4736O12 50 52.7+41 07 100.001S10.850.851032
208.361240.2831ANGC 5353O13 53 26.7+40 16 590.008S?R10.91nan368

The guide star catalog, II/246, is then queried with the restriction that the guide star must have $M_K<9$ around the selected AGN, given that the distance between the guide star and the AGN is $2" < r < 30"$.


In [28]:
guide = Vizier(catalog="II/246", column_filters={"Kmag":"<9.0"}).query_region(agn, radius="30s", inner_radius="2s")[0]
guide


WARNING: MergeConflictWarning: Cannot merge meta key u'null' types <type 'float'> and <type 'float'>, choosing null=nan [astropy.utils.metadata]
WARNING:astropy:MergeConflictWarning: Cannot merge meta key u'null' types <type 'float'> and <type 'float'>, choosing null=nan
Out[28]:
_q_RAJ2000_DEJ2000RAJ2000DEJ2000_2MASSJmage_JmagHmage_HmagKmage_KmagQflgRflgBflgCflgXflgAflg
degdegdegdegmagmagmagmagmagmag
110.68601541.26963010.68601541.26963000424464+41161069.399nan9.9850.0708.429nanUEU0200200c020
110.68565741.26955010.68565741.26955000424455+411610310.7730.0698.532nan8.254nanEUU200200c0020
110.68583741.27059910.68583741.27059900424460+41161419.880nan12.0510.0688.934nanUAU0200200c020
110.68326341.26745610.68326341.26745600424398+411602812.1360.0409.226nan8.994nanAUU200100c0020
110.68346541.26967610.68346541.26967600424403+411610811.5070.0568.744nan8.489nanEUU200100c0020
327.2386365.90606627.2386365.90606601485727+05542188.9610.0278.6070.0448.5810.034AAA11211100000
440.669277-0.01422540.669277-0.01422502424062-000051211.7950.0238.801nan7.780nanEUU200100c0020
440.668802-0.01306440.668802-0.01306402424051-000047011.8490.0248.747nan8.223nanEUU200100c0020
440.669219-0.01223640.669219-0.01223602424061-000044012.2760.0249.101nan8.167nanEUU200100c0020
440.670761-0.01220840.670761-0.01220802424098-000043912.1190.0709.442nan8.886nanEUU200100c0020
440.670177-0.01283040.670177-0.01283002424084-000046111.3810.1738.636nan8.112nanEUU200100c0020
11192.72198241.121040192.72198241.12104012505327+410715710.8220.0378.539nan8.242nanEUU200100c0020
11192.72117941.120201192.72117941.12020112505308+41071279.3060.0558.7420.0748.4920.067EEE22211100020

The only requirement for this type of query is that the target catalog (agn in the above example) contain the columns _RAJ2000 and _DEJ2000, which all Vizier tables do by default. You can make your own from any valid coordinate set.


In [29]:
from astropy import table

In [30]:
# Some well-known Galactic objects
coordinate_list = coordinates.SkyCoord([(0.0,0.0),(49.488,-0.39),(43.1,0.07)] * u.deg, frame='galactic')
coordinate_list


Out[30]:
<SkyCoord (Galactic): (l, b) in deg
    [(0.0, 0.0), (49.488, -0.39), (43.1, 0.07)]>

In [31]:
coord_tbl = table.Table(data=[coordinate_list.fk5.ra.deg,
                              coordinate_list.fk5.dec.deg],
                        names=('_RAJ2000', '_DEJ2000')
                        )
coord_tbl['_RAJ2000'].unit = u.deg
coord_tbl['_DEJ2000'].unit = u.deg
coord_tbl


Out[31]:
_RAJ2000_DEJ2000
degdeg
266.404929574-28.9362178833
290.93439529314.5067674093
287.4719758939.07173444604

In [32]:
vlbacal = Vizier.find_catalogs('Petrov VLBA Calibrator')
{k:v.description for k,v in vlbacal.iteritems()}


Out[32]:
{u'J/AJ/126/2562': u'Second VLBA calibrator survey: VCS2 (Fomalont+, 2003)',
 u'J/AJ/129/1163': u'Third VLBA calibrator survey: VCS3 (Petrov+, 2005)',
 u'J/AJ/131/1872': u'Fourth VLBA calibrator survey: VCS4 (Petrov+, 2006)',
 u'J/AJ/133/1236': u'Fifth VLBA calibrator survey: VCS5 (Kovalev+, 2007)',
 u'J/AJ/136/580': u'Sixth VLBA calibrator survey: VCS6 (Petrov+, 2008)',
 u'J/ApJS/141/13': u'VLBA calibrator survey: VCS1 catalog (Beasley+, 2002)'}

In [33]:
vlbacal_matches = Vizier(catalog=vlbacal.keys()).query_region(coord_tbl, radius=2*u.deg)
vlbacal_matches


Out[33]:
TableList with 4 tables:
	'0:J/AJ/131/1872/table2' with 11 column(s) and 1 row(s) 
	'1:J/AJ/133/1236/table2' with 7 column(s) and 1 row(s) 
	'2:J/ApJS/141/13/table2' with 11 column(s) and 2 row(s) 
	'3:J/AJ/129/1163/table2' with 12 column(s) and 1 row(s) 

In [34]:
vlbacal_matches[0]


Out[34]:
_q_RAJ2000_DEJ2000IVSVCS4RAJ2000e_RAJ2000DEJ2000e_DEJ2000NobsBand
degdeg"h:m:s"mas"d:m:s"mas
4268.137946-29.9458061749-299J1752-295617 52 33.10705012.28-29 56 44.9001719.416X/S

In [35]:
vlbacal_matches[2]


Out[35]:
_q_RAJ2000_DEJ2000VCS1IVSRAJ2000DEJ2000e_RAJ2000e_DEJ2000CorrNum
degdeg"h:m:s""d:m:s"masmas
11290.64458115.502787J1922+15301920+15419 22 34.699349+15 30 10.032661.23341.1451-0.006053
11291.16439915.678873J1924+15401922+15519 24 39.455874+15 40 43.941110.57300.6869-0.062470