@@ -39,6 +39,8 @@ class EuclidClass(TapPlus):
39
39
"""
40
40
ROW_LIMIT = conf .ROW_LIMIT
41
41
42
+ __VALID_DATALINK_RETRIEVAL_TYPES = conf .VALID_DATALINK_RETRIEVAL_TYPES
43
+
42
44
def __init__ (self , * , tap_plus_conn_handler = None , datalink_handler = None , cutout_handler = None , environment = 'PDR' ,
43
45
verbose = False , show_server_messages = True ):
44
46
@@ -456,6 +458,7 @@ def login(self, *, user=None, password=None, credentials_file=None, verbose=Fals
456
458
"""
457
459
try :
458
460
log .info ("Login to Euclid TAP server" )
461
+ log .info (f"Euclid TAP server url: { self ._TapPlus__getconnhandler ().get_host_url ()} " )
459
462
super ().login (user = user , password = password , credentials_file = credentials_file , verbose = verbose )
460
463
except HTTPError as err :
461
464
log .error ('Error logging in TAP server: %s' % (str (err )))
@@ -466,8 +469,10 @@ def login(self, *, user=None, password=None, credentials_file=None, verbose=Fals
466
469
467
470
try :
468
471
log .info ("Login to Euclid data service" )
472
+ log .info (f"Euclid data server url: { self .__eucliddata ._TapPlus__getconnhandler ().get_host_url ()} " )
469
473
self .__eucliddata .login (user = tap_user , password = tap_password , verbose = verbose )
470
474
log .info ("Login to Euclid cutout service" )
475
+ log .info (f"Euclid cutout server url: { self .__euclidcutout ._TapPlus__getconnhandler ().get_host_url ()} " )
471
476
self .__euclidcutout .login (user = tap_user , password = tap_password , verbose = verbose )
472
477
except HTTPError as err :
473
478
log .error ('Error logging in data or cutout services: %s' % (str (err )))
@@ -487,6 +492,7 @@ def login_gui(self, verbose=False):
487
492
"""
488
493
try :
489
494
log .info ("Login to Euclid TAP server" )
495
+ log .info (f"Euclid TAP server url: { self ._TapPlus__getconnhandler ().get_host_url ()} " )
490
496
TapPlus .login_gui (self , verbose = verbose )
491
497
except HTTPError as err :
492
498
log .error ('Error logging in TAP server: %s' % (str (err )))
@@ -497,6 +503,7 @@ def login_gui(self, verbose=False):
497
503
498
504
try :
499
505
log .info ("Login to Euclid data server" )
506
+ log .info (f"Euclid data server url: { self .__eucliddata ._TapPlus__getconnhandler ().get_host_url ()} " )
500
507
self .__eucliddata .login (user = tap_user , password = tap_password , verbose = verbose )
501
508
except HTTPError as err :
502
509
log .error ('Error logging in data server: %s' % (str (err )))
@@ -505,6 +512,7 @@ def login_gui(self, verbose=False):
505
512
506
513
try :
507
514
log .info ("Login to Euclid cutout server" )
515
+ log .info (f"Euclid cutout server url: { self .__euclidcutout ._TapPlus__getconnhandler ().get_host_url ()} " )
508
516
self .__euclidcutout .login (user = tap_user , password = tap_password , verbose = verbose )
509
517
except HTTPError as err :
510
518
log .error ('Error logging in cutout server: %s' % (str (err )))
@@ -1145,7 +1153,7 @@ def get_cutout(self, *, file_path=None, instrument=None, id=None, coordinate, ra
1145
1153
1146
1154
return files
1147
1155
1148
- def get_spectrum (self , * , source_id , schema = 'sedm' , output_file = None , verbose = False ):
1156
+ def get_spectrum (self , * , source_id , schema = 'sedm' , retrieval_type = "ALL" , output_file = None , verbose = False ):
1149
1157
"""
1150
1158
Description
1151
1159
-----------
@@ -1161,6 +1169,9 @@ def get_spectrum(self, *, source_id, schema='sedm', output_file=None, verbose=Fa
1161
1169
source id for the spectrum
1162
1170
schema : str, mandatory, default 'sedm'
1163
1171
the data release, 'sedm'
1172
+ retrieval_type : str, optional, default 'ALL' to retrieve all data from the list of sources
1173
+ retrieval type identifier. Possible values are: 'SPECTRA_BGS' for the blue spectrum and 'SPECTRA_RGS' for
1174
+ the red one.
1164
1175
output_file : str, optional
1165
1176
output file name. If no value is provided, a temporary one is created with the name
1166
1177
"<working directory>/temp_<%Y%m%d_%H%M%S>/<source_id>.fits"
@@ -1175,9 +1186,19 @@ def get_spectrum(self, *, source_id, schema='sedm', output_file=None, verbose=Fa
1175
1186
if source_id is None or schema is None :
1176
1187
raise ValueError (self .__ERROR_MSG_REQUESTED_GENERIC )
1177
1188
1178
- params_dict = {'TAPCLIENT' : 'ASTROQUERY' , 'RETRIEVAL_TYPE' : 'SPECTRA' }
1189
+ rt = str (retrieval_type ).upper ()
1190
+ if rt != 'ALL' and rt not in self .__VALID_DATALINK_RETRIEVAL_TYPES :
1191
+ raise ValueError (f"Invalid argument value for 'retrieval_type'. Found { retrieval_type } , "
1192
+ f"expected: 'ALL' or any of { self .__VALID_DATALINK_RETRIEVAL_TYPES } " )
1193
+
1194
+ params_dict = {}
1195
+
1179
1196
id_value = """{schema} {source_id}""" .format (** {'schema' : schema , 'source_id' : source_id })
1180
1197
params_dict ['ID' ] = id_value
1198
+ params_dict ['SCHEMA' ] = schema
1199
+ params_dict ['RETRIEVAL_TYPE' ] = str (retrieval_type )
1200
+ params_dict ['USE_ZIP_ALWAYS' ] = 'true'
1201
+ params_dict ['TAPCLIENT' ] = 'ASTROQUERY'
1181
1202
1182
1203
fits_file = source_id + '.fits'
1183
1204
output_file_full_path , output_dir = self .__set_dirs (output_file = output_file , observation_id = fits_file )
0 commit comments