Repository navigation
has_distortion needs to be clearly documented - #3112
Conversation
|
Right - this really just means whether there are any distortion terms on top of the spherical projection. I agree the documentation should be improved. |
has_distortion needs a clear documentationhas_distortion needs to be clearly documentation
has_distortion needs to be clearly documentationhas_distortion needs to be clearly documented
|
PR attached. |
|
👍 |
|
I guess it is my fault for not being very clear about my concerns in my initial post. The problem is that the name From the SIP Convention for Representing FITS Image Distortions: "The CDi_j keywords encode skew as well as rotation and scaling. The CD-matrix values together with the higher-order distortion polynomials, as in Equations 1, 2, and 3, define a unique transformation from pixel coordinates to the plane-of-projection." That is, the linear part of the SIP is encoded in the CD matrix and if there are no higher-order coefficients in the SIP you might have a situation in which I was hoping (based on the name) that this function will check that really not distortions are present but found that it checks for that some specific attributes are I apologize for not being clear in formulating this issue in the first place. |
|
@astrofrog: Maybe you can comment as it appears you introduced the function. |
|
I'd be fine with renaming the method if it helps clarify things. It was implemented to use in |
|
@astrofrog "The idea was that I think if cubes also had extra distortions beyond the spherical projection, this would cause issues because the celestial slices wouldn't all be nicely contained in a cube 'slice'." I do not know the exact issue that you are facing (e.g., what are these "cubes"), but it sounds that Actually, in the current form, this function is useful to determine if higher than linear order distortions are present and could be used to replace the following long check in # Check that an iterative solution is required at all
# (when any of the non-CD-matrix-based corrections are
# present). If not required return the initial
# approximation (pix0).
if self.sip is None and \
self.cpdis1 is None and self.cpdis2 is None and \
self.det2im1 is None and self.det2im2 is None:
# No non-WCS corrections detected so
# simply return initial approximation:
return pix0Still, I think the current function name is misleading but I am not very prolific with function names so I cannot suggest a good replacement. |
|
@mcara - sorry, I should have been clearer regarding my comment on cubes. Imagine you have a spectral cube, so two celestial dimensions (the two first dimensions), and one spectral dimension. The question I want to answer is, are the celestial coordinates of each pixel in each spectral slice the same?. There are three things that matter here:
that is, if there are no cross terms between dimensions 0/1 and dimensions 2. Of course, there could still be cross terms between dimensions 0 and 1 but that is fine. The point is that the celestial coordinates of pixels in different slices are the same from slice to slice.
Now from my understanding of Bear in mind that you can have non-linear transformations from the spherical projections (e.g. |
|
@astrofrog - Thank you very much for this detailed answer! Because you are interested in "...additional distortions beyond the 'simple' behavior of a CD matrix" it is clear that this function does what you need. As I said, I did not know the specifics of your particular problem... |
|
@mcara - I agree. By the way, note that even with a CD matrix with no cross terms and without any SIP or other similar distortion terms, you can have non-linear mapping of pixel to world coordinates in the celestial plane (just in case it matters for your application). @mdboom - can you think of a name for the method that would make its scope clearer? |
|
Thinking about this more, I think I'd prefer to re-privatize it or tuck it away somewhere. Its usage is pretty specific to skycoord_to_pixel. As far as I can tell, it has never existed in a released version, so we can just silently move it back to |
|
Sounds good to me! |
|
Great. Then I think once Travis ok's this, this is ready to merge. |
``has_distortion`` needs to be clearly documented
|
Moving to 1.0 since I'm too lazy to move the changelog entry. |
@astrofrog @mdboom
has_distortionproperty is not documented. Based on the log entry for issue #2885 : "... as well as ahas_distortionproperty on theWCSclass that indicates whether any distortions are present." It must be clarified what does "any distortions are present" means. Based on the code, I understand that this is a convenience method that replaces multiple checks ofsip is None,cpdis1 is None, etc. with a single call tohas_distortion. However,has_distortion==Falsedoes not mean that the image is not distorted. Therefore, I believe, this must be made clear in the documentation.