-
Notifications
You must be signed in to change notification settings - Fork 11
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
Ensure at least one pixel in header #586
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #586 +/- ##
==========================================
- Coverage 76.85% 76.79% -0.06%
==========================================
Files 69 69
Lines 8571 8575 +4
==========================================
- Hits 6587 6585 -2
- Misses 1984 1990 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
The change should be alright, although I cannot really judge the consequences either. The legacy code is weird, though. In line 213, ctype
is set to RA---TAN
if a sky WCS is to be constructed. In line 227, the WCS keyword is set to 2 * [ctype]
, which means the sky WCS will have two right-ascension axes and no declination axis. That hardly makes sense and shouldn't work if the WCS is used by an actual wcs routine. Line 213 should read
ctype = ["LINEAR", "LINEAR"] if wcs_suffix in "DX" else ["RA---TAN", "DEC--TAN"]
Yeah, the same realisation occurred to me shortly after submitting the PR. The function in question is used all the time in ScopeSim. I believe somehow assumed (without ever actually conforming this 🤦♂️) that the However, I now checked what's actually happening: The default value for the WCS suffix is an empty string (as appropriate for the 0th (sky) WCS in the header). But the check |
So probably something like
should do the trick... |
Or perhaps rather
But I'd have to check what that does for an empty string (typing on mobile, sadly no Python interpreter here...). |
Further explanation about the "DX": the "D" is obviously the detector WCS in mm, as used in ScopeSim. The "X" was added by me (I believe in the context of the off-by-one fix) as a placeholder for a "LINEAR but deg/arcsec (and not mm)" WCS, that is useful to simplify test cases. As in, once ScopeSim eventually realises that is sky is, in fact, nonlinear, we can still use this key to create simplified HDUs for testing purposes. |
logger.debug("NAXISn == 0, using minimum of 1.") | ||
naxis = np.ones_like(naxis) | ||
naxis[naxis == 0] = 1 |
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.
Line 205 is not needed, 208 shouldn't do any harm in any case, but it might be better to be safe.
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.
You're right, but I wanted to include the log message to catch any potential weird cases. I thought of going with a masked array (like we did for the NaN check) and emit the log msg based on the mask, but that seemed overkill...
Fixes #584. Not sure if there would be any unexpected negative consequences, so I included the log msg so it can be tracked down if weird things start occuring.