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

Bug: query_plate_mjd_fiber error in Chapter 1 #275

Open
lxlofpku opened this issue Dec 26, 2023 · 4 comments
Open

Bug: query_plate_mjd_fiber error in Chapter 1 #275

lxlofpku opened this issue Dec 26, 2023 · 4 comments

Comments

@lxlofpku
Copy link

lxlofpku commented Dec 26, 2023

As I run the following

from astroML.datasets import tools
target = tools.TARGET_GALAXY # main galaxy sample
plt, mjd, fib = tools.query_plate_mjd_fiber(5, primtarget=target)

following the content in page 20 of the textbook, I got a 404 error. I found that the web in PUBLIC_URL = 'http://cas.sdss.org/public/en/tools/search/x_sql.aspx' in conde sql_query.py does not exist so I change it to PUBLIC_URL = 'http://cas.sdss.org/dr18/SearchTools/sql' The page can then be connected but it output the following error messages (part of the message is cut off since it is too long):


ValueError Traceback (most recent call last)
File ~/opt/anaconda3/envs/astroml/lib/python3.10/site-packages/astroML/datasets/tools/cas_query.py:77, in query_plate_mjd_fiber(n_spectra, primtarget, zmin, zmax)
76 try:
---> 77 res[i] = line.decode().strip().split(',')
78 except BaseException:

ValueError: invalid literal for int() with base 10: ''

During handling of the above exception, another exception occurred:

ValueError Traceback (most recent call last)
Cell In[1], line 3
1 from astroML.datasets import tools
2 target = tools.TARGET_GALAXY # main galaxy sample
----> 3 plt, mjd, fib = tools.query_plate_mjd_fiber(5, primtarget=target)

File ~/opt/anaconda3/envs/astroml/lib/python3.10/site-packages/astroML/datasets/tools/cas_query.py:79, in query_plate_mjd_fiber(n_spectra, primtarget, zmin, zmax)
77 res[i] = line.decode().strip().split(',')
78 except BaseException:
---> 79 raise ValueError(b'\n'.join(output))
81 ntot = i + 1
83 return res[:ntot].T

ValueError: b'\r\n\n<!doctype html>\r\n\n\r\n\n\r\n\n \r\n\n \r\n\n \r\n\n \r\n\n \r\n\n <title>SQL Search - SkyserverSDSS</title>\r\n\n\r\n\n \r\n\n \r\n\n\r\n\n \r\n\n \r\n\n \r\n\n \r\n\n\r\n\n \r\n\n \r\n\n \r\n\n \r\n\n \r\n\n <script src="https://code.jquery.com/jquery-3.4.1.min.js" integrity="sha256-CSXorXvZcTkaix6Yvo6HppcZGetbYMGWSFlBw8HfCJo=" crossorigin="anonymous"></script>\r\n\n <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>\r\n\n <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>\r\n\n \r\n\n <script src="/dr18/js/skyserver.js"></script>\r\n\n \r\n\n \r\n\n \r\n\n <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script>\r\n\n <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.3/ace.js"></script>\r\n\n <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/ace/1.4.1/ext-language_tools.js"></script>\r\n\n <script src="/dr18/js/sqlsearch.js"></script>\r\n\n\r\n\n\r\n\n\r\n\n<style>\r\n\n #supportDropdown {\r\n\n min-width: 400px;\r\n\n }\r\n\n</style>\r\n\n

\r\n\n \r\n\n \r\n\n \r\n\n
\r\n\n \r\n\n
\r\n\n
\r\n\n Sign In \r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n SELECT TOP 5 \n\n plate, mjd, fiberid \n\nFROM specObj \n\nWHERE ((PrimTarget & 64) > 0) \n\n AND (z > 0.000000) \n\n AND (z <= 0.700000) \r\n\n
\r\n\n
\r\n\n
\r\n\n \r\n\n
\r\n\n
\r\n\n
\r\n\n\r\n\n\r\n\n \r\n\n \r\n\n\r\n\n \r\n\n\r\n\n
\r\n\n
\r\n\n\r\n\n
\r\n\n \r\n\n
\r\n\n
\r\n\n
\r\n\n
\r\n\n \r\n\n
\r\n\n
\r\n\n \r\n\n
\r\n\n
\r\n\n
\r\n\n\r\n\n \r\n\n\r\n\n'


Any help will be greatly appreciated!

The version of my astroML is 1.0.2.post1

Regards,
Li-Xin

@lxlofpku
Copy link
Author

By changing the line "PUBLIC_URL = 'http://cas.sdss.org/public/en/tools/search/x_sql.aspx'" to "PUBLIC_URL = 'http://cas.sdss.org/dr7/en/tools/search/x_sql.asp'" in sql_query.py I can make it work for dr7. But how can I make it work for dr18?

@CTangist
Copy link

By changing the line "PUBLIC_URL = 'http://cas.sdss.org/public/en/tools/search/x_sql.aspx'" to "PUBLIC_URL = 'http://cas.sdss.org/dr7/en/tools/search/x_sql.asp'" in sql_query.py I can make it work for dr7. But how can I make it work for dr18?

Hello, have you resolved the issue?

@lxlofpku
Copy link
Author

By changing the line "PUBLIC_URL = 'http://cas.sdss.org/public/en/tools/search/x_sql.aspx'" to "PUBLIC_URL = 'http://cas.sdss.org/dr7/en/tools/search/x_sql.asp'" in sql_query.py I can make it work for dr7. But how can I make it work for dr18?

Hello, have you resolved the issue?

Not yet. Can anyone help?

@jotavemonte
Copy link

Hey!

This is related to #262 and will potentially be fixed by #279

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants