Skip to content

Commit

Permalink
Make the MAIN_GAIA_TABLE option work
Browse files Browse the repository at this point in the history
It is now possible to change the table Gaia queries are made from
through the MAIN_GAIA_TABLE config item or class attribute at runtime.
If the class attribute is specified then it will take precedence over
the config item.
  • Loading branch information
eerovaher committed Sep 30, 2021
1 parent 12b0359 commit 561011f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,12 @@ casda
- Add ability to stage and download non image data which have been found
through the CASDA obscore table. [#2158]

gaia
^^^^

- The bug which caused changing the ``MAIN_GAIA_TABLE`` option to have no
effect has been fixed [#2153]

vizier
^^^^^^

Expand Down
12 changes: 6 additions & 6 deletions astroquery/gaia/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class GaiaClass(TapPlus):
"""
Proxy class to default TapPlus object (pointing to Gaia Archive)
"""
MAIN_GAIA_TABLE = conf.MAIN_GAIA_TABLE
MAIN_GAIA_TABLE = None
MAIN_GAIA_TABLE_RA = conf.MAIN_GAIA_TABLE_RA
MAIN_GAIA_TABLE_DEC = conf.MAIN_GAIA_TABLE_DEC
ROW_LIMIT = conf.ROW_LIMIT
Expand Down Expand Up @@ -427,7 +427,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
dist ASC
""".format(**{'row_limit': "TOP {0}".format(self.ROW_LIMIT) if self.ROW_LIMIT > 0 else "",
'ra_column': self.MAIN_GAIA_TABLE_RA, 'dec_column': self.MAIN_GAIA_TABLE_DEC,
'columns': columns, 'table_name': self.MAIN_GAIA_TABLE, 'ra': ra, 'dec': dec,
'columns': columns, 'table_name': self.MAIN_GAIA_TABLE or conf.MAIN_GAIA_TABLE, 'ra': ra, 'dec': dec,
'width': widthDeg.value, 'height': heightDeg.value})
if async_job:
job = self.launch_job_async(query, verbose=verbose)
Expand Down Expand Up @@ -487,7 +487,7 @@ def query_object_async(self, coordinate, radius=None, width=None,
"""
return self.__query_object(coordinate, radius, width, height, async_job=True, verbose=verbose, columns=columns)

def __cone_search(self, coordinate, radius, table_name=MAIN_GAIA_TABLE,
def __cone_search(self, coordinate, radius, table_name=None,
ra_column_name=MAIN_GAIA_TABLE_RA,
dec_column_name=MAIN_GAIA_TABLE_DEC,
async_job=False,
Expand Down Expand Up @@ -564,7 +564,7 @@ def __cone_search(self, coordinate, radius, table_name=MAIN_GAIA_TABLE,
""".format(**{'ra_column': ra_column_name,
'row_limit': "TOP {0}".format(self.ROW_LIMIT) if self.ROW_LIMIT > 0 else "",
'dec_column': dec_column_name, 'columns': columns, 'ra': ra, 'dec': dec,
'radius': radiusDeg, 'table_name': table_name})
'radius': radiusDeg, 'table_name': table_name or self.MAIN_GAIA_TABLE or conf.MAIN_GAIA_TABLE})

if async_job:
return self.launch_job_async(query=query,
Expand All @@ -581,7 +581,7 @@ def __cone_search(self, coordinate, radius, table_name=MAIN_GAIA_TABLE,
dump_to_file=dump_to_file)

def cone_search(self, coordinate, radius=None,
table_name=MAIN_GAIA_TABLE,
table_name=None,
ra_column_name=MAIN_GAIA_TABLE_RA,
dec_column_name=MAIN_GAIA_TABLE_DEC,
output_file=None,
Expand Down Expand Up @@ -632,7 +632,7 @@ def cone_search(self, coordinate, radius=None,
dump_to_file=dump_to_file, columns=columns)

def cone_search_async(self, coordinate, radius=None,
table_name=MAIN_GAIA_TABLE,
table_name=None,
ra_column_name=MAIN_GAIA_TABLE_RA,
dec_column_name=MAIN_GAIA_TABLE_DEC,
background=False,
Expand Down

0 comments on commit 561011f

Please sign in to comment.