Skip to content

add a test to see if pixels in the projected plane are non-square (distorted) - #3329

Merged
eteq merged 5 commits into
astropy:masterfrom
mcara:distorted_pixel
Jan 31, 2015
Merged

eteq merged 5 commits into
astropy:masterfrom
mcara:distorted_pixel

Conversation

@mcara

@mcara mcara commented Jan 22, 2015

Copy link
Copy Markdown
Contributor

Add a function that tests a WCS to see if pixels, when projected to the projection plane, remain square or if they become non-square (distorted).

Simply checking for the presence of distortion properties (sip, det2im1, etc.) is not enough to conclude whether or not pixels will look square in the projection plane - see #3112. In addition, having equal pixel scales (see, e.g., #3230) does not guarantee that pixels will be square.

This function considers that pixels will be "square" on the projection plane if:

  1. All distortion properties of the WCS object (sip, det2im1, etc.) are None; and
  2. The CD matrix corresponding to the celestial axes is orthogonal (or unitary for complex-valued CD matrices - not supported at present).

If one of the above conditions is not satisfied then pixels will be non-square.

mcara added 2 commits January 21, 2015 19:22
…storted)

Add a function that tests a WCS to see if pixels, when projected to the
projection plane, remain square or if they become non-square
(distorted).

Simply checking for the presence of distortion properties (`sip`,
`det2im1`, etc.) is not enough to conclude whether or not pixels will
look square in the projection plane - see #3112. In addition, having
equal pixel scales (see, e.g., #3230) also does not guarantee that
pixels will be square.

This function considers that pixels will be "square" on the projection
plane if:

1. all distortion properties of the WCS object (`sip`, `det2im1`, etc.)
are `None`; and

2. The CD matrix corresponding to the celestial axes is orthogonal (or
unitary for complex-valued CD matrices - not supported at present).

If one of the above conditions is not satisfied then pixels will be
non-square.
@mcara

mcara commented Jan 22, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog @nden @mdboom This PR introduces a new function that will perform a more complete test than what was previously done to see if a WCS is "distorted". It is still not "perfect" but pretty close to perfect. For example, if wcs.sip is present, this function will not check to see if SIP polynomials are of the form x' = x (identity transformation) or that distortion tables are non-zero. Otherwise, I believe this function does a more complete check for the presence of distortions.

@nden

nden commented Jan 22, 2015

Copy link
Copy Markdown
Contributor

This looks good to me. 👍 to merging into 1.0.

Comment thread astropy/wcs/utils.py Outdated

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it a relative accuracy? Or an angle in degrees?

@astrofrog

Copy link
Copy Markdown
Member

👍 apart from my small comment above.

@mcara

mcara commented Jan 22, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog Epsilon is the absolute deviation between the "normalized" (to scale) CD*CD.T matrix and the identity matrix. However, the key here is that CD matrix is normalized by the sqrt(det(CD)) before this comparison. So, then, I would say, that maxerr is the absolute error in units of scale which, kind of, makes it to be a "relative" error.

I think this needs to be made clear in the documentation, so I will try to fix this tonight.

check for matrix orthogonality was simplified and, actually, corrected.
@mcara

mcara commented Jan 23, 2015

Copy link
Copy Markdown
Contributor Author

@astrofrog The updated documentation should better describe "re-scaling" of the CD matrix.

1. default value for maxerr;
2. _is_cd_orthogonal now takes a numpy.ndarray instead of full WCS;
3. Correction to documentation.
@mcara

mcara commented Jan 27, 2015

Copy link
Copy Markdown
Contributor Author

@mdboom @astrofrog
Does this issue need anything else to be merged?

@astrofrog

Copy link
Copy Markdown
Member

@mcara - we've already done the RC (I had forgotten this was ready) but maybe we can slip it in since it doesn't affect any existing functionality and just adds a function - @eteq, what do you think?

@eteq

eteq commented Jan 31, 2015

Copy link
Copy Markdown
Member

@astrofrog - yep, I'm ok with that - this isn't a huge change and indeed it was ready well before the deadline.

@eteq eteq added this to the v1.0.0 milestone Jan 31, 2015
@eteq

eteq commented Jan 31, 2015

Copy link
Copy Markdown
Member

I'll go ahead and merge it now, and I added the 1.0 label so that will remind us to backport it prior to release.

eteq added a commit that referenced this pull request Jan 31, 2015
add a test to see if pixels in the projected plane are non-square (distorted)
@eteq
eteq merged commit 0e9d271 into astropy:master Jan 31, 2015
eteq added a commit that referenced this pull request Feb 6, 2015
add a test to see if pixels in the projected plane are non-square (distorted)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants