Skip to content

Commit 12e304d

Browse files
authored
Merge pull request #3255 from esdc-esac-esa-int/ESA_euclid_EUCLIDPCR-1914_overload_method_get_datalinks
EUCLID: Override TAP method get_datalinks
2 parents 8ede150 + e1dbfa4 commit 12e304d

File tree

3 files changed

+45
-1
lines changed

3 files changed

+45
-1
lines changed

astroquery/esa/euclid/core.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1225,5 +1225,26 @@ def get_spectrum(self, *, source_id, schema='sedm', retrieval_type="ALL", output
12251225

12261226
return files
12271227

1228+
def get_datalinks(self, ids, *, linking_parameter='SOURCE_ID', verbose=False):
1229+
"""Gets datalinks associated to the provided identifiers
1230+
TAP+ only
1231+
1232+
Parameters
1233+
----------
1234+
ids : str, int, list of str or list of int, mandatory
1235+
list of identifiers
1236+
linking_parameter : str, optional, default SOURCE_ID, valid values: SOURCE_ID
1237+
By default, all the identifiers are considered as source_id
1238+
verbose : bool, optional, default 'False'
1239+
flag to display information about the process
1240+
1241+
Returns
1242+
-------
1243+
A table object
1244+
1245+
"""
1246+
1247+
return self.__eucliddata.get_datalinks(ids=ids, linking_parameter=linking_parameter, verbose=verbose)
1248+
12281249

12291250
Euclid = EuclidClass()

astroquery/esa/euclid/tests/test_euclidtap.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1091,6 +1091,20 @@ def test_logout(mock_logout):
10911091
assert (mock_logout.call_count == 4)
10921092

10931093

1094+
def test_get_datalinks(monkeypatch):
1095+
def get_datalinks_monkeypatched(self, ids, linking_parameter, verbose):
1096+
return Table()
1097+
1098+
# `GaiaClass` is a subclass of `TapPlus`, but it does not inherit
1099+
# `get_datalinks()`, it replaces it with a call to the `get_datalinks()`
1100+
# of its `__gaiadata`.
1101+
monkeypatch.setattr(TapPlus, "get_datalinks", get_datalinks_monkeypatched)
1102+
euclid = EuclidClass(show_server_messages=False)
1103+
1104+
result = euclid.get_datalinks(ids=[12345678], verbose=True)
1105+
assert isinstance(result, Table)
1106+
1107+
10941108
def test_load_async_job(mock_querier_async):
10951109
jobid = '1479386030738O'
10961110
name = None

docs/esa/euclid/euclid.rst

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1177,8 +1177,17 @@ To find out the resources associated with a given source:
11771177
.. doctest-skip::
11781178

11791179
>>> from astroquery.esa.euclid import Euclid
1180-
>>> ids=["sedm -522481450274091664"]
1180+
>>> Euclid.login()
1181+
>>> ids=["2707008224650763513"]
11811182
>>> datalink = Euclid.get_datalinks(ids=ids)
1183+
>>> print(datalink)
1184+
ID linking_parameter access_url service_def error_message semantics description content_type content_length
1185+
byte
1186+
------------------------ ----------------- ------------------------------------------------------------------------------------------- ----------- ------------- --------- ------------------- ------------ --------------
1187+
sedm 2707008224650763513 SOURCE_ID https://eas.esac.esa.int/sas-dd/data?ID=sedm+2707008224650763513&RETRIEVAL_TYPE=SPECTRA_RGS #this Spectra Red Source --
1188+
sedm 2707008224650763513 SOURCE_ID https://eas.esac.esa.int/sas-dd/data?ID=sedm+2707008224650763513&RETRIEVAL_TYPE=SPECTRA_BGS #this Spectra Blue Source --
1189+
1190+
11821191

11831192

11841193
The query below retrieves a random sample of Euclid sources having spectra.

0 commit comments

Comments
 (0)