In [3]:
from astroquery.utils.tap.core import TapPlus

In [4]:
tap = TapPlus(url='http://datalab.noao.edu/tap')


Created TAP+ (v1.0.1) - Connection:
	Host: datalab.noao.edu
	Use HTTPS: False
	Port: 80
	SSL Port: 443

In [5]:
tbl = tap.load_tables()


Retrieving tables...
Parsing tables...
Done.

In [13]:
for t in tbl:
    if t.get_name() == 'ls_dr5.bricks':
        print(t)


TAP Table name: ls_dr5.ls_dr5.bricks
Description: Table with RA, DEC bounds of each geometrical brick on the sky
Num. columns: 14

In [17]:
t = tap.launch_job(adql)


Launched query: 'select  TOP 2000 * from ls_dr5.bricks as target where 
CONTAINS(POINT('ICRS', target.ra, target.dec), CIRCLE('ICRS', 0.3, -3.5, 1.))'
Retrieving sync. results...
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-17-f309939539cf> in <module>()
----> 1 t = tap.launch_job(adql)

/usr/lib/python3.6/site-packages/astroquery/utils/tap/core.py in launch_job(self, query, name, output_file, output_format, verbose, dump_to_file, upload_resource, upload_table_name)
    229                 self.__connHandler.dump_to_file(suitableOutputFile, response)
    230             else:
--> 231                 results = utils.read_http_response(response, output_format)
    232                 job.set_results(results)
    233             print("Query finished.")

/usr/lib/python3.6/site-packages/astroquery/utils/tap/xmlparser/utils.py in read_http_response(response, outputFormat)
     39         # If we want to use astropy.table, we have to read the data
     40         data = io.BytesIO(response.read())
---> 41         return APTable.read(data, format=astropyFormat)
     42 
     43 

/usr/lib64/python3.6/site-packages/astropy/table/table.py in read(cls, *args, **kwargs)
   2529         passed through to the underlying data reader (e.g. `~astropy.io.ascii.read`).
   2530         """
-> 2531         out = io_registry.read(cls, *args, **kwargs)
   2532         # For some readers (e.g., ascii.ecsv), the returned `out` class is not
   2533         # guaranteed to be the same as the desired output `cls`.  If so,

/usr/lib64/python3.6/site-packages/astropy/io/registry.py in read(cls, format, *args, **kwargs)
    515 
    516         reader = get_reader(format, cls)
--> 517         data = reader(*args, **kwargs)
    518 
    519         if not isinstance(data, cls):

/usr/lib64/python3.6/site-packages/astropy/io/votable/connect.py in read_table_votable(input, table_id, use_names_over_ids)
    106             table = tables[0]
    107         else:
--> 108             raise ValueError("No table found")
    109     elif isinstance(input, VOTable):
    110         table = input

ValueError: No table found

In [ ]:
t = tap.launch_job

In [16]:
adql = """select * from ls_dr5.bricks as target where 
CONTAINS(POINT('ICRS', target.ra, target.dec), CIRCLE('ICRS', 0.3, -3.5, 1.))"""

In [30]:
from astroquery.vo_conesearch import conesearch

In [31]:
conesearch.list_catalogs()


Out[31]:
['SDSS DR7 - Sloan Digital Sky Survey Data Release 7 1',
 'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 2',
 'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 3',
 'SDSS DR7 - Sloan Digital Sky Survey Data Release 7 4',
 'SDSS DR8 - Sloan Digital Sky Survey Data Release 8 2',
 'The HST Guide Star Catalog, Version 1.1 (Lasker+ 1992) 1',
 'The HST Guide Star Catalog, Version 1.2 (Lasker+ 1996) 1',
 'The HST Guide Star Catalog, Version GSC-ACT (Lasker+ 1996-99) 1',
 'The PMM USNO-A1.0 Catalogue (Monet 1997) 1',
 'The USNO-A2.0 Catalogue (Monet+ 1998) 1',
 'Two Micron All Sky Survey (2MASS) 1',
 'Two Micron All Sky Survey (2MASS) 2',
 'USNO-A2 Catalogue 1']

In [35]:
from astroquery.vo_conesearch.validator import conf as validator_conf

In [37]:
import warnings
from astroquery.vo_conesearch.validator import conf as validator_conf
from astroquery.vo_conesearch.vos_catalog import VOSDatabase
with warnings.catch_warnings():
    warnings.simplefilter('ignore')
    registry_db = VOSDatabase.from_registry(
        validator_conf.conesearch_master_list, encoding='binary',
        cache=False)


Downloading http://vao.stsci.edu/directory/NVORegInt.asmx/VOTCapabilityPredOpt?predicate=1%3D1&capability=conesearch&VOTStyleOption=2 [Done]

In [ ]:


In [38]:
len(registry_db)


Out[38]:
19239

In [45]:
catalogs = registry_db.list_catalogs()

In [64]:
xvoc = registry_db.get_catalog('VVV Survey Band Merged JHKs 1')

In [63]:


In [66]:
for s in catalogs:
    if 'mapper' in s.lower():
        print(s)


SkyMapper Survey metal-poor star spectroscopy (Jacobson+, 2015) 1
redMaPPer. I. Algorithm applied to SDSS DR8 (Rykoff+, 2014) 1
redMaPPer. I. Algorithm applied to SDSS DR8 (Rykoff+, 2014) 2

In [50]:
from astropy import coordinates as coord
from astropy import units as u
from astroquery.vo_conesearch import vos_catalog

In [57]:
c = coord.SkyCoord.from_name('47 Tuc')
sr = 0.5 * u.degree
with warnings.catch_warnings():
    warnings.simplefilter('ignore')
    result = vos_catalog.call_vo_service(
        'conesearch_good',
        kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr.value},
        catalog_db=registry_db.get_catalog('Properties of metal-poor stars in APOGEE DR13 (Hayes+, 2018) 1'),
        verbose=False)


---------------------------------------------------------------------------
VOSError                                  Traceback (most recent call last)
<ipython-input-57-1334ca264cc8> in <module>()
      7         kwargs={'RA': c.ra.degree, 'DEC': c.dec.degree, 'SR': sr.value},
      8         catalog_db=registry_db.get_catalog('Properties of metal-poor stars in APOGEE DR13 (Hayes+, 2018) 1'),
----> 9         verbose=False)

/usr/lib/python3.6/site-packages/astroquery/vo_conesearch/vos_catalog.py in call_vo_service(service_type, catalog_db, pedantic, verbose, cache, kwargs)
    907     if n_timed_out > 0:
    908         err_msg += ' ({0} URL(s) timed out.)'.format(n_timed_out)
--> 909     raise VOSError(err_msg)
    910 
    911 

VOSError: None of the available catalogs returned valid results.

In [55]:
vos_catalog.call_vo_service?

In [59]:
registry_db.to_json('vo_registry.db.json')

In [ ]: