astropy / pyregion

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

wcs_helper uses no longer existent pywcs function wcs_sky2pix #38

Closed jslavin closed 9 years ago

jslavin commented 9 years ago

Hi,

While trying out the newly updated aplpy I ran into a pyregion related issue: /export/slavin/python/anaconda/lib/python2.7/site-packages/pyregion/wcs_helper.pyc in topixel(self, xy) 316 317 # somehow, wcs_sky2pix does not work for some cases --> 318 xy21 = [self._pywcs.wcs_sky2pix([xy11], 1)[0] for xy11 in xy1] 319 #xy21 = self._pywcs.wcs_sky2pix(xy1, 1) 320

AttributeError: 'WCS' object has no attribute 'wcs_sky2pix'

It looks like this is related to an API change in astropy.wcs

Jon

keflavich commented 9 years ago

Hi @jslavin - this is also in reply to your comment on astropy-dev. Are you using the latest version of pyregion? I don't see sky2pix or pix2sky anywhere in the code base now.

jslavin commented 9 years ago

I've confirmed that simply replacing wcs_sky2pix with wcs_world2pix works. The statement in toworld() also needs to be fixed (replace pix2sky with pix2world I plan to make a pull request soon.

Jon

keflavich commented 9 years ago

@jslavin this issue was resolved in https://github.com/leejjoon/pyregion/pull/31

jslavin commented 9 years ago

Hmm. Something strange is happening. The version no. of pyregion in version.py is 1.1.2 -- the latest version -- but sky2pix is still appearing in wcs_helper.py. I even uninstalled and re-installed. I'm using anaconda version 2.1.0.

I just downloaded the tar file from pypi -- it has the old wcs_helper.py with pix2sky in it. How does one fix that?

keflavich commented 9 years ago

The pypi tarball is out of date; @leejjoon just needs to update it.

To get the latest version, you'll need to grab the github source. e.g. pip install https://github.com/leejjoon/pyregion/archive/master.zip

jslavin commented 9 years ago

Thanks Adam. The worst part though is that the pypi tarball indicates that it's the latest version (in version.py) when it isn't.

Jon

On Tue, Oct 21, 2014 at 1:09 PM, Adam Ginsburg notifications@github.com wrote:

The pypi tarball is out of date; @leejjoon https://github.com/leejjoon just needs to update it.

To get the latest version, you'll need to grab the github source. e.g. pip install https://github.com/leejjoon/pyregion/archive/master.zip

— Reply to this email directly or view it on GitHub https://github.com/leejjoon/pyregion/issues/38#issuecomment-59962106.

keflavich commented 9 years ago

Yes, I think that means that the pyregion version also needs to be changed; unfortunately, in non-astropy-affiliated packages, the version number does not automatically update so it's hard to keep track of whether you're genuinely on the latest version.

leejjoon commented 9 years ago

I apologize for my slow response. I just uploaded 1.1.4 version to pypi. Please test it and report back any problems.

astrofrog commented 9 years ago

Closing since this is resolved