-
-
Notifications
You must be signed in to change notification settings - Fork 40
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
Add WCS keyword to provide WCS directly. #131
base: main
Are you sure you want to change the base?
Conversation
I am not really picky about this and, if my proposal would slow down this PR - forget about it, but I would suggest that we simply get rid of the header thing. A WCS is significantly more versatile than a header. I do not think it is worth having a complicated API for the sake of saving people from crating a WCS object. In addition, for may HST instruments, a WCS created from a header only (as opposite to an That was just an idea and if people do not like it - just ignore this. I need this PR ASAP: unfortunately |
@mcara - out of curiosity, is https://github.com/astropy/regions/ still lacking features you need in cc @keflavich @cdeil |
@bsipocz I didn't know you started working on an alternative package. I can't seem to find anything that would suggest this new package can load/parse/write DS9 region files (and, why not, other formats). Did I miss something? |
@mcara |
Also, there is documentation on the ds9 io in regions: |
The comment in the second point in https://github.com/astropy/pyregion/blob/master/CHANGES.rst#api-changes is strange:
How can conversion from pixel to image coordinates depend on the center of the image??? Is this about IRAF's Lterm? @gbrammer How does this PR handle pixel->image conversion? |
@keflavich I just clicked on Getting started which does not mention region files at all. I think this feature one of the main features that I am after in such a package. Therefore, since you asked how this can be improved, I would suggest at least mentioning parsing region files in the "Getting started" section AND moving "Reading/writing to DS9 region files" section up in the "User Guide" (though, I must admit, in a hurry I stopped and clicked on the first link that I hoped would provide an overview of the package - I should have kept reading all the links). |
@mcara, my change does nothing but accept and pass around an |
@gbrammer I know. And it is fine for my purpose. I just do not understand the comment in the changelog and I have no idea what "pixel->image conversion" is and how could we take care of it if only a WCS is provided (though, for the purpose of the |
Ok, I see @mcara. I didn't update the Changelog, so I'm not sure what that is referring to. The only place where my PR actually does anything is here. I should say that my addition there doesn't do any checking that the supplied WCS is roughly consistent with the |
@gbrammer Is |
It seems that in the past |
I guess the support for the wcs has been dropped by #100. The issue was that, to calculate the angle which is consistent with the ds9 convention, we need to know the center of the image (which is calculated by NAXIS1 and NAXIS2). And my impression was that WCS does not have a public API for NAXIS?. https://github.com/astropy/pyregion/blob/master/pyregion/wcs_helper.py#L30 Given this, I think it would be better to have an explicit "wcs" keyword argument. On the other hand, I think we also need to check whether the header argument is a WCS object for the backward compatibility.
|
I added
wcs
keywords to methods throughout to allow specification of a WCS directly, rather than generating the wcs from a passedheader
. This should make it straightforward forpyregion
to parse regions specified in celestial coordinates for images with lookup-table distortion, e.g., Hubble ACS and WFC3/UVIS.If the
wcs
keyword is not specified, then behavior in all cases defaults to the current paradigm of generating the WCS directly from theheader
object as necessary.