From f34c29495ad720edee485a5646359fc1b2ecd958 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 09:34:33 -0600 Subject: [PATCH 1/6] turn the GAIA parameters into config items --- astroquery/gaia/__init__.py | 7 +++++++ astroquery/gaia/core.py | 8 +++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/astroquery/gaia/__init__.py b/astroquery/gaia/__init__.py index 7d5a4c6ab3..6a6d4991cf 100644 --- a/astroquery/gaia/__init__.py +++ b/astroquery/gaia/__init__.py @@ -25,6 +25,13 @@ class Conf(_config.ConfigNamespace): """ pass + MAIN_GAIA_TABLE = _config.ConfigItem("gaiadr1.gaia_source", + "GAIA source data table") + MAIN_GAIA_TABLE_RA = _config.ConfigItem("ra", + "Name of RA parameter in table") + MAIN_GAIA_TABLE_DEC = _config.ConfigItem("dec", + "Name of Dec parameter in table") + conf = Conf() diff --git a/astroquery/gaia/core.py b/astroquery/gaia/core.py index 93c790f5f7..eac4209338 100644 --- a/astroquery/gaia/core.py +++ b/astroquery/gaia/core.py @@ -20,11 +20,10 @@ from astropy import units from astropy.units import Quantity +from . import conf + __all__ = ['Gaia', 'GaiaClass'] -MAIN_GAIA_TABLE = "gaiadr1.gaia_source" -MAIN_GAIA_TABLE_RA = "ra" -MAIN_GAIA_TABLE_DEC = "dec" class GaiaClass(object): @@ -32,6 +31,9 @@ class GaiaClass(object): """ Proxy class to default TapPlus object (pointing to Gaia Archive) """ + MAIN_GAIA_TABLE = conf.MAIN_GAIA_TABLE + MAIN_GAIA_TABLE_RA = conf.MAIN_GAIA_TABLE_RA + MAIN_GAIA_TABLE_DEC = conf.MAIN_GAIA_TABLE_DEC def __init__(self, tap_plus_handler=None): if tap_plus_handler is None: From cacdbacc1c2640ff82ed06deea2b5ba722de1475 Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 09:38:35 -0600 Subject: [PATCH 2/6] whitespace fixes (my linter isn't working...?) --- astroquery/gaia/__init__.py | 1 - astroquery/gaia/core.py | 6 ++---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/astroquery/gaia/__init__.py b/astroquery/gaia/__init__.py index 6a6d4991cf..2b4c75910e 100644 --- a/astroquery/gaia/__init__.py +++ b/astroquery/gaia/__init__.py @@ -23,7 +23,6 @@ class Conf(_config.ConfigNamespace): """ Configuration parameters for `astroquery.gaia`. """ - pass MAIN_GAIA_TABLE = _config.ConfigItem("gaiadr1.gaia_source", "GAIA source data table") diff --git a/astroquery/gaia/core.py b/astroquery/gaia/core.py index eac4209338..74acdc00a8 100644 --- a/astroquery/gaia/core.py +++ b/astroquery/gaia/core.py @@ -25,7 +25,6 @@ __all__ = ['Gaia', 'GaiaClass'] - class GaiaClass(object): """ @@ -81,9 +80,8 @@ def load_table(self, table, verbose=False): return self.__gaiatap.load_table(table, verbose) def launch_job(self, query, name=None, output_file=None, - output_format="votable", verbose=False, - dump_to_file=False, upload_resource=None, - upload_table_name=None): + output_format="votable", verbose=False, dump_to_file=False, + upload_resource=None, upload_table_name=None): """Launches a synchronous job TAP & TAP+ From c92dfd08c077bb117d0e350184b193d28b458f8a Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 09:44:38 -0600 Subject: [PATCH 3/6] whitespace again --- astroquery/gaia/core.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/astroquery/gaia/core.py b/astroquery/gaia/core.py index 74acdc00a8..49a6e2cce3 100644 --- a/astroquery/gaia/core.py +++ b/astroquery/gaia/core.py @@ -417,8 +417,8 @@ def cone_search(self, coordinate, radius=None, output_file=None, dump_to_file=dump_to_file) def cone_search_async(self, coordinate, radius=None, background=False, - output_file=None, output_format="votable", verbose=False, - dump_to_file=False): + output_file=None, output_format="votable", + verbose=False, dump_to_file=False): """Cone search sorted by distance (async) TAP & TAP+ From 32fb12f4e7000dc65efca15bf8783817977098cb Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 09:48:09 -0600 Subject: [PATCH 4/6] fix several errors --- astroquery/gaia/core.py | 67 ++++++++++++++++++----------------------- 1 file changed, 29 insertions(+), 38 deletions(-) diff --git a/astroquery/gaia/core.py b/astroquery/gaia/core.py index 49a6e2cce3..286a9e2de8 100644 --- a/astroquery/gaia/core.py +++ b/astroquery/gaia/core.py @@ -107,14 +107,13 @@ def launch_job(self, query, name=None, output_file=None, ------- A Job object """ - return self.__gaiatap.launch_job(query, - name=name, - output_file=output_file, - output_format=output_format, - verbose=verbose, - dump_to_file=dump_to_file, - upload_resource=upload_resource, - upload_table_name=upload_table_name) + return self.__gaiatap.launch_job(query, name=name, + output_file=output_file, + output_format=output_format, + verbose=verbose, + dump_to_file=dump_to_file, + upload_resource=upload_resource, + upload_table_name=upload_table_name) def launch_job_async(self, query, name=None, output_file=None, output_format="votable", verbose=False, @@ -246,12 +245,12 @@ def __query_object(self, coordinate, radius=None, width=None, height=None, heightQuantity = self.__getQuantityInput(height, "height") widthDeg = widthQuantity.to(units.deg) heightDeg = heightQuantity.to(units.deg) - query = "SELECT DISTANCE(POINT('ICRS',"+str(MAIN_GAIA_TABLE_RA)+","\ - + str(MAIN_GAIA_TABLE_DEC)+"), \ + query = "SELECT DISTANCE(POINT('ICRS',"+str(self.MAIN_GAIA_TABLE_RA)+","\ + + str(self.MAIN_GAIA_TABLE_DEC)+"), \ POINT('ICRS',"+str(ra)+","+str(dec)+")) AS dist, * \ - FROM "+str(MAIN_GAIA_TABLE)+" WHERE CONTAINS(\ - POINT('ICRS',"+str(MAIN_GAIA_TABLE_RA)+","\ - + str(MAIN_GAIA_TABLE_DEC)+"),\ + FROM "+str(self.MAIN_GAIA_TABLE)+" WHERE CONTAINS(\ + POINT('ICRS',"+str(self.MAIN_GAIA_TABLE_RA)+","\ + + str(self.MAIN_GAIA_TABLE_DEC)+"),\ BOX('ICRS',"+str(ra)+","+str(dec)+", "+str(widthDeg.value)+", "\ + str(heightDeg.value)+"))=1 \ ORDER BY dist ASC" @@ -283,12 +282,8 @@ def query_object(self, coordinate, radius=None, width=None, height=None, ------- The job results (astropy.table). """ - return self.__query_object(coordinate, - radius, - width, - height, - async_job=False, - verbose=verbose) + return self.__query_object(coordinate, radius, width, height, + async_job=False, verbose=verbose) def query_object_async(self, coordinate, radius=None, width=None, height=None, verbose=False): @@ -314,12 +309,8 @@ def query_object_async(self, coordinate, radius=None, width=None, ------- The job results (astropy.table). """ - return self.__query_object(coordinate, - radius, - width, - height, - async_job=True, - verbose=verbose) + return self.__query_object(coordinate, radius, width, height, + async_job=True, verbose=verbose) def __cone_search(self, coordinate, radius, async_job=False, background=False, @@ -360,26 +351,26 @@ def __cone_search(self, coordinate, radius, async_job=False, if radius is not None: radiusQuantity = self.__getQuantityInput(radius, "radius") radiusDeg = commons.radius_to_unit(radiusQuantity, unit='deg') - query = "SELECT DISTANCE(POINT('ICRS',"+str(MAIN_GAIA_TABLE_RA)+","\ - + str(MAIN_GAIA_TABLE_DEC)+"), \ + query = "SELECT DISTANCE(POINT('ICRS',"+str(self.MAIN_GAIA_TABLE_RA)+","\ + + str(self.MAIN_GAIA_TABLE_DEC)+"), \ POINT('ICRS',"+str(ra)+","+str(dec)+")) AS dist, * \ - FROM "+str(MAIN_GAIA_TABLE)+" WHERE CONTAINS(\ - POINT('ICRS',"+str(MAIN_GAIA_TABLE_RA)+","+str(MAIN_GAIA_TABLE_DEC)+"),\ + FROM "+str(self.MAIN_GAIA_TABLE)+" WHERE CONTAINS(\ + POINT('ICRS',"+str(self.MAIN_GAIA_TABLE_RA)+","+str(self.MAIN_GAIA_TABLE_DEC)+"),\ CIRCLE('ICRS',"+str(ra)+","+str(dec)+", "+str(radiusDeg)+"))=1 \ ORDER BY dist ASC" if async_job: return self.__gaiatap.launch_job_async(query=query, - output_file=output_file, - output_format=output_format, - verbose=verbose, - dump_to_file=dump_to_file, - background=background) + output_file=output_file, + output_format=output_format, + verbose=verbose, + dump_to_file=dump_to_file, + background=background) else: return self.__gaiatap.launch_job(query=query, - output_file=output_file, - output_format=output_format, - verbose=verbose, - dump_to_file=dump_to_file) + output_file=output_file, + output_format=output_format, + verbose=verbose, + dump_to_file=dump_to_file) def cone_search(self, coordinate, radius=None, output_file=None, output_format="votable", verbose=False, From 72593f1373b93d37b0cf1b74bc49e4d2cd8b649a Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 10:38:05 -0600 Subject: [PATCH 5/6] default -> dr2 --- astroquery/gaia/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astroquery/gaia/__init__.py b/astroquery/gaia/__init__.py index 2b4c75910e..e87a7c5867 100644 --- a/astroquery/gaia/__init__.py +++ b/astroquery/gaia/__init__.py @@ -24,7 +24,7 @@ class Conf(_config.ConfigNamespace): Configuration parameters for `astroquery.gaia`. """ - MAIN_GAIA_TABLE = _config.ConfigItem("gaiadr1.gaia_source", + MAIN_GAIA_TABLE = _config.ConfigItem("gaiadr2.gaia_source", "GAIA source data table") MAIN_GAIA_TABLE_RA = _config.ConfigItem("ra", "Name of RA parameter in table") From a5477e619d7c6714c4c2094f4078bdb16bd8c16b Mon Sep 17 00:00:00 2001 From: "Adam Ginsburg (keflavich)" Date: Wed, 25 Apr 2018 18:42:13 -0600 Subject: [PATCH 6/6] changelog --- CHANGES | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGES b/CHANGES index 370ac527c5..fd97a584c3 100644 --- a/CHANGES +++ b/CHANGES @@ -1,6 +1,7 @@ 0.3.8 (unreleased) ------------------ +- GAIA: Default URL switched to DR2 and made configurable [#1112] - TAP: Add tool to check for phase of background job [#1073] - splatalogue: Move to https. Old HTTP post requests were broken [#1066,#1076] - heasarc: Add additional functionality and expand query capabilities [#1047]