-
Notifications
You must be signed in to change notification settings - Fork 48
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
APE 14 implementation #146
Conversation
@astrofrog @Cadair This is a start of APE14 implementation. It's pretty straightforward to implement in gwcs though some questions came up, specifically the top three in the description above may need clarification. |
gwcs/wcs.py
Outdated
return is_separable(self.forward_transform) | ||
|
||
def pixel_to_world_values(self, *pixel_arrays): | ||
# need **kwargs |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I am not convinced we do need this here, this API doesn't need to encapsulate the whole of the gWCS functionality.
Having said that I am not sure there is a problem with having it in the function signature. (Other than output
should be prohibited)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a suggestion that the result should return NaNs where there's no valid WCS solution. This is controlled by keywords and their current defaults provide this functionality. So yes, currently it's not strictly needed.
@nden - just for info, I've started a document here with issues I've encountered while implementing this on the astropy side: [will send link in slack] feel free to make suggested edits if you have any further thoughts! Once we've both had a chance to think about these issues and try and push the implementation further, my plan is to send this out to the main APE authors and then if there is agreement, to open a PR to amend the APE. |
gwcs/wcs.py
Outdated
@property | ||
def axis_correlation_matrix(self): | ||
from astropy.modeling import separable | ||
return separable.is_separable(self.forward_transform) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I dont think this is correct, the output should be a matrix. The closes I could cook up is:
s = separable.is_separable(spatial & Identity(1))
sep = np.identity(len(s), dtype=bool)
for i, a in enumerate(s):
sep[i,i] = not(a)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right. I will have to work on this. It isn't ready for review yet, especially thie property.
that said comment would be very useful.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure, I actually came here looking for how you worked this out for compoundmodels in general and ended up getting a little distracted by matrices lol
Note that astropy/astropy#7326 has now been updated and is 'ready' (apart from more tests that are needed)
This is now clarified in the APE. Note that
I don't think we allow this for now. What use case did you have in mind?
I think you can now simply implement |
The use case is passing non-coordinate inputs, like
Yes, this is fine. |
@nden - is there any reason why you couldn't essentially treat |
@astrofrog I could but it's a dict then and not a WCS object. Many of the JWST spectral pipelines are setup as one WCS object. For example an IFU observation has one WCS for all slices. The reason is that many of the transforms are the same and are shared among slices. |
@nden - actually is there any reason why you can't choose to add kwargs in this implementation since you are going to implement both the low- and high-level API? In other words, I guess the APE doesn't forbid you from doing this? |
@astrofrog Yes, I will add |
gwcs/api.py
Outdated
""" | ||
if not self.forward_transform.uses_quantity: | ||
kwargs = {'with_units': True} | ||
return self.__call__(*pixel_arrays, **kwargs) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why the __call__
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes, strictly speaking, it's not necessary.
return False | ||
|
||
def world_axis_object_classes(self): | ||
raise NotImplementedError() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the plan to implement these to facilitate a common high level API object? (In addition to gWCS implementing the high level api?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, I wasn't planning on implementing it. Is there a need for this?
@nden - can you try updating to the latest developer version of astropy to make sure that things work properly now? |
@astrofrog Done and tests passing. I'd like to merge this in about a week at the latest. If anyone has the time to review please do so before then. cc / the APE authors: @Cadair @eteq |
Last ping if anyone has time to review or intends to review it and needs more time. |
APE 14 implementation.