@@ -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 )))
@@ -1145,7 +1150,7 @@ def get_cutout(self, *, file_path=None, instrument=None, id=None, coordinate, ra
1145
1150
1146
1151
return files
1147
1152
1148
- def get_spectrum (self , * , source_id , schema = 'sedm' , output_file = None , verbose = False ):
1153
+ def get_spectrum (self , * , source_id , schema = 'sedm' , retrieval_type = "ALL" , output_file = None , verbose = False ):
1149
1154
"""
1150
1155
Description
1151
1156
-----------
@@ -1161,6 +1166,9 @@ def get_spectrum(self, *, source_id, schema='sedm', output_file=None, verbose=Fa
1161
1166
source id for the spectrum
1162
1167
schema : str, mandatory, default 'sedm'
1163
1168
the data release, 'sedm'
1169
+ retrieval_type : str, optional, default 'ALL' to retrieve all data from the list of sources
1170
+ retrieval type identifier. Possible values are: 'SPECTRA_BGS' for the blue spectrum and 'SPECTRA_RGS' for
1171
+ the red one.
1164
1172
output_file : str, optional
1165
1173
output file name. If no value is provided, a temporary one is created with the name
1166
1174
"<working directory>/temp_<%Y%m%d_%H%M%S>/<source_id>.fits"
@@ -1175,9 +1183,19 @@ def get_spectrum(self, *, source_id, schema='sedm', output_file=None, verbose=Fa
1175
1183
if source_id is None or schema is None :
1176
1184
raise ValueError (self .__ERROR_MSG_REQUESTED_GENERIC )
1177
1185
1178
- params_dict = {'TAPCLIENT' : 'ASTROQUERY' , 'RETRIEVAL_TYPE' : 'SPECTRA' }
1186
+ rt = str (retrieval_type ).upper ()
1187
+ if rt != 'ALL' and rt not in self .__VALID_DATALINK_RETRIEVAL_TYPES :
1188
+ raise ValueError (f"Invalid mandatory argument 'retrieval_type'. Found { retrieval_type } , "
1189
+ f"expected: 'ALL' or any of { self .__VALID_DATALINK_RETRIEVAL_TYPES } " )
1190
+
1191
+ params_dict = {}
1192
+
1179
1193
id_value = """{schema} {source_id}""" .format (** {'schema' : schema , 'source_id' : source_id })
1180
1194
params_dict ['ID' ] = id_value
1195
+ params_dict ['SCHEMA' ] = schema
1196
+ params_dict ['RETRIEVAL_TYPE' ] = str (retrieval_type )
1197
+ params_dict ['USE_ZIP_ALWAYS' ] = 'true'
1198
+ params_dict ['TAPCLIENT' ] = 'ASTROQUERY'
1181
1199
1182
1200
fits_file = source_id + '.fits'
1183
1201
output_file_full_path , output_dir = self .__set_dirs (output_file = output_file , observation_id = fits_file )
0 commit comments