@@ -46,6 +46,7 @@ class GaiaClass(TapPlus):
46
46
MAIN_GAIA_TABLE_DEC = conf .MAIN_GAIA_TABLE_DEC
47
47
ROW_LIMIT = conf .ROW_LIMIT
48
48
VALID_DATALINK_RETRIEVAL_TYPES = conf .VALID_DATALINK_RETRIEVAL_TYPES
49
+ VALID_LINKING_PARAMETERS = conf .VALID_LINKING_PARAMETERS
49
50
GAIA_MESSAGES = "notification?action=GetNotifications"
50
51
51
52
def __init__ (self , * , tap_plus_conn_handler = None ,
@@ -174,7 +175,7 @@ def load_data(self, ids, *, data_release=None, data_structure='INDIVIDUAL', retr
174
175
175
176
Parameters
176
177
----------
177
- ids : str list, mandatory
178
+ ids : str, int, str list or int list, mandatory
178
179
list of identifiers
179
180
data_release: str, optional, default None
180
181
data release from which data should be taken. E.g. 'Gaia DR3'
@@ -287,10 +288,10 @@ def load_data(self, ids, *, data_release=None, data_structure='INDIVIDUAL', retr
287
288
params_dict ['RETRIEVAL_TYPE' ] = str (retrieval_type )
288
289
params_dict ['USE_ZIP_ALWAYS' ] = 'true'
289
290
290
- valid_param = {'SOURCE_ID' , 'TRANSIT_ID' , 'IMAGE_ID' }
291
- if linking_parameter not in valid_param :
291
+ if linking_parameter not in self .VALID_LINKING_PARAMETERS :
292
292
raise ValueError (
293
- f"Invalid linking_parameter value '{ linking_parameter } ' (Valid values: { ', ' .join (valid_param )} )" )
293
+ f"Invalid linking_parameter value '{ linking_parameter } ' (Valid values: "
294
+ f"{ ', ' .join (self .VALID_LINKING_PARAMETERS )} )" )
294
295
else :
295
296
if linking_parameter != 'SOURCE_ID' :
296
297
params_dict ['LINKING_PARAMETER' ] = linking_parameter
@@ -388,22 +389,77 @@ def __get_data_files(output_file, path):
388
389
389
390
return files
390
391
391
- def get_datalinks (self , ids , * , verbose = False ):
392
+ def get_datalinks (self , ids , * , linking_parameter = 'SOURCE_ID' , verbose = False ):
392
393
"""Gets datalinks associated to the provided identifiers
393
394
TAP+ only
394
395
395
396
Parameters
396
397
----------
397
- ids : str list, mandatory
398
+ ids : str, int, str list or int list, mandatory
398
399
list of identifiers
400
+ linking_parameter : str, optional, default SOURCE_ID, valid values: SOURCE_ID, TRANSIT_ID, IMAGE_ID
401
+ By default, all the identifiers are considered as source_id
402
+ SOURCE_ID: the identifiers are considered as source_id
403
+ TRANSIT_ID: the identifiers are considered as transit_id
404
+ IMAGE_ID: the identifiers are considered as sif_observation_id
399
405
verbose : bool, optional, default 'False'
400
406
flag to display information about the process
401
407
402
408
Returns
403
409
-------
404
410
A table object
411
+
412
+ Examples
413
+ --------
414
+ Id formats.
415
+
416
+ -- Gaia.get_datalinks(iids=1104405489608579584) # single id as an int
417
+
418
+ -- Gaia.get_datalinks(ids='1104405489608579584, 1809140662896080256') # multiple ids as a str
419
+
420
+ -- Gaia.get_datalinks(ids=(1104405489608579584, 1809140662896080256)) # multiple ids as an int list
421
+
422
+ -- Gaia.get_datalinks(ids=('1104405489608579584','1809140662896080256')) # multiple ids as str list
423
+ -- Gaia.get_datalinks(ids='4295806720-38655544960') # range of ids as a str
424
+
425
+ -- Gaia.get_datalinks(ids='4295806720-38655544960, 549755818112-1275606125952') # multiple ranges of ids as
426
+ a str
427
+
428
+ -- Gaia.get_datalinks(ids=('4295806720-38655544960', '549755818112-1275606125952') # multiple ranges of ids
429
+ as a str list
430
+
431
+ -- Gaia.get_datalinks(ids='Gaia DR3 1104405489608579584') # single designator
432
+ -- Gaia.get_datalinks(ids='Gaia DR3 1104405489608579584, Gaia DR3 1809140662896080256') # multiple
433
+ designators as a str
434
+
435
+ -- Gaia.get_datalinks(ids=('Gaia DR3 1104405489608579584','Gaia DR3 1809140662896080256')) # multiple
436
+ designators as a str list
437
+
438
+ -- Gaia.get_datalinks(ids='Gaia DR3 4295806720-Gaia DR3 38655544960') # range of designators as a str
439
+
440
+ -- Gaia.get_datalinks(ids='Gaia DR3 4295806720-Gaia DR3 38655544960, Gaia DR3 549755818112-Gaia DR3
441
+ 1275606125952') # multiple ranges of designators as a str
442
+
443
+ -- Gaia.get_datalinks(ids=('Gaia DR3 4295806720-Gaia DR3 38655544960', 'Gaia DR3 549755818112-Gaia DR3
444
+ 1275606125952')) # multiple ranges of designators as a str list
445
+
446
+ -- Gaia.get_datalinks(ids='Gaia DR3 4295806720-Gaia DR3 38655544960, Gaia DR2 549755818112-Gaia DR2
447
+ 1275606125952') # multiple ranges of designators with difference releases as a str
448
+
449
+ -- Gaia.get_datalinks(ids=('Gaia DR3 4295806720-Gaia DR3 38655544960', 'Gaia DR2 549755818112-Gaia DR2
450
+ 1275606125952')) # multiple ranges of designators with difference releases as a str list
405
451
"""
406
- return self .__gaiadata .get_datalinks (ids = ids , verbose = verbose )
452
+
453
+ if linking_parameter not in self .VALID_LINKING_PARAMETERS :
454
+ raise ValueError (
455
+ f"Invalid linking_parameter value '{ linking_parameter } ' (Valid values: "
456
+ f"{ ', ' .join (self .VALID_LINKING_PARAMETERS )} )" )
457
+
458
+ final_linking_parameter = None
459
+ if linking_parameter != 'SOURCE_ID' :
460
+ final_linking_parameter = linking_parameter
461
+
462
+ return self .__gaiadata .get_datalinks (ids = ids , linking_parameter = final_linking_parameter , verbose = verbose )
407
463
408
464
def __query_object (self , coordinate , * , radius = None , width = None , height = None ,
409
465
async_job = False , verbose = False , columns = ()):
@@ -412,20 +468,20 @@ def __query_object(self, coordinate, *, radius=None, width=None, height=None,
412
468
413
469
Parameters
414
470
----------
415
- coordinate : astropy.coordinate, mandatory
471
+ coordinate : str or astropy.coordinate, mandatory
416
472
coordinates center point
417
- radius : astropy.units if no 'width' nor 'height' are provided
473
+ radius : str or astropy.units if no 'width' nor 'height' are provided
418
474
radius (deg)
419
- width : astropy.units if no 'radius' is provided
475
+ width : str or astropy.units if no 'radius' is provided
420
476
box width
421
- height : astropy.units if no 'radius' is provided
477
+ height : str or astropy.units if no 'radius' is provided
422
478
box height
423
479
async_job : bool, optional, default 'False'
424
480
executes the query (job) in asynchronous/synchronous mode (default
425
481
synchronous)
426
482
verbose : bool, optional, default 'False'
427
483
flag to display information about the process
428
- columns: list, optional, default []
484
+ columns: list, optional, default ()
429
485
if empty, all columns will be selected
430
486
431
487
Returns
@@ -486,18 +542,19 @@ def __query_object(self, coordinate, *, radius=None, width=None, height=None,
486
542
487
543
def query_object (self , coordinate , * , radius = None , width = None , height = None ,
488
544
verbose = False , columns = ()):
489
- """Launches a job
545
+ """Launches a synchronous cone search for the input search radius or the box on the sky, sorted by angular
546
+ separation
490
547
TAP & TAP+
491
548
492
549
Parameters
493
550
----------
494
- coordinate : astropy.coordinates, mandatory
551
+ coordinate : str or astropy.coordinates, mandatory
495
552
coordinates center point
496
- radius : astropy.units if no 'width'/'height' are provided
553
+ radius : str or astropy.units if no 'width'/'height' are provided
497
554
radius (deg)
498
- width : astropy.units if no 'radius' is provided
555
+ width : str or astropy.units if no 'radius' is provided
499
556
box width
500
- height : astropy.units if no 'radius' is provided
557
+ height : str or astropy.units if no 'radius' is provided
501
558
box height
502
559
verbose : bool, optional, default 'False'
503
560
flag to display information about the process
@@ -514,18 +571,19 @@ def query_object(self, coordinate, *, radius=None, width=None, height=None,
514
571
515
572
def query_object_async (self , coordinate , * , radius = None , width = None ,
516
573
height = None , verbose = False , columns = ()):
517
- """Launches a job (async)
574
+ """Launches an asynchronous cone search for the input search radius or the box on the sky, sorted by angular
575
+ separation
518
576
TAP & TAP+
519
577
520
578
Parameters
521
579
----------
522
- coordinate : astropy.coordinates, mandatory
580
+ coordinate : str or astropy.coordinates, mandatory
523
581
coordinates center point
524
- radius : astropy.units if no 'width'/'height' are provided
582
+ radius : str or astropy.units if no 'width'/'height' are provided
525
583
radius
526
- width : astropy.units if no 'radius' is provided
584
+ width : str or astropy.units if no 'radius' is provided
527
585
box width
528
- height : astropy.units if no 'radius' is provided
586
+ height : str or astropy.units if no 'radius' is provided
529
587
box height
530
588
verbose : bool, optional, default 'False'
531
589
flag to display information about the process
@@ -569,7 +627,7 @@ def __cone_search(self, coordinate, radius, *, table_name=None,
569
627
when the job is executed in asynchronous mode, this flag specifies
570
628
whether the execution will wait until results are available
571
629
output_file : str, optional, default None
572
- file name where the results are saved if dump_to_file is True.
630
+ file name where the results are saved if `` dump_to_file`` is True.
573
631
If this parameter is not provided, the jobid is used instead
574
632
output_format : str, optional, default 'votable_gzip'
575
633
results format. Available formats are: 'votable', 'votable_plain',
@@ -647,17 +705,17 @@ def cone_search(self, coordinate, *, radius=None,
647
705
648
706
Parameters
649
707
----------
650
- coordinate : astropy.coordinate, mandatory
708
+ coordinate : str or astropy.coordinate, mandatory
651
709
coordinates center point
652
- radius : astropy.units, mandatory
710
+ radius : str or astropy.units, mandatory
653
711
radius
654
712
table_name : str, optional, default main gaia table name doing the cone search against
655
713
ra_column_name : str, optional, default ra column in main gaia table
656
714
ra column doing the cone search against
657
715
dec_column_name : str, optional, default dec column in main gaia table
658
716
dec column doing the cone search against
659
717
output_file : str, optional, default None
660
- file name where the results are saved if dump_to_file is True.
718
+ file name where the results are saved if `` dump_to_file`` is True.
661
719
If this parameter is not provided, the jobid is used instead
662
720
output_format : str, optional, default 'votable_gzip'
663
721
results format. Available formats are: 'votable', 'votable_plain',
@@ -697,9 +755,9 @@ def cone_search_async(self, coordinate, *, radius=None,
697
755
698
756
Parameters
699
757
----------
700
- coordinate : astropy.coordinate, mandatory
758
+ coordinate : str or astropy.coordinate, mandatory
701
759
coordinates center point
702
- radius : astropy.units, mandatory
760
+ radius : str or astropy.units, mandatory
703
761
radius
704
762
table_name : str, optional, default main gaia table name doing the cone search against
705
763
ra_column_name : str, optional, default ra column in main gaia table
@@ -711,7 +769,7 @@ def cone_search_async(self, coordinate, *, radius=None,
711
769
specifies whether
712
770
the execution will wait until results are available
713
771
output_file : str, optional, default None
714
- file name where the results are saved if dump_to_file is True.
772
+ file name where the results are saved if `` dump_to_file`` is True.
715
773
If this parameter is not provided, the jobid is used instead
716
774
output_format : str, optional, default 'votable_gzip'
717
775
results format. Available formats are: 'votable', 'votable_plain',
@@ -772,6 +830,15 @@ def __getCoordInput(self, value, msg):
772
830
773
831
@staticmethod
774
832
def correct_table_units (table ):
833
+ """Correct format in the units of the columns
834
+ TAP & TAP+
835
+
836
+ Parameters
837
+ ----------
838
+ table : `~astropy.table.Table`, mandatory
839
+ change the format of the units in the columns of the input table: '.' by ' ' and "'" by ""
840
+ """
841
+
775
842
for cn in table .colnames :
776
843
col = table [cn ]
777
844
if isinstance (col .unit , u .UnrecognizedUnit ):
@@ -877,7 +944,7 @@ def launch_job(self, query, *, name=None, output_file=None,
877
944
name : str, optional, default None
878
945
custom name defined by the user for the job that is going to be created
879
946
output_file : str, optional, default None
880
- file name where the results are saved if dump_to_file is True.
947
+ file name where the results are saved if `` dump_to_file`` is True.
881
948
If this parameter is not provided, the jobid is used instead
882
949
output_format : str, optional, default 'votable_gzip'
883
950
results format. Available formats are: 'votable_gzip', 'votable', 'votable_plain',
@@ -892,7 +959,7 @@ def launch_job(self, query, *, name=None, output_file=None,
892
959
resource to be uploaded to UPLOAD_SCHEMA
893
960
upload_table_name : str, optional, default None
894
961
resource temporary table name associated to the uploaded resource.
895
- This argument is required if upload_resource is provided.
962
+ This argument is required if `` upload_resource`` is provided.
896
963
897
964
Returns
898
965
-------
@@ -922,7 +989,7 @@ def launch_job_async(self, query, *, name=None, output_file=None,
922
989
name : str, optional, default None
923
990
custom name defined by the user for the job that is going to be created
924
991
output_file : str, optional, default None
925
- file name where the results are saved if dump_to_file is True.
992
+ file name where the results are saved if `` dump_to_file`` is True.
926
993
If this parameter is not provided, the jobid is used instead
927
994
output_format : str, optional, default 'votable_gzip'
928
995
results format. Available formats are: 'votable_gzip', 'votable', 'votable_plain',
@@ -940,7 +1007,7 @@ def launch_job_async(self, query, *, name=None, output_file=None,
940
1007
resource to be uploaded to UPLOAD_SCHEMA
941
1008
upload_table_name : str, optional, default None
942
1009
resource temporary table name associated to the uploaded resource.
943
- This argument is required if upload_resource is provided.
1010
+ This argument is required if `` upload_resource`` is provided.
944
1011
autorun : boolean, optional, default True
945
1012
if 'True', sets 'phase' parameter to 'RUN',
946
1013
so the framework can start the job.
0 commit comments