astropy / astropy/astroquery

SDSS.get_images() fails for some images

Open
#538 19 comments 0 reactions 0 assignees View on GitHub
bug sdss
Dominant language
Python
Stars
791
Forks
451
Avg merge
1d 3h
Merged PRs (30d)
4

Description

Example failure:

``` python
In [1]: from astroquery.sdss import SDSS

In [2]: SDSS.get_images(run=7760, camcol=4, field=33)
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
in ()
----> 1 SDSS.get_images(run=7760, camcol=4, field=33)

/usr/lib/python3.4/site-packages/astroquery/sdss/core.py in get_images(self, coordinates, radius, matches, run, rerun, camcol, field, band, timeout, cache)
679 camcol=camcol, field=field,
680 band=band, timeout=timeout,
--> 681 get_query_payload=False)
682
683 return [obj.get_fits() for obj in readable_objs]

/usr/lib/python3.4/site-packages/astroquery/sdss/core.py in get_images_async(self, coordinates, radius, matches, run, rerun, camcol, field, band, timeout, get_query_payload, cache)
643
644 if not isinstance(matches, Table):
--> 645 raise ValueError
646
647 results = []

ValueError:

In [3]:
```

The image, however, does exist: http://data.sdss3.org/fields/runCamcolField?field=33&camcol=4&run=7760

The error seems to be related to SDSS rather than astroquery. Submitting the following SQL query (taken from `request_payload`) directly through the [SkyServer](http://skyserver.sdss.org/dr12/en/tools/search/sql.aspx) will result in an empty table:

``` sql
SELECT DISTINCT p.run,p.rerun,p.camcol,p.field FROM PhotoObjAll AS p WHERE (p.run=7760 AND p.camcol=4 AND p.field=33 AND p.rerun=301)
```

I am not sure why the query fails -- maybe the field doesn't contain any primary or secondary objects?
Anyway, doing a query is redundant when using SDSS.get_images() with specified run, camcol and field, so maybe the method should be changed to bypass the query in this case?

Contributor guide

Open the contributing guide

Research direction

Start in astroquery/sdss/core.py at get_images() and get_images_async(), then reproduce the run=7760, camcol=4, field=33 example and inspect the request_payload SQL. Compare the empty SkyServer result with the field page; done means get_images() returns the existing FITS image when those identifiers are supplied.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
api, data
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.