1414from .. import utils
1515
1616
17- @pytest .mark .skipif ('not pyregion_OK' )
18- def test_pyregion_subset ():
19- header = dict (naxis = 2 , crpix1 = 15 , crpix2 = 15 , crval1 = 0.1 , crval2 = 0.1 ,
20- cdelt1 = - 1. / 3600 , cdelt2 = 1. / 3600. , ctype1 = 'GLON-CAR' ,
21- ctype2 = 'GLAT-CAR' )
22- mywcs = wcs .WCS (header )
23- # circle with radius 10" at 0.1, 0.1
24- shape = Shape ('circle' , (0.1 , 0.1 , 10. / 3600. ))
25- shape .coord_format = 'galactic'
26- shape .coord_list = (0.1 , 0.1 , 10. / 3600. )
27- shape .attr = ([], {})
28- data = np .ones ([40 , 40 ])
29-
30- # The following line raises a DeprecationWarning from pyregion, ignore it
31- with warnings .catch_warnings ():
32- warnings .filterwarnings ('ignore' )
33- (xlo , xhi , ylo , yhi ), d = utils .pyregion_subset (shape , data , mywcs )
34-
35- # sticky note over check-engine light solution... but this problem is too
36- # large in scope to address here. See
37- # https://github.com/astropy/astropy/pull/3992
38- assert d .sum () >= 313 & d .sum () <= 315 # VERY approximately pi
39- np .testing .assert_almost_equal (xlo ,
40- data .shape [0 ] / 2 - mywcs .wcs .crpix [0 ] - 1 )
41- np .testing .assert_almost_equal (xhi ,
42- data .shape [0 ] - mywcs .wcs .crpix [0 ] - 1 )
43- np .testing .assert_almost_equal (ylo ,
44- data .shape [1 ] / 2 - mywcs .wcs .crpix [1 ] - 1 )
45- np .testing .assert_almost_equal (yhi ,
46- data .shape [1 ] - mywcs .wcs .crpix [1 ] - 1 )
47-
48-
4917frq_sup_str = ('[86.26..88.14GHz,976.56kHz, XX YY] U '
5018 '[88.15..90.03GHz,976.56kHz, XX YY] U '
5119 '[98.19..100.07GHz,976.56kHz, XX YY] U '
@@ -63,28 +31,3 @@ def test_parse_frequency_support(frq_sup_str=frq_sup_str, result=franges):
6331def approximate_primary_beam_sizes (frq_sup_str = frq_sup_str ,
6432 beamsizes = beamsizes ):
6533 assert np .all (utils .approximate_primary_beam_sizes (frq_sup_str ) == beamsizes )
66-
67-
68- @pytest .mark .remote_data
69- @pytest .mark .skipif ('not pyregion_OK' )
70- @pytest .mark .skip ('To be fixed later' )
71- def test_make_finder_chart ():
72- import matplotlib
73- matplotlib .use ('agg' )
74- if matplotlib .get_backend () != 'agg' :
75- pytest .xfail ("Matplotlib backend was incorrectly set to {0}, could "
76- "not run finder chart test." .format (matplotlib .get_backend ()))
77-
78- result = utils .make_finder_chart ('Eta Carinae' , 3 * u .arcmin ,
79- 'Eta Carinae' )
80- image , catalog , hit_mask_public , hit_mask_private = result
81-
82- assert len (catalog ) >= 6 # down to 6 on Nov 17, 2016
83- assert 3 in [int (x ) for x in hit_mask_public ]
84- # Feb 8 2016: apparently the 60s integration hasn't actually been released yet...
85- if 3 in hit_mask_public :
86- assert hit_mask_public [3 ][256 , 256 ] >= 30.23
87- elif b'3' in hit_mask_public :
88- assert hit_mask_public [b'3' ][256 , 256 ] >= 30.23
89- else :
90- raise ValueError ("hit_mask keys are not of any known type" )
0 commit comments