Skip to content

Commit dba6380

Browse files
committed
rename get_datalinks to locate_data following internal feedback
1 parent 1ce3523 commit dba6380

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

astroquery/heasarc/core.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -459,7 +459,7 @@ def query_object(self, object_name, mission, *,
459459
return self.query_region(pos, catalog=mission, spatial='cone',
460460
get_query_payload=get_query_payload)
461461

462-
def get_datalinks(self, query_result=None, catalog_name=None):
462+
def locate_data(self, query_result=None, catalog_name=None):
463463
"""Get links to data products
464464
Use vo/datalinks to query the data products for some query_results.
465465
@@ -578,7 +578,7 @@ def download_data(self, links, host='heasarc', location='.'):
578578
Parameters
579579
----------
580580
links : `astropy.table.Table`
581-
The result from get_datalinks
581+
The result from locate_data
582582
host : str
583583
The data host. The options are: heasarc (default), sciserver, aws.
584584
If host == 'sciserver', data is copied from the local mounted
@@ -605,7 +605,7 @@ def download_data(self, links, host='heasarc', location='.'):
605605
if host_column not in links.colnames:
606606
raise ValueError(
607607
f'No {host_column} column found in the table. Call '
608-
'~get_datalinks first'
608+
'~locate_data first'
609609
)
610610

611611
if host == 'heasarc':
@@ -632,7 +632,7 @@ def _download_heasarc(self, links, location='.'):
632632
Parameters
633633
----------
634634
links : `astropy.table.Table`
635-
The result from get_datalinks
635+
The result from locate_data
636636
location : str
637637
local folder where the downloaded file will be saved.
638638
Default is current working directory
@@ -666,7 +666,7 @@ def _download_heasarc(self, links, location='.'):
666666
self._download_file(self.TAR_URL, local_filepath,
667667
timeout=self.timeout,
668668
continuation=False, cache=False, method="POST",
669-
head_safe=False, data=params)
669+
head_safe=False, data=params, verbose=False)
670670

671671
# if all good and we have a tar file untar it
672672
if tarfile.is_tarfile(local_filepath):

astroquery/heasarc/tests/test_heasarc.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,17 +256,17 @@ def test__list_columns(mock_tap, mock_default_cols):
256256
assert list(cols['description']) == ['desc-2', 'desc-3']
257257

258258

259-
def test_get_datalink():
259+
def test_locate_data():
260260
with pytest.raises(ValueError, match="query_result is None"):
261-
Heasarc.get_datalinks()
261+
Heasarc.locate_data()
262262

263263
with pytest.raises(
264264
TypeError, match="query_result need to be an astropy.table.Table"
265265
):
266-
Heasarc.get_datalinks([1, 2])
266+
Heasarc.locate_data([1, 2])
267267

268268
with pytest.raises(ValueError, match="No __row column found"):
269-
Heasarc.get_datalinks(Table({"id": [1, 2, 3.0]}), catalog_name="xray")
269+
Heasarc.locate_data(Table({"id": [1, 2, 3.0]}), catalog_name="xray")
270270

271271

272272
def test_download_data__empty():
@@ -286,7 +286,7 @@ def test_download_data__missingcolumn(host):
286286
host_col = "access_url" if host == "heasarc" else host
287287
with pytest.raises(
288288
ValueError,
289-
match=f"No {host_col} column found in the table. Call ~get_datalinks first"
289+
match=f"No {host_col} column found in the table. Call ~locate_data first"
290290
):
291291
Heasarc.download_data(Table({"id": [1]}), host=host)
292292

astroquery/heasarc/tests/test_heasarc_remote.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -173,14 +173,14 @@ def test__get_default_columns(self, tdefault):
173173
remote_default = list(Heasarc._get_default_columns(catalog))
174174
assert remote_default == tdef
175175

176-
def test_get_datalinks__wrongcatalog(self):
176+
def test_locate_data__wrongcatalog(self):
177177
with pytest.raises(ValueError, match="Unknown catalog name:"):
178-
Heasarc.get_datalinks(
178+
Heasarc.locate_data(
179179
Table({"__row": [1, 2, 3.0]}), catalog_name="wrongcatalog"
180180
)
181181

182-
def test_get_datalinks__xmmmaster(self):
183-
links = Heasarc.get_datalinks(
182+
def test_locate_data__xmmmaster(self):
183+
links = Heasarc.locate_data(
184184
Table({"__row": [4154, 4155]}), catalog_name="xmmmaster"
185185
)
186186
assert len(links) == 2

docs/heasarc/heasarc.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ with those results.
184184
>>> from astropy.coordinates import SkyCoord
185185
>>> pos = SkyCoord.from_name('ngc 3516')
186186
>>> tab = Heasarc.query_region(pos, catalog='nicermastr')
187-
>>> links = Heasarc.get_datalinks(tab[:2])
187+
>>> links = Heasarc.locate_data(tab[:2])
188188
>>> links.pprint(max_width=120)
189189
ID access_url ... content_length
190190
... byte

0 commit comments

Comments
 (0)