Skip to content

Commit 561011f

Browse files
committed
Make the MAIN_GAIA_TABLE option work
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.
1 parent 12b0359 commit 561011f

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

CHANGES.rst

+6
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,12 @@ casda
1616
- Add ability to stage and download non image data which have been found
1717
through the CASDA obscore table. [#2158]
1818

19+
gaia
20+
^^^^
21+
22+
- The bug which caused changing the ``MAIN_GAIA_TABLE`` option to have no
23+
effect has been fixed [#2153]
24+
1925
vizier
2026
^^^^^^
2127

astroquery/gaia/core.py

+6-6
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class GaiaClass(TapPlus):
3939
"""
4040
Proxy class to default TapPlus object (pointing to Gaia Archive)
4141
"""
42-
MAIN_GAIA_TABLE = conf.MAIN_GAIA_TABLE
42+
MAIN_GAIA_TABLE = None
4343
MAIN_GAIA_TABLE_RA = conf.MAIN_GAIA_TABLE_RA
4444
MAIN_GAIA_TABLE_DEC = conf.MAIN_GAIA_TABLE_DEC
4545
ROW_LIMIT = conf.ROW_LIMIT
@@ -427,7 +427,7 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
427427
dist ASC
428428
""".format(**{'row_limit': "TOP {0}".format(self.ROW_LIMIT) if self.ROW_LIMIT > 0 else "",
429429
'ra_column': self.MAIN_GAIA_TABLE_RA, 'dec_column': self.MAIN_GAIA_TABLE_DEC,
430-
'columns': columns, 'table_name': self.MAIN_GAIA_TABLE, 'ra': ra, 'dec': dec,
430+
'columns': columns, 'table_name': self.MAIN_GAIA_TABLE or conf.MAIN_GAIA_TABLE, 'ra': ra, 'dec': dec,
431431
'width': widthDeg.value, 'height': heightDeg.value})
432432
if async_job:
433433
job = self.launch_job_async(query, verbose=verbose)
@@ -487,7 +487,7 @@ def query_object_async(self, coordinate, radius=None, width=None,
487487
"""
488488
return self.__query_object(coordinate, radius, width, height, async_job=True, verbose=verbose, columns=columns)
489489

490-
def __cone_search(self, coordinate, radius, table_name=MAIN_GAIA_TABLE,
490+
def __cone_search(self, coordinate, radius, table_name=None,
491491
ra_column_name=MAIN_GAIA_TABLE_RA,
492492
dec_column_name=MAIN_GAIA_TABLE_DEC,
493493
async_job=False,
@@ -564,7 +564,7 @@ def __cone_search(self, coordinate, radius, table_name=MAIN_GAIA_TABLE,
564564
""".format(**{'ra_column': ra_column_name,
565565
'row_limit': "TOP {0}".format(self.ROW_LIMIT) if self.ROW_LIMIT > 0 else "",
566566
'dec_column': dec_column_name, 'columns': columns, 'ra': ra, 'dec': dec,
567-
'radius': radiusDeg, 'table_name': table_name})
567+
'radius': radiusDeg, 'table_name': table_name or self.MAIN_GAIA_TABLE or conf.MAIN_GAIA_TABLE})
568568

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

583583
def cone_search(self, coordinate, radius=None,
584-
table_name=MAIN_GAIA_TABLE,
584+
table_name=None,
585585
ra_column_name=MAIN_GAIA_TABLE_RA,
586586
dec_column_name=MAIN_GAIA_TABLE_DEC,
587587
output_file=None,
@@ -632,7 +632,7 @@ def cone_search(self, coordinate, radius=None,
632632
dump_to_file=dump_to_file, columns=columns)
633633

634634
def cone_search_async(self, coordinate, radius=None,
635-
table_name=MAIN_GAIA_TABLE,
635+
table_name=None,
636636
ra_column_name=MAIN_GAIA_TABLE_RA,
637637
dec_column_name=MAIN_GAIA_TABLE_DEC,
638638
background=False,

0 commit comments

Comments
 (0)