Closed lmichel closed 4 months ago
Hi Laurent, This method has changed since the last version. If you install from the master branch, the behavior is:
from astroquery.simbad import Simbad
from astropy.coordinates import SkyCoord, search_around_sky, Angle
import astropy.units as u
ra = 0
dec = -90
output_table= Simbad.query_region(SkyCoord(ra, dec,unit=(u.deg, u.deg), frame='icrs'), radius=0.01*u.arcsec)
print(output_table)
<Table length=0>
main_id ra dec coo_err_maj coo_err_min coo_err_angle coo_wavelength coo_bibcode
deg deg mas mas deg
object float64 float64 float32 float32 int16 str1 object
------- ------- ------- ----------- ----------- ------------- -------------- -----------
Which returns an empty table without any warning nor errors. What do you think about this new behavior?
OK, I tried with the PIP distribution. I close the issue.
Ohhh. I haven't noticed the disappearance of the warning during the review. Can we reinstate e.g. a NoResultsWarning
, that we try to do for most cases with logically valid queries but empty responses?
As I recall the original BlankResponseWarning
and then ugly parsing of the returned error/warning from the server was due to receiving a lot of bug reports where it was difficult to see what was going on (e.g. a response was returned, but we couldn't parse it out to a Table but instead gave an ugly traceback to the users. Anyway, none of these are necessary with the new backend, but still, having a warning for no results may be useful, and consistent with the rest of astroquery.
Ohhh. I haven't noticed the disappearance of the warning during the review. Can we reinstate e.g. a
NoResultsWarning
, that we try to do for most cases with logically valid queries but empty responses?
My reasoning behind removing the warning was that by looking through astroquery, when a NoResultsWarning
is emitted, the method most often returns None
instead of a table. Sometimes it returns a plain empty Table()
object without any columns, sometimes it returns the query parameters that lead to the empty response.
Here in SIMBAD, we return a valid table with zero rows but it contains at least the meta data of the columns that would have been returned. This can also be the expected result, for example when people do a ROW_LIMIT=0
or a TOP 0
query just to test their joins before sending a big query, or to check what columns are added by a votablefield, or to see if their ADQL syntax is correct (the server returns quite detailed warnings about the ADQL syntax).
So I guess when we add the warning back I'll filter these two cases just to be sure that it does not become annoying for these use cases?
When I run the following script that queries a tiny sky region where Simbad has no object:
This code raises the following warning:
The problem is that
output_table
isNone
. There is no way to grab by software the reason of the failure except by parsing the WARNING message (awkward/ugly).There are 2 options to improve this issue:
(error_status, table)