示例#1
0
def list_remotes():
    """List available tables in Gaia catalogues.

    Returns
    -------
    tables : list of str
        Available tables names
    """
    available_tables = Gaia.load_tables()
    names = []
    for table in available_tables:
        name = table.get_qualified_name()
        index = name.index(".") + 1
        name = name[index:]
        names.append(name)
    return names
示例#2
0
#
# > Running this import statement has the effect of creating a [TAP+](http://www.ivoa.net/documents/TAP/) connection; TAP stands for "Table Access Protocol".  It is a network protocol for sending queries to the database and getting back the results.  We're not sure why it seems to create two connections.

# ## Databases and Tables
#
# What is a database, anyway?  Most generally, it can be any collection of data, but when we are talking about ADQL or SQL:
#
# * A database is a collection of one or more named tables.
#
# * Each table is a 2-D array with one or more named columns of data.
#
# We can use `Gaia.load_tables` to get the names of the tables in the Gaia database.  With the option `only_names=True`, it loads information about the tables, called the "metadata", not the data itself.

# In[3]:

tables = Gaia.load_tables(only_names=True)

# In[4]:

for table in (tables):
    print(table.get_qualified_name())

# So that's a lot of tables.  The ones we'll use are:
#
# * `gaiadr2.gaia_source`, which contains Gaia data from [data release 2](https://www.cosmos.esa.int/web/gaia/data-release-2),
#
# * `gaiadr2.panstarrs1_original_valid`, which contains the photometry data we'll use from PanSTARRS, and
#
# * `gaiadr2.panstarrs1_best_neighbour`, which we'll use to cross-match each star observed by Gaia with the same star observed by PanSTARRS.
#
# We can use `load_table` (not `load_tables`) to get the metadata for a single table.  The name of this function is misleading, because it only downloads metadata.
示例#3
0
 def list_tables(self, table=None):
     if self.available_tables is None:
         self.available_tables = Gaia.load_tables()
     return [table.get_qualified_name() for table in self.available_tables]