Skip to content

Commit b50dac9

Browse files
committed
need to explicitly set radius
1 parent 645d2b0 commit b50dac9

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

astroquery/sdss/core.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ def query_region_async(self, coordinates, *, radius=None,
295295
TypeError
296296
If the `radius`, `width` or `height` keywords could not be parsed as an angle.
297297
ValueError
298-
If both `radius` and `width or set, or if the `radius` exceeds 3 arcmin,
298+
If both `radius` and `width are set (or neither),
299+
or if the `radius` exceeds 3 arcmin,
299300
or if the sizes of `coordinates` and `obj_names` do not match.
300301
301302
Examples
@@ -313,6 +314,8 @@ def query_region_async(self, coordinates, *, radius=None,
313314
2.02344596303 14.8398237521 1237652943176138868 1739 301 3 315
314315
2.02344772021 14.8398201105 1237653651835781243 1904 301 3 163
315316
"""
317+
if radius is None and width is None:
318+
ValueError("One or the other of radius or width must be selected!")
316319
if radius is not None and width is not None:
317320
raise ValueError("One or the other of radius or width must be selected!")
318321

astroquery/sdss/tests/test_sdss.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def test_list_coordinates_region_payload(patch_request, dr):
387387
"p.ra, p.dec, p.objid, p.run, p.rerun, p.camcol, p.field "
388388
"FROM #upload u JOIN #x x ON x.up_id = u.up_id JOIN PhotoObjAll AS p ON p.objID = x.objID "
389389
"ORDER BY x.up_id")
390-
query_payload = sdss.SDSS.query_region(coords_list,
390+
query_payload = sdss.SDSS.query_region(coords_list, radius=Angle('3 arcsec'),
391391
get_query_payload=True,
392392
data_release=dr)
393393
assert query_payload['uquery'] == expect
@@ -401,7 +401,7 @@ def test_column_coordinates_region_payload(patch_request, dr):
401401
"p.ra, p.dec, p.objid, p.run, p.rerun, p.camcol, p.field "
402402
"FROM #upload u JOIN #x x ON x.up_id = u.up_id JOIN PhotoObjAll AS p ON p.objID = x.objID "
403403
"ORDER BY x.up_id")
404-
query_payload = sdss.SDSS.query_region(coords_column,
404+
query_payload = sdss.SDSS.query_region(coords_column, radius=Angle('3 arcsec'),
405405
get_query_payload=True,
406406
data_release=dr)
407407
assert query_payload['uquery'] == expect
@@ -417,7 +417,8 @@ def test_column_coordinates_region_spectro_payload(patch_request, dr):
417417
"FROM #upload u JOIN #x x ON x.up_id = u.up_id JOIN PhotoObjAll AS p ON p.objID = x.objID "
418418
"JOIN SpecObjAll AS s ON p.objID = s.bestObjID "
419419
"ORDER BY x.up_id")
420-
query_payload = sdss.SDSS.query_region(coords_column, spectro=True,
420+
query_payload = sdss.SDSS.query_region(coords_column, radius=Angle('3 arcsec'),
421+
spectro=True,
421422
get_query_payload=True,
422423
data_release=dr)
423424
assert query_payload['uquery'] == expect
@@ -431,7 +432,7 @@ def test_column_coordinates_region_payload_custom_fields(patch_request, dr):
431432
"p.r, p.psfMag_r "
432433
"FROM #upload u JOIN #x x ON x.up_id = u.up_id JOIN PhotoObjAll AS p ON p.objID = x.objID "
433434
"ORDER BY x.up_id")
434-
query_payload = sdss.SDSS.query_region(coords_column,
435+
query_payload = sdss.SDSS.query_region(coords_column, radius=Angle('3 arcsec'),
435436
get_query_payload=True,
436437
fields=['r', 'psfMag_r'],
437438
data_release=dr)

0 commit comments

Comments
 (0)