Skip to content

Commit 9eb2278

Browse files
authored
Merge pull request #2304 from bsipocz/sdss_specobj_crossid
Fix remaining issues with spectra Sdss.query_crossid
2 parents fa423aa + 88c99be commit 9eb2278

File tree

3 files changed

+23
-12
lines changed

3 files changed

+23
-12
lines changed

CHANGES.rst

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,14 @@ mast
3636

3737
- GALEX data is now available to download anonymously from the public STScI S3 buckets. [#2261]
3838

39-
- Adding the All-Sky PLATO Input Catalog ('plato') as a catalog option for methods of ``astroquery.mast.Catalogs``. [#2279]
39+
- Adding the All-Sky PLATO Input Catalog ('plato') as a catalog option for
40+
methods of ``astroquery.mast.Catalogs``. [#2279]
41+
42+
sdss
43+
^^^^
44+
45+
- Fix ``query_crossid`` for spectral data and DR17. [#2258, #2304]
46+
4047

4148
Infrastructure, Utility and Other Changes and Additions
4249
-------------------------------------------------------

astroquery/sdss/core.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,7 @@ def query_crossid_async(self, coordinates, obj_names=None,
138138
photobj_fields.append('p.objID as obj_id')
139139
else:
140140
photobj_fields = []
141-
specobj_fields.append('s.objID as obj_id')
141+
specobj_fields.append('s.SpecObjID as obj_id')
142142

143143
sql_query += ', '.join(photobj_fields + specobj_fields)
144144

astroquery/sdss/tests/test_sdss_remote.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
from ...exceptions import TimeoutError
1313

1414
# DR11 is a quasi-internal data release that does not have SkyServer support.
15-
dr_list = (8, 9, 10, 12, 13, 14, 15, 16)
15+
dr_list = (8, 9, 10, 12, 13, 14, 15, 16, 17)
1616

1717

1818
@pytest.mark.remote_data
@@ -166,22 +166,26 @@ def test_query_non_default_field(self):
166166
assert query1.colnames == ['r', 'psfMag_r']
167167
assert query2.colnames == ['ra', 'dec', 'r']
168168

169-
def test_query_crossid(self):
170-
query1 = sdss.SDSS.query_crossid(self.coords)
169+
# crossid doesn't work for DR<10, remove limitation once #2303 is fixed
170+
@pytest.mark.parametrize("dr", dr_list[2:])
171+
def test_query_crossid(self, dr):
172+
query1 = sdss.SDSS.query_crossid(self.coords, data_release=dr)
171173
query2 = sdss.SDSS.query_crossid([self.coords, self.coords])
172174
assert isinstance(query1, Table)
173175
assert query1['objID'][0] == 1237652943176138868
174176

175177
assert isinstance(query2, Table)
176178
assert query2['objID'][0] == query1['objID'][0] == query2['objID'][1]
177179

178-
def test_spectro_query_crossid(self):
179-
query1 = sdss.SDSS.query_crossid_async(
180-
self.coords, specobj_fields=['specObjID', 'z'], cache=False)
181-
query2 = sdss.SDSS.query_crossid_async(
182-
[self.coords, self.coords],
183-
specobj_fields=['specObjID', 'z'],
184-
cache=False)
180+
# crossid doesn't work for DR<10, remove limitation once #2303 is fixed
181+
@pytest.mark.parametrize("dr", dr_list[2:])
182+
def test_spectro_query_crossid(self, dr):
183+
query1 = sdss.SDSS.query_crossid(self.coords,
184+
specobj_fields=['specObjID', 'z'],
185+
data_release=dr, cache=False)
186+
query2 = sdss.SDSS.query_crossid([self.coords, self.coords],
187+
specobj_fields=['specObjID', 'z'],
188+
data_release=dr, cache=False)
185189
assert isinstance(query1, Table)
186190
assert query1['specObjID'][0] == 845594848269461504
187191

0 commit comments

Comments
 (0)