Skip to content

Commit 5098d05

Browse files
committed
Rename collections --> surveys
1 parent 17d8c00 commit 5098d05

File tree

3 files changed

+30
-30
lines changed

3 files changed

+30
-30
lines changed

astroquery/eso/core.py

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ class EsoNames:
7171
raw_table = "dbo.raw"
7272
phase3_table = "ivoa.ObsCore"
7373
raw_instruments_column = "instrument"
74-
phase3_collections_column = "obs_collection"
74+
phase3_surveys_column = "obs_collection"
7575

7676
@staticmethod
7777
def ist_table(instrument_name):
@@ -108,7 +108,7 @@ class EsoClass(QueryWithLogin):
108108
def __init__(self):
109109
super().__init__()
110110
self._instruments: Optional[List[str]] = None
111-
self._collections: Optional[List[str]] = None
111+
self._surveys: Optional[List[str]] = None
112112
self._auth_info: Optional[AuthInfo] = None
113113
self._hash = None
114114
self._maxrec = None
@@ -305,8 +305,8 @@ def list_instruments(self) -> List[str]:
305305
return self._instruments
306306

307307
@unlimited_max_rec
308-
def list_collections(self) -> List[str]:
309-
""" List all the available collections (phase 3) in the ESO archive.
308+
def list_surveys(self) -> List[str]:
309+
""" List all the available surveys (phase 3) in the ESO archive.
310310
311311
Returns
312312
-------
@@ -315,14 +315,14 @@ def list_collections(self) -> List[str]:
315315
Defaults to True. If set overrides global caching behavior.
316316
See :ref:`caching documentation <astroquery_cache>`.
317317
"""
318-
if self._collections is None:
319-
self._collections = []
318+
if self._surveys is None:
319+
self._surveys = []
320320
t = EsoNames.phase3_table
321-
c = EsoNames.phase3_collections_column
321+
c = EsoNames.phase3_surveys_column
322322
query_str = f"select distinct {c} from {t}"
323323
res = self.query_tap_service(query_str)[c].data
324-
self._collections = list(res)
325-
return self._collections
324+
self._surveys = list(res)
325+
return self._surveys
326326

327327
@unlimited_max_rec
328328
def print_table_help(self, table_name: str) -> None:
@@ -386,16 +386,16 @@ def _query_on_allowed_values(
386386
message += f"Values provided: ra = {ra}, dec = {dec}, radius = {radius}"
387387
raise ValueError(message)
388388

389-
where_collections_strlist = []
389+
where_allowed_vals_strlist = []
390390
if allowed_values:
391391
if isinstance(allowed_values, str):
392392
allowed_values = _split_str_as_list_of_str(allowed_values)
393393

394394
allowed_values = list(map(lambda x: f"'{x.strip()}'", allowed_values))
395-
where_collections_strlist = [f"{column_name} in (" + ", ".join(allowed_values) + ")"]
395+
where_allowed_vals_strlist = [f"{column_name} in (" + ", ".join(allowed_values) + ")"]
396396

397397
where_constraints_strlist = [f"{k} = {adql_sanitize_val(v)}" for k, v in filters.items()]
398-
where_constraints = where_collections_strlist + where_constraints_strlist
398+
where_constraints = where_allowed_vals_strlist + where_constraints_strlist
399399
query = py2adql(table=table_name, columns=columns,
400400
ra=ra, dec=dec, radius=radius,
401401
where_constraints=where_constraints,
@@ -412,9 +412,9 @@ def _query_on_allowed_values(
412412

413413
return retval
414414

415-
def query_collections(
415+
def query_surveys(
416416
self,
417-
collections: Union[List[str], str] = None, *,
417+
surveys: Union[List[str], str] = None, *,
418418
ra: float = None, dec: float = None, radius: float = None,
419419
columns: Union[List, str] = None,
420420
top: int = None,
@@ -424,8 +424,8 @@ def query_collections(
424424
authenticated: bool = False,
425425
**kwargs) -> Union[astropy.table.Table, int, str]:
426426
return self._query_on_allowed_values(table_name=EsoNames.phase3_table,
427-
column_name=EsoNames.phase3_collections_column,
428-
allowed_values=collections,
427+
column_name=EsoNames.phase3_surveys_column,
428+
allowed_values=surveys,
429429
ra=ra, dec=dec, radius=radius,
430430
columns=columns,
431431
top=top,

astroquery/eso/tests/test_eso.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ def test_vvv(monkeypatch):
142142
# monkeypatch instructions from https://pytest.org/latest/monkeypatch.html
143143
eso = Eso()
144144
monkeypatch.setattr(eso, 'query_tap_service', monkey_tap)
145-
result = eso.query_collections(collections='VVV',
145+
result = eso.query_surveys(surveys='VVV',
146146
ra=266.41681662, dec=-29.00782497,
147147
radius=0.1775,
148148
)
@@ -155,7 +155,7 @@ def test_vvv(monkeypatch):
155155
def test_list_collections(monkeypatch):
156156
eso = Eso()
157157
monkeypatch.setattr(eso, 'query_tap_service', monkey_tap)
158-
saved_list = eso.list_collections()
158+
saved_list = eso.list_surveys()
159159
assert isinstance(saved_list, list)
160160
assert set(TEST_COLLECTIONS) <= set(saved_list)
161161

astroquery/eso/tests/test_eso_remote.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ def test_row_limit(self):
6666
assert n == eso.maxrec, f"Expected {eso.maxrec}; Obtained {n}"
6767

6868
with pytest.warns(MaxResultsWarning):
69-
table = eso.query_collections('VVV')
69+
table = eso.query_surveys('VVV')
7070
n = len(table)
7171
assert n == eso.maxrec, f"Expected {eso.maxrec}; Obtained {n}"
7272

@@ -86,7 +86,7 @@ def test_top(self):
8686
n = len(table)
8787
assert n == top, f"Expected {top}; Obtained {n}"
8888

89-
table = eso.query_collections('VVV', top=top)
89+
table = eso.query_surveys('VVV', top=top)
9090
n = len(table)
9191
assert n == top, f"Expected {top}; Obtained {n}"
9292

@@ -107,12 +107,12 @@ def test_sgrastar(self):
107107
result_i = eso.query_instrument('midi', ra=266.41681662,
108108
dec=-29.00782497, radius=1.0)
109109

110-
collections = eso.list_collections()
110+
collections = eso.list_surveys()
111111
assert len(collections) > 0
112112
# result_s = eso.query_collections('VVV', target='Sgr A*')
113113
# Equivalent, does not depend on SESAME:
114114
with pytest.warns(MaxResultsWarning):
115-
result_s = eso.query_collections(collections='VVV', ra=266.41681662,
115+
result_s = eso.query_surveys(surveys='VVV', ra=266.41681662,
116116
dec=-29.00782497,
117117
radius=1.0)
118118

@@ -142,7 +142,7 @@ def test_multicollection(self, tmp_path):
142142

143143
test_collections = ['VVV', 'XSHOOTER']
144144
with pytest.warns(MaxResultsWarning):
145-
result_s = eso.query_collections(collections=test_collections,
145+
result_s = eso.query_surveys(surveys=test_collections,
146146
ra=266.41681662,
147147
dec=-29.00782497,
148148
radius=1.0)
@@ -158,12 +158,12 @@ def test_multicollection(self, tmp_path):
158158
def test_empty_return(self):
159159
# test for empty return with an object from the North
160160
eso = Eso()
161-
collections = eso.list_collections()
161+
collections = eso.list_surveys()
162162
assert len(collections) > 0
163163

164164
# Avoid SESAME
165165
with pytest.warns(NoResultsWarning):
166-
result_s = eso.query_collections(collections=collections[0], ra=202.469575,
166+
result_s = eso.query_surveys(surveys=collections[0], ra=202.469575,
167167
dec=47.195258, radius=1.0)
168168

169169
assert len(result_s) == 0
@@ -243,23 +243,23 @@ def test_each_collection_sgrastar(self, tmp_path):
243243
eso.cache_location = tmp_path
244244
eso.maxrec = 1
245245

246-
collections = eso.list_collections()
246+
collections = eso.list_surveys()
247247
for collection in collections:
248248
if collection in SGRA_COLLECTIONS:
249249
with pytest.warns(MaxResultsWarning):
250-
result_s = eso.query_collections(
251-
collections=collection,
250+
result_s = eso.query_surveys(
251+
surveys=collection,
252252
ra=266.41681662, dec=-29.00782497, radius=0.1775)
253253
assert len(result_s) > 0
254254
else:
255255
with pytest.warns(NoResultsWarning):
256-
result_s = eso.query_collections(collections=collection, ra=266.41681662,
256+
result_s = eso.query_surveys(surveys=collection, ra=266.41681662,
257257
dec=-29.00782497,
258258
radius=0.1775)
259259
assert len(result_s) == 0, f"Failed for collection {collection}"
260260

261261
with pytest.warns(MaxResultsWarning):
262-
generic_result = eso.query_collections(collections=collection)
262+
generic_result = eso.query_surveys(surveys=collection)
263263

264264
assert generic_result is not None, \
265265
f"query_collection({collection}) returned None"

0 commit comments

Comments
 (0)