6
6
from io import BytesIO
7
7
8
8
from astropy .table import QTable , MaskedColumn
9
- from astropy .io import ascii
10
9
from astropy .time import Time
11
10
from astropy .io .votable import parse
12
11
import astropy .units as u
13
12
from astropy .coordinates import SkyCoord , Angle
13
+ from astropy .utils .exceptions import AstropyUserWarning
14
+
15
+ from astroquery .exceptions import NoResultsWarning
16
+ from astroquery .query import BaseQuery
17
+ from astroquery .utils import async_to_sync , commons
14
18
15
- from ..query import BaseQuery
16
- from ..utils import async_to_sync , commons
17
19
from . import conf
18
20
19
21
__all__ = ['Miriade' , 'MiriadeClass' , 'Skybot' , 'SkybotClass' ]
@@ -611,6 +613,8 @@ def cone_search_async(self,
611
613
params = request_payload ,
612
614
timeout = TIMEOUT , cache = cache )
613
615
616
+ response .raise_for_status ()
617
+
614
618
self ._uri = response .url
615
619
616
620
return response
@@ -622,14 +626,17 @@ def _parse_result(self, response, *, verbose=False):
622
626
623
627
if self ._get_raw_response :
624
628
return response .text
625
- import warnings
626
- from astropy .utils .exceptions import AstropyUserWarning
629
+
627
630
with warnings .catch_warnings ():
628
631
# We deal with RA/DEC manually
629
632
warnings .filterwarnings ("ignore" , category = AstropyUserWarning ,
630
633
message = r"column ra|(column de) has a unit but is kept as a MaskedColumn" )
631
634
results = QTable .read (BytesIO (response .content ), format = 'votable' )
632
635
636
+ if len (results ) == 0 :
637
+ warnings .warn ("No objects were found with the query constraints." , NoResultsWarning )
638
+ return results
639
+
633
640
# convert coordinates to degrees
634
641
coo = SkyCoord (ra = results ['ra' ], dec = results ['de' ],
635
642
unit = (u .hourangle , u .deg ), frame = 'icrs' )
0 commit comments