Skip to content

Commit 08b639f

Browse files
committed
DEP: Rename and deprecate selcols for columns
1 parent 051902d commit 08b639f

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

CHANGES.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ ipac.irsa
1212
- The IRSA module's backend has been refactored to favour VO services and to
1313
run the queries through TAP rather than Gator.
1414
New method ``query_tap`` is added to enable ADQL queries, async-named
15-
methods have been removed. The ``cache`` and ``verbose`` kwargs have been
15+
methods have been removed. The ``selcols`` kwarg has been renamed to
16+
``columns``, and the ``cache`` and ``verbose`` kwargs have been
1617
deprecated as they have no effect. [#2823]
1718

1819
gaia

astroquery/ipac/irsa/core.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ def query_tap(self, query, *, maxrec=None):
6060
log.debug(f'TAP query: {query}')
6161
return self.tap.search(query, language='ADQL', maxrec=maxrec)
6262

63-
@deprecated_renamed_argument(("cache", "verbose"), (None, None), since="0.4.7")
63+
@deprecated_renamed_argument(("selcols", "cache", "verbose"), ("columns", None, None), since="0.4.7")
6464
def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
6565
radius=10 * u.arcsec, width=None, polygon=None,
66-
get_query_payload=False, selcols=None,
66+
get_query_payload=False, columns=None,
6767
verbose=False, cache=True):
6868
"""
6969
This function serves the same purpose as
@@ -102,7 +102,7 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
102102
get_query_payload : bool, optional
103103
If `True` then returns the dictionary sent as the HTTP request.
104104
Defaults to `False`.
105-
selcols : str, optional
105+
columns : str, optional
106106
Target column list with value separated by a comma(,)
107107
108108
Returns
@@ -111,10 +111,8 @@ def query_region(self, coordinates=None, *, catalog=None, spatial='Cone',
111111
if catalog is None:
112112
raise InvalidQueryError("Catalog name is required!")
113113

114-
if selcols is None:
114+
if columns is None:
115115
columns = '*'
116-
else:
117-
columns = selcols
118116

119117
adql = f'SELECT {columns} FROM {catalog}'
120118

astroquery/ipac/irsa/tests/test_irsa_remote.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import astropy.units as u
55
from astropy.table import Table
66
from astropy.coordinates import SkyCoord
7+
from astropy.utils.exceptions import AstropyDeprecationWarning
78

89
try:
910
# This requires pyvo 1.4
@@ -32,11 +33,20 @@ def test_query_region_cone(self, coordinates):
3233
# assert all columns are returned
3334
assert len(result.colnames) == 64
3435

35-
def test_query_selcols_radius(self):
36+
def test_query_selcols_deprecated(self):
37+
"""
38+
Test renamed selcols
39+
"""
40+
with pytest.warns(AstropyDeprecationWarning, match='"selcols" was deprecated in version'):
41+
result = Irsa.query_region("m31", catalog='fp_psc', selcols='ra,dec,j_m')
42+
43+
assert result.colnames == ['ra', 'dec', 'j_m']
44+
45+
def test_query_columns_radius(self):
3646
"""
3747
Test selection of only a few columns, and using a bigger radius
3848
"""
39-
result = Irsa.query_region("m31", catalog='fp_psc', selcols='ra,dec,j_m', radius=0.5 * u.arcmin)
49+
result = Irsa.query_region("m31", catalog='fp_psc', columns='ra,dec,j_m', radius=0.5 * u.arcmin)
4050
assert len(result) == 84
4151
# assert only selected columns are returned
4252
assert result.colnames == ['ra', 'dec', 'j_m']

0 commit comments

Comments
 (0)