Repository navigation
Ensure angle wrapping of NaN does not raise a warning. - #11568
Conversation
a897d07 to
72ce4e3
Compare
72ce4e3 to
4c9a270
Compare
|
Thanks! I now also added an actual regression test for #11558 |
ca285e6 to
d3d108a
Compare
|
Oops still had a problem with nan comparisons. Now hopefully fixed. Also rebased so that hopefully all tests will be green. |
|
It still has the problem identified in #11558, but this resolves the wrap_angle NaN problems. |
|
Oops, you are right, on older numpy the comparisons also are a problem and thus raise a warning. That means this doesn't quite fix #11558 (as you note) - my note saying otherwise was just because I tested your example on a more recent numpy... Let me add that fix too.... |
Also fix some small rounding problems.
d3d108a to
a1a598f
Compare
adrn
left a comment
There was a problem hiding this comment.
This PR looks good to me! I have one comment about overzealous wrapping, but may have just forgotten the reasoning: if so, feel free to ignore, otherwise perhaps we should discuss next Monday at the coordinates call or make an issue to discuss?
| # Note that _phi already holds our own copy if copy=True. | ||
| self._phi.wrap_at(360 * u.deg, inplace=True) |
There was a problem hiding this comment.
This is out of scope for this PR, but wondering now why we have to do this? Even in SphericalRepresentation, the longitude value gets wrapped by default because it gets passed into Longitude, which has no way to disable wrapping. But related to our discussions about internal representation of coordinate data and how we display it in frames, I wonder if we really need to wrap the data on input?
There was a problem hiding this comment.
Indeed, a good point, and it is a bit strange that we enforce the wrap angle on the user. On the other hand, for the latitude we do decide that it is between 0 and 180 (here) or 90 and -90 (for spherical). And if one converts from Cartesian one does get these specific ranges too. Anyway, my sense is to let this be for now (and certainly for this PR!).
Also fix some small rounding problems. But consolidates routines between
AngleandLongitude.fixes #11558