@@ -357,19 +357,20 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
357
357
catalog = VizierClass ._schema_catalog .validate (catalog )
358
358
center = {}
359
359
columns = []
360
+
361
+ # Process coordinates
360
362
if isinstance (coordinates , (commons .CoordClasses ,) + six .string_types ):
361
363
c = commons .parse_coordinates (coordinates ).transform_to ('fk5' )
362
364
363
365
if not c .isscalar :
364
- pos_list = []
366
+ center [ "-c" ] = []
365
367
for pos in c :
366
368
ra_deg = pos .ra .to_string (unit = "deg" , decimal = True ,
367
369
precision = 8 )
368
370
dec_deg = pos .dec .to_string (unit = "deg" , decimal = True ,
369
371
precision = 8 , alwayssign = True )
370
- pos_list += ["{}{}" .format (ra_deg , dec_deg )]
371
- center ["-c" ] = "<<;" + ";" .join (pos_list )
372
- columns += ["_q" ] # request a reference to the input table
372
+ center ["-c" ] += ["{}{}" .format (ra_deg , dec_deg )]
373
+ columns += ["_q" ] # Always request reference to input table
373
374
else :
374
375
ra = c .ra .to_string (unit = 'deg' , decimal = True , precision = 8 )
375
376
dec = c .dec .to_string (unit = "deg" , decimal = True , precision = 8 ,
@@ -378,7 +379,7 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
378
379
elif isinstance (coordinates , tbl .Table ):
379
380
if (("_RAJ2000" in coordinates .keys ()) and ("_DEJ2000" in
380
381
coordinates .keys ())):
381
- pos_list = []
382
+ center [ "-c" ] = []
382
383
sky_coord = coord .SkyCoord (coordinates ["_RAJ2000" ],
383
384
coordinates ["_DEJ2000" ],
384
385
unit = (coordinates ["_RAJ2000" ].unit ,
@@ -388,15 +389,15 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
388
389
precision = 8 )
389
390
dec_deg = dec .to_string (unit = "deg" , decimal = True ,
390
391
precision = 8 , alwayssign = True )
391
- pos_list += ["{}{}" .format (ra_deg , dec_deg )]
392
- center ["-c" ] = "<<;" + ";" .join (pos_list )
393
- columns += ["_q" ] # request a reference to the input table
392
+ center ["-c" ] += ["{}{}" .format (ra_deg , dec_deg )]
393
+ columns += ["_q" ] # Always request reference to input table
394
394
else :
395
395
raise ValueError ("Table must contain '_RAJ2000' and "
396
396
"'_DEJ2000' columns!" )
397
397
else :
398
398
raise TypeError ("Coordinates must be one of: string, astropy "
399
399
"coordinates, or table containing coordinates!" )
400
+
400
401
# decide whether box or radius
401
402
if radius is not None :
402
403
# is radius a disk or an annulus?
@@ -434,6 +435,7 @@ def query_region_async(self, coordinates, radius=None, inner_radius=None,
434
435
raise Exception (
435
436
"At least one of radius, width/height must be specified" )
436
437
438
+ # Prepare payload
437
439
data_payload = self ._args_to_payload (center = center , columns = columns ,
438
440
catalog = catalog , column_filters = column_filters )
439
441
@@ -607,13 +609,22 @@ def _args_to_payload(self, *args, **kwargs):
607
609
if ucd :
608
610
body ['-ucd' ] = ucd
609
611
610
- # create final script
611
- script = "\n " .join (["{key}={val}" .format (key = key , val = val )
612
- for key , val in body .items ()])
613
- # add keywords
612
+ # create final script starting with keywords
613
+ script = ""
614
614
if (not isinstance (self .keywords , property ) and
615
615
self .keywords is not None ):
616
616
script += "\n " + str (self .keywords )
617
+ # add all items that are not lists
618
+ for key , val in body .items ():
619
+ if type (val ) is not list :
620
+ script += "\n {key}={val}" .format (key = key , val = val )
621
+ # add list at the end
622
+ for key , val in body .items ():
623
+ if type (val ) is list :
624
+ script += "\n {key}=<<====AstroqueryList" .format (key = key )
625
+ script += "\n " + "\n " .join (val )
626
+ script += "\n ====AstroqueryList"
627
+ # add keywords
617
628
return script
618
629
619
630
def _parse_result (self , response , get_catalog_names = False , verbose = False ,
0 commit comments