2020from astropy import units
2121from astropy .units import Quantity
2222
23- __all__ = [ 'Gaia' , 'GaiaClass' ]
23+ from . import conf
2424
25- MAIN_GAIA_TABLE = "gaiadr1.gaia_source"
26- MAIN_GAIA_TABLE_RA = "ra"
27- MAIN_GAIA_TABLE_DEC = "dec"
25+ __all__ = ['Gaia' , 'GaiaClass' ]
2826
2927
3028class GaiaClass (object ):
3129
3230 """
3331 Proxy class to default TapPlus object (pointing to Gaia Archive)
3432 """
33+ MAIN_GAIA_TABLE = conf .MAIN_GAIA_TABLE
34+ MAIN_GAIA_TABLE_RA = conf .MAIN_GAIA_TABLE_RA
35+ MAIN_GAIA_TABLE_DEC = conf .MAIN_GAIA_TABLE_DEC
3536
3637 def __init__ (self , tap_plus_handler = None ):
3738 if tap_plus_handler is None :
@@ -79,9 +80,8 @@ def load_table(self, table, verbose=False):
7980 return self .__gaiatap .load_table (table , verbose )
8081
8182 def launch_job (self , query , name = None , output_file = None ,
82- output_format = "votable" , verbose = False ,
83- dump_to_file = False , upload_resource = None ,
84- upload_table_name = None ):
83+ output_format = "votable" , verbose = False , dump_to_file = False ,
84+ upload_resource = None , upload_table_name = None ):
8585 """Launches a synchronous job
8686 TAP & TAP+
8787
@@ -107,14 +107,13 @@ def launch_job(self, query, name=None, output_file=None,
107107 -------
108108 A Job object
109109 """
110- return self .__gaiatap .launch_job (query ,
111- name = name ,
112- output_file = output_file ,
113- output_format = output_format ,
114- verbose = verbose ,
115- dump_to_file = dump_to_file ,
116- upload_resource = upload_resource ,
117- upload_table_name = upload_table_name )
110+ return self .__gaiatap .launch_job (query , name = name ,
111+ output_file = output_file ,
112+ output_format = output_format ,
113+ verbose = verbose ,
114+ dump_to_file = dump_to_file ,
115+ upload_resource = upload_resource ,
116+ upload_table_name = upload_table_name )
118117
119118 def launch_job_async (self , query , name = None , output_file = None ,
120119 output_format = "votable" , verbose = False ,
@@ -246,12 +245,12 @@ def __query_object(self, coordinate, radius=None, width=None, height=None,
246245 heightQuantity = self .__getQuantityInput (height , "height" )
247246 widthDeg = widthQuantity .to (units .deg )
248247 heightDeg = heightQuantity .to (units .deg )
249- query = "SELECT DISTANCE(POINT('ICRS'," + str (MAIN_GAIA_TABLE_RA )+ "," \
250- + str (MAIN_GAIA_TABLE_DEC )+ "), \
248+ query = "SELECT DISTANCE(POINT('ICRS'," + str (self . MAIN_GAIA_TABLE_RA )+ "," \
249+ + str (self . MAIN_GAIA_TABLE_DEC )+ "), \
251250 POINT('ICRS',"+ str (ra )+ "," + str (dec )+ ")) AS dist, * \
252- FROM "+ str (MAIN_GAIA_TABLE )+ " WHERE CONTAINS(\
253- POINT('ICRS',"+ str (MAIN_GAIA_TABLE_RA )+ "," \
254- + str (MAIN_GAIA_TABLE_DEC )+ "),\
251+ FROM "+ str (self . MAIN_GAIA_TABLE )+ " WHERE CONTAINS(\
252+ POINT('ICRS',"+ str (self . MAIN_GAIA_TABLE_RA )+ "," \
253+ + str (self . MAIN_GAIA_TABLE_DEC )+ "),\
255254 BOX('ICRS',"+ str (ra )+ "," + str (dec )+ ", " + str (widthDeg .value )+ ", " \
256255 + str (heightDeg .value )+ "))=1 \
257256 ORDER BY dist ASC"
@@ -283,12 +282,8 @@ def query_object(self, coordinate, radius=None, width=None, height=None,
283282 -------
284283 The job results (astropy.table).
285284 """
286- return self .__query_object (coordinate ,
287- radius ,
288- width ,
289- height ,
290- async_job = False ,
291- verbose = verbose )
285+ return self .__query_object (coordinate , radius , width , height ,
286+ async_job = False , verbose = verbose )
292287
293288 def query_object_async (self , coordinate , radius = None , width = None ,
294289 height = None , verbose = False ):
@@ -314,12 +309,8 @@ def query_object_async(self, coordinate, radius=None, width=None,
314309 -------
315310 The job results (astropy.table).
316311 """
317- return self .__query_object (coordinate ,
318- radius ,
319- width ,
320- height ,
321- async_job = True ,
322- verbose = verbose )
312+ return self .__query_object (coordinate , radius , width , height ,
313+ async_job = True , verbose = verbose )
323314
324315 def __cone_search (self , coordinate , radius , async_job = False ,
325316 background = False ,
@@ -360,26 +351,26 @@ def __cone_search(self, coordinate, radius, async_job=False,
360351 if radius is not None :
361352 radiusQuantity = self .__getQuantityInput (radius , "radius" )
362353 radiusDeg = commons .radius_to_unit (radiusQuantity , unit = 'deg' )
363- query = "SELECT DISTANCE(POINT('ICRS'," + str (MAIN_GAIA_TABLE_RA )+ "," \
364- + str (MAIN_GAIA_TABLE_DEC )+ "), \
354+ query = "SELECT DISTANCE(POINT('ICRS'," + str (self . MAIN_GAIA_TABLE_RA )+ "," \
355+ + str (self . MAIN_GAIA_TABLE_DEC )+ "), \
365356 POINT('ICRS',"+ str (ra )+ "," + str (dec )+ ")) AS dist, * \
366- FROM "+ str (MAIN_GAIA_TABLE )+ " WHERE CONTAINS(\
367- POINT('ICRS',"+ str (MAIN_GAIA_TABLE_RA )+ "," + str (MAIN_GAIA_TABLE_DEC )+ "),\
357+ FROM "+ str (self . MAIN_GAIA_TABLE )+ " WHERE CONTAINS(\
358+ POINT('ICRS',"+ str (self . MAIN_GAIA_TABLE_RA )+ "," + str (self . MAIN_GAIA_TABLE_DEC )+ "),\
368359 CIRCLE('ICRS',"+ str (ra )+ "," + str (dec )+ ", " + str (radiusDeg )+ "))=1 \
369360 ORDER BY dist ASC"
370361 if async_job :
371362 return self .__gaiatap .launch_job_async (query = query ,
372- output_file = output_file ,
373- output_format = output_format ,
374- verbose = verbose ,
375- dump_to_file = dump_to_file ,
376- background = background )
363+ output_file = output_file ,
364+ output_format = output_format ,
365+ verbose = verbose ,
366+ dump_to_file = dump_to_file ,
367+ background = background )
377368 else :
378369 return self .__gaiatap .launch_job (query = query ,
379- output_file = output_file ,
380- output_format = output_format ,
381- verbose = verbose ,
382- dump_to_file = dump_to_file )
370+ output_file = output_file ,
371+ output_format = output_format ,
372+ verbose = verbose ,
373+ dump_to_file = dump_to_file )
383374
384375 def cone_search (self , coordinate , radius = None , output_file = None ,
385376 output_format = "votable" , verbose = False ,
@@ -417,8 +408,8 @@ def cone_search(self, coordinate, radius=None, output_file=None,
417408 dump_to_file = dump_to_file )
418409
419410 def cone_search_async (self , coordinate , radius = None , background = False ,
420- output_file = None , output_format = "votable" , verbose = False ,
421- dump_to_file = False ):
411+ output_file = None , output_format = "votable" ,
412+ verbose = False , dump_to_file = False ):
422413 """Cone search sorted by distance (async)
423414 TAP & TAP+
424415
0 commit comments