-
Notifications
You must be signed in to change notification settings - Fork 32
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
fixed queb_rotmat, handles all cdelt cases, made tests more general #289
base: master
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #289 +/- ##
==========================================
+ Coverage 39.80% 39.92% +0.11%
==========================================
Files 30 30
Lines 10439 10453 +14
==========================================
+ Hits 4155 4173 +18
+ Misses 6284 6280 -4 ☔ View full report in Codecov by Sentry. |
I should mention, I also updated a few things with cases in |
Sorry last thing: I updated the |
I like this solution to the CDELT sign problem. When noticed it early on when writing enmap, I thought I would have to flip U map's sign any time the pixel ordering was changed, if I wanted things to be consistent, and that would be slow (e.g. suddenly slicing would create a copy). I don't remember why I thought just changing queb_rotmat wouldn't be enough, but it definitely is, and is also the physically reasonable thing to do (U should be defined with respect to coordinate axes, not pixel axes). So good job! The implementation looks very verbose, though! Does it really have to be that complicated? I haven't finished thinking about this, but maybe it would be cleaner to have this in laxes instead of queb_rotmat. |
Feel free to suggest something equivalent and simpler; mathematically I am pretty confident each of these cases must be handled as they are |
Perhaps we can push and open an issue to consider simplifying in the meantime? I think it's better to have the fix (with tests) pushed, and optimize later. Fwiw, I think keeping this in |
I found some time to look at this today. This is surprisingly tricky, so I'm not finished, but I've still found some interesting stuff. The main thing is that the test in I have modified the test into two variants, one that allows the map to be complex, and another that makes sure it really is real. Here they are:
Both of these tests pass without the modifications to When it comes to test_b_sign, that's the one I'm currently stuck on. It almost works as is, except for the Nyquist-Nyquist element for doubly even dimensions, where there's a sign flip. The whole rest of Fourier space works. A bit more investigation is needed here. |
This fixes #288
The fundamental issue is that the previous
enmap.queb_rotmat
implementation did not respect symmetries required by the DFT of a real map. This induced E<->B mixing at the Nyquist frequency, where these symmetries were being violated by the sine term of the rotmat. This fix respects the symmetries, and also is consistent for all possible variations of the signs ofcdeltx
andcdelty
and well as even/odd map shapes in x and y. I added a new test to catch this.Handling the possibilities of non-standard
cdelt
was important to passtest_b_sign
in the existing tests -- basically, in the case that a user flips their map in between performingmap2harm
andharm2map
operations. I generalized this test for all possible variations of the signs ofcdeltx
andcdelty
and well as even/odd map shapes in x and y