Skip to content

Commit 4e35238

Browse files
authored
Merge pull request #2318 from weaverba137/sdss-cross-id-url
Fix cross-id for very old data releases
2 parents 428bbb4 + cd722b7 commit 4e35238

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

CHANGES.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ sdss
5858

5959
- Fix ``query_crossid`` to be able to query larger list of coordinates. [#2305]
6060

61+
- Fix ``query_crossid`` for very old data releases (< DR10). [#2318]
6162

6263

6364
Infrastructure, Utility and Other Changes and Additions

astroquery/sdss/core.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,8 @@ class SDSSClass(BaseQuery):
3232
QUERY_URL_SUFFIX_DR_OLD = '/dr{dr}/en/tools/search/x_sql.asp'
3333
QUERY_URL_SUFFIX_DR_10 = '/dr{dr}/en/tools/search/x_sql.aspx'
3434
QUERY_URL_SUFFIX_DR_NEW = '/dr{dr}/en/tools/search/x_results.aspx'
35-
XID_URL_SUFFIX_OLD = '/dr{dr}/en/tools/crossid/x_crossid.aspx'
35+
XID_URL_SUFFIX_OLD = '/dr{dr}/en/tools/crossid/x_crossid.asp'
36+
XID_URL_SUFFIX_DR_10 = '/dr{dr}/en/tools/crossid/x_crossid.aspx'
3637
XID_URL_SUFFIX_NEW = '/dr{dr}/en/tools/search/X_Results.aspx'
3738
IMAGING_URL_SUFFIX = ('{base}/dr{dr}/{instrument}/photoObj/frames/'
3839
'{rerun}/{run}/{camcol}/'
@@ -123,7 +124,7 @@ def query_crossid_async(self, coordinates, obj_names=None,
123124
raise TypeError("radius should be either Quantity or "
124125
"convertible to float.")
125126

126-
sql_query = 'SELECT '
127+
sql_query = 'SELECT\r\n' # Older versions expect the CRLF to be there.
127128

128129
if specobj_fields is None:
129130
if photoobj_fields is None:
@@ -1078,8 +1079,10 @@ def _get_query_url(self, data_release):
10781079
return url
10791080

10801081
def _get_crossid_url(self, data_release):
1081-
if data_release < 11:
1082+
if data_release < 10:
10821083
suffix = self.XID_URL_SUFFIX_OLD
1084+
elif data_release == 10:
1085+
suffix = self.XID_URL_SUFFIX_DR_10
10831086
else:
10841087
suffix = self.XID_URL_SUFFIX_NEW
10851088

astroquery/sdss/tests/test_sdss.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,9 @@ def url_tester(data_release):
136136

137137

138138
def url_tester_crossid(data_release):
139-
if data_release < 11:
139+
if data_release < 10:
140+
baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.asp'
141+
if data_release == 10:
140142
baseurl = 'http://skyserver.sdss.org/dr{}/en/tools/crossid/x_crossid.aspx'
141143
if data_release == 11:
142144
return

astroquery/sdss/tests/test_sdss_remote.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,7 @@ def test_query_non_default_field(self):
174174
assert query1.colnames == ['r', 'psfMag_r']
175175
assert query2.colnames == ['ra', 'dec', 'r']
176176

177-
# crossid doesn't work for DR<10, remove limitation once #2303 is fixed
178-
@pytest.mark.parametrize("dr", dr_list[2:])
177+
@pytest.mark.parametrize("dr", dr_list)
179178
def test_query_crossid(self, dr):
180179
query1 = sdss.SDSS.query_crossid(self.coords, data_release=dr)
181180
query2 = sdss.SDSS.query_crossid([self.coords, self.coords])
@@ -185,8 +184,7 @@ def test_query_crossid(self, dr):
185184
assert isinstance(query2, Table)
186185
assert query2['objID'][0] == query1['objID'][0] == query2['objID'][1]
187186

188-
# crossid doesn't work for DR<10, remove limitation once #2303 is fixed
189-
@pytest.mark.parametrize("dr", dr_list[2:])
187+
@pytest.mark.parametrize("dr", dr_list)
190188
def test_spectro_query_crossid(self, dr):
191189
query1 = sdss.SDSS.query_crossid(self.coords,
192190
specobj_fields=['specObjID', 'z'],

0 commit comments

Comments
 (0)