1
1
import pytest
2
- import astroquery .desi
3
2
3
+ from astroquery .desi import DESILegacySurvey
4
4
from astropy .io .fits import HDUList
5
5
from astropy .coordinates import SkyCoord
6
6
from astropy .coordinates import Angle
@@ -13,37 +13,35 @@ class TestLegacySurveyClass:
13
13
14
14
def test_query_region (self ):
15
15
16
- ra = Angle ('11h04m27s' , unit = 'hourangle' ).degree
17
- dec = Angle ('+38d12m32s' , unit = 'hourangle' ).degree
18
- coordinates = SkyCoord (ra , dec , unit = 'degree' )
16
+ coordinates = SkyCoord ('11h04m27s +38d12m32s' )
19
17
20
18
radius = Angle (5 , unit = 'arcmin' )
21
19
22
- query1 = astroquery . desi . DESILegacySurvey .query_region (coordinates , radius = radius , data_release = 9 )
20
+ query1 = DESILegacySurvey .query_region (coordinates , radius = radius , data_release = 9 )
23
21
24
22
assert isinstance (query1 , Table )
25
23
26
24
@pytest .mark .parametrize ("valid_inputs" , [True , False ])
27
25
def test_get_images (self , valid_inputs ):
28
26
29
27
if valid_inputs :
30
- ra = Angle ( '11h04m27s' , unit = 'hourangle' ). degree
31
- dec = Angle ( '+38d12m32s' , unit = 'hourangle' ). degree
32
- radius_input = 0.5 # arcmin
28
+ ra = 166.1125
29
+ dec = 38.209
30
+ radius_input = 0.5
33
31
pixels = 60
34
32
else :
35
- ra = Angle ( ' 86.633212' , unit = 'degree' ). degree
36
- dec = Angle ( ' 22.01446' , unit = 'degree' ). degree
37
- radius_input = 3 # arcmin
33
+ ra = 86.633212
34
+ dec = 22.01446
35
+ radius_input = 3
38
36
pixels = 1296000
39
37
40
38
pos = SkyCoord (ra , dec , unit = 'degree' )
41
39
radius = Angle (radius_input , unit = 'arcmin' )
42
40
43
41
if valid_inputs :
44
- query1 = astroquery . desi . DESILegacySurvey .get_images (pos , pixels , radius , data_release = 9 )
42
+ query1 = DESILegacySurvey .get_images (pos , pixels , radius , data_release = 9 )
45
43
assert isinstance (query1 , list )
46
44
assert isinstance (query1 [0 ], HDUList )
47
45
else :
48
46
with pytest .raises (NoResultsWarning ):
49
- astroquery . desi . DESILegacySurvey .get_images (pos , pixels , radius , data_release = 9 )
47
+ DESILegacySurvey .get_images (pos , pixels , radius , data_release = 9 )
0 commit comments