Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cryptic SDSS table bug #139

Closed
emirkmo opened this issue Feb 8, 2023 · 0 comments · Fixed by #150
Closed

Cryptic SDSS table bug #139

emirkmo opened this issue Feb 8, 2023 · 0 comments · Fixed by #150
Labels
bug Something isn't working

Comments

@emirkmo
Copy link
Member

emirkmo commented Feb 8, 2023

Reported on Slack by @rhandberg:

ERROR - Could not download catalog
Traceback (most recent call last):
  File "/usr/users/kasoc/flows/flows/run_catalogs.py", line 47, in main
    download_catalog(target)  # @TODO: refactor to Tendrils
  File "/usr/users/kasoc/flows/flows/flows/catalogs.py", line 592, in download_catalog
    tab = query_all(coo_centre, radius=radius, dist_cutoff=dist_cutoff)
  File "/usr/users/kasoc/flows/flows/flows/catalogs.py", line 492, in query_all
    AT_sdss, sdss = query_sdss(coo_centre, radius=radius)
  File "/usr/users/kasoc/flows/flows/flows/catalogs.py", line 301, in query_sdss
    AT_sdss = SDSS.query_region(coo_centre, photoobj_fields=['type', 'clean', 'ra', 'dec', 'psfMag_u'], data_release=dr,
  File "/usr/users/kasoc/python-virtualenv/flows-nerdrage-py3.10/lib/python3.10/site-packages/astroquery/utils/class_or_instance.py", line 25, in f
    return self.fn(obj, *args, **kwds)
  File "/usr/users/kasoc/python-virtualenv/flows-nerdrage-py3.10/lib/python3.10/site-packages/astroquery/utils/process_asyncs.py", line 29, in newmethod
    result = self._parse_result(response, verbose=verbose)
  File "/usr/users/kasoc/python-virtualenv/flows-nerdrage-py3.10/lib/python3.10/site-packages/astroquery/sdss/core.py", line 874, in _parse_result
    arr = np.atleast_1d(np.genfromtxt(io.BytesIO(response.content),
  File "/usr/users/kasoc/python-virtualenv/flows-nerdrage-py3.10/lib/python3.10/site-packages/numpy/lib/npyio.py", line 2291, in genfromtxt
    raise ValueError(errmsg)
ValueError: Some errors were detected !
    Line #62 (got 4 columns instead of 1)
    Line #124 (got 2 columns instead of 1)
    Line #125 (got 2 columns instead of 1)
    Line #131 (got 2 columns instead of 1)
    Line #132 (got 4 columns instead of 1)
    Line #133 (got 2 columns instead of 1)
    Line #134 (got 2 columns instead of 1)
    Line #137 (got 2 columns instead of 1)

This is caused by a combination of factors. We had pinned to old astroquery because of:
astropy/astroquery#2659

But now astropy/astroquery#2654 showed that SDSS queries are broken due to python web client dropping headers on redirects. However this can be worked around with fixing astroquery to a version before the PR that resolved 2659 (from September 2022, actually v0.4.6, the last stable version, still works), but a small workaround is needed:

#SDSS.MAX_CROSSID_RADIUS = radius + 1 * u.arcmin
    sdss.conf.skyserver_baseurl = sdss.conf.skyserver_baseurl.replace("http://","https://")
    AT_sdss = sdss.SDSS.query_region(coo_centre, photoobj_fields=['type', 'clean', 'ra', 'dec', 'psfMag_u'], data_release=dr,
                                timeout=600, radius=radius)

I am making a PR with this fix which makes all tests, including catalog xmatch, tns, and ztf queries pass.

@emirkmo emirkmo added the bug Something isn't working label Feb 8, 2023
@emirkmo emirkmo linked a pull request Feb 8, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant