AstronomicalData icon indicating copy to clipboard operation
AstronomicalData copied to clipboard

query6 in 04_select.ipynb, 05_join.ipynb does not work

Open caseylam opened this issue 1 year ago • 2 comments

Thanks for making these tutorials! I am learning how to analyze Gaia data and use ADQL, and the notebooks have been very helpful.

I am having trouble running query6. It was an exercise in notebook 04 and the answer was given in notebook 05; when I try to run it it returns

HTTPError: Error 500:
null

I tried to submit query6 on https://gea.esac.esa.int/archive/ under the "Search", then "Advanced (ADQL) tab. It gives me this error:

Cannot parse query 'SELECT source_id, ra, dec, pmra, pmdec FROM gaiadr2.gaia_source WHERE parallax < 1 AND bp_rp 
BETWEEN -0.75 AND 2 AND 1 = CONTAINS(POINT(ra, dec), POLYGON(135.306, 8.39862, 126.51, 13.4449, 163.017, 54.2424, 
172.933, 46.4726, 135.306, 8.39862)) AND 1 = CONTAINS(POINT(pmra, pmdec), POLYGON( -4.05037121,-14.75623261, 
-3.41981085,-14.72365546, -3.03521988,-14.44357135, -2.26847919,-13.7140236 , -2.61172203,-13.24797471, 
-2.73471401,-13.09054471, -3.19923146,-12.5942653 , -3.34082546,-12.47611926, -5.67489413,-11.16083338, 
-5.95159272,-11.10547884, -6.42394023,-11.05981295, -7.09631023,-11.95187806, -7.30641519,-12.24559977, 
-7.04016696,-12.88580702, -6.00347705,-13.75912098, -4.42442296,-14.74641176)) ' for job '1691464891205O': 
[esavo.adql.validator.OutOfRangeException] Coordinate 0 [esavo.adql.query.operand.NegativeOperand@6aa06ef2] of POLYGON 
is out of range.

I wasn't able to figure out the issue even after some googling and documentation reading. Any chance you see the problem?

caseylam avatar Aug 08 '23 04:08 caseylam

Thanks for letting me know about these issues. I will look into them as soon as I can, but in the meantime, you might want to switch to the Foundations of Astronomical Data Science, a curriculum based on the material in this repo and maintained by The Carpentries:

https://datacarpentry.org/astronomy-python/

AllenDowney avatar Aug 08 '23 13:08 AllenDowney

Thanks for pointing me to the Carpentries curriculum site.

I went through their lessons and actually found the answer to this issue in https://datacarpentry.org/astronomy-python/05-select.html:

You may be wondering why we used BETWEEN for proper motion when we previously used POLYGON for coordinates. ADQL intends the POLYGON function to only be used on coordinates and not on proper motion. To enforce this, it will produce an error when a negative value is passed into the first argument.

caseylam avatar Aug 08 '23 16:08 caseylam