astropy / pyregion

ds9 region parser for python
https://pyregion.readthedocs.io
MIT License
39 stars 38 forks source link

Deprecation warnings from kapteyn #76

Closed bsipocz closed 7 years ago

bsipocz commented 7 years ago

I've turned off that these are raised as errors in #75, but obviously if someone knows how to fix them quickly it may be better. However I think it's rather low priority given #54 will get rid of this dependency.

=========================================================================== FAILURES ===========================================================================
_________________________________________________________________________ test_region __________________________________________________________________________

    def test_region():
        ref_name = "test01_img.reg"

        region_list = ["test01_fk5_sexagecimal.reg",
                       "test01_gal.reg",
                       "test01_ds9_physical.reg",
                       "test01_fk5_degree.reg",
                       "test01_mixed.reg",
                       "test01_ciao.reg",
                       "test01_ciao_physical.reg",
                       ]

        header = demo_header()

        ref_region = pyregion_open(join(rootdir, ref_name)).as_imagecoord(header)

        for reg_name in region_list:
>           r = pyregion_open(join(rootdir, reg_name)).as_imagecoord(header)

pyregion/tests/test_region.py:32: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyregion/core.py:58: in as_imagecoord
    shape_list, comment_list = zip(*list(r))
pyregion/ds9_region_parser.py:200: in sky_to_image
    rot_wrt_axis=rot_wrt_axis)
pyregion/wcs_converter.py:19: in convert_to_imagecoord
    ll = sky_to_sky([cl[0]], [cl[1]])
pyregion/wcs_helper.py:62: in __call__
    ll_dest = np.asarray(self._dotran(lonlat))
pyregion/wcs_helper.py:53: in _dotran
    xyz = longlat2xyz(lonlat)
pyregion/kapteyn_celestial.py:117: in longlat2xyz
    lon = d2r( n.asarray(longlat[:,0],'d').flatten(1) )
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

degs = array([ 171.15816667])

    def d2r(degs):
>      return degs * convd2r
E      DeprecationWarning: Non-string object detected for the array ordering. Please pass in 'C', 'F', 'A', or 'K' instead

pyregion/kapteyn_celestial.py:39: DeprecationWarning
_____________________________________________________________________ test_estimate_cdelt ______________________________________________________________________

    def test_estimate_cdelt():
        l, b = 0, 0

        # This is the ra,dec of l,b=0,0
        ra, dec = 266.404497776, -28.9364329295

        # This is 'almost' the ra,dec of l,b=0,0 - works
        # ra,dec=266.40,-28.93

        wcs = WCS(naxis=2)

        wcs.wcs.crpix = [5.5, 5.5]
        wcs.wcs.cdelt = [0.1, -0.1]
        wcs.wcs.crval = [l, b]
        wcs.wcs.ctype = ["GLON-ZEA".encode("ascii"), "GLAT-ZEA".encode("ascii")]

        proj = wcs_helper.get_kapteyn_projection(wcs)
        cdelt = wcs_helper.estimate_cdelt(proj, 5.5, 5.5)

        assert np.allclose([cdelt], [0.1])

        region_string = "fk5; circle({0}, {1}, 0.5000)".format(ra, dec)
>       reg = parse(region_string).as_imagecoord(wcs)

pyregion/tests/test_wcs_helper.py:29: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
pyregion/core.py:58: in as_imagecoord
    shape_list, comment_list = zip(*list(r))
pyregion/ds9_region_parser.py:206: in sky_to_image
    rot_wrt_axis=rot_wrt_axis)
pyregion/wcs_converter.py:19: in convert_to_imagecoord
    ll = sky_to_sky([cl[0]], [cl[1]])
pyregion/wcs_helper.py:62: in __call__
    ll_dest = np.asarray(self._dotran(lonlat))
pyregion/wcs_helper.py:53: in _dotran
    xyz = longlat2xyz(lonlat)
pyregion/kapteyn_celestial.py:117: in longlat2xyz
    lon = d2r( n.asarray(longlat[:,0],'d').flatten(1) )
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

degs = array([ 266.40449778])

    def d2r(degs):
>      return degs * convd2r
E      DeprecationWarning: Non-string object detected for the array ordering. Please pass in 'C', 'F', 'A', or 'K' instead

pyregion/kapteyn_celestial.py:39: DeprecationWarning
cdeil commented 7 years ago

The kapteyn dependency was removed by @sargas in #100. I think this issue is resolved.

Closing it now.

@bsipocz - Please re-open if there's still an issue.