New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
can not parse the fits header with more than 2 axis #66
Comments
This is true, but in a sense ds9's fault: as ds9 does not put Stokes or frequency values into its regions even when applied to a cube, pyregion is necessarily going to have trouble applying them to images. In my ds9 radio flux measurement plugin http://github.com/mhardcastle/radioflux I go to a lot of trouble to 'flatten' radio maps down to the 2D form expected to allow pyregion to apply regions to them. I'm not sure this is logic that wants to be in pyregion itself -- e.g. what should you do if you actually have a cube, as opposed to the (1,1,y,x) shape of many radio maps? |
@henrysting @mhardcastle - There are plans to deprecate pyregions when the replacement package, regions, is mature enough. You may want to take a look at it, and raise feature requests there rather than here. Regarding the original issue, maybe the spectral-cube package is more relevant place for it. |
I have been knowing this issue, but was not quite sure what the right way to fix is. wcs = pywcs.WCS(f[0].header)
wcs_im = wcs.sub([1,2]) # index starts at 1
# wcs_im = wcs.sub([pywcs.WCSSUB_LONGITUDE, pywcs.WCSSUB_LATITUDE])
r2 = r.as_imagecoord(wcs_im) |
EDIT: the shortcut for that is just |
Does anyone here have time to make a pull request adding this example to the docs? |
I will try to test this and document it. But it might be even better if this were the default behaviour in pyregion, since ds9 regions are always spatial, and so always need to be applied to the celestial subset of wcs? |
Documented, pull request raised. |
@mhardcastle documented this in #81 .
I don't know. To me both options seem reasonable:
Another option would be to check the @leejjoon @keflavich @astrofrog - Thoughts? |
My inclination is option 2, but only when fits header is given as an argument. I would suggest that no automatic call is made If wcs object is given. Just in case of any odd cases. |
I also favor option 2. I think it should be applied even if a However, if you prefer not to do this for the |
I was just wondering if there is any corner cases where a user does not want to have the 'sub' method called. After a second thought, I think we can have 'sub' called only when the naxis is larger than 2. |
Reading through this issue and #87 and stuff linked to from there, I'm confused. Can someone involved here please comment on status in |
I believe the issue itself was fixed, but I don't think the test case is added (I have opened a new PR #113 with a simple test case). This also needs to be documented I believe. |
It can not work with the fits file which has more than 2 axis, like in radio data.
For example, a header as below :
It will cause the error:
The text was updated successfully, but these errors were encountered: