-
Notifications
You must be signed in to change notification settings - Fork 85
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
Fix reversing y-axis of diffraction patterns in template matching #946
Conversation
@rbjorge I don't see a reason why this can't be merged once we clean up the tests, but I'd like @din14970 to comment on it first! Out of curiosity does this match the frame of reference for Kikuchipy? I think we should try to be as internally consistent as possible. Let me know if you need any help adding tests, or fixing them! |
LGTM I suppose if tests are fixed |
Check out this pull request on See visual diffs & provide feedback on Jupyter Notebooks. Powered by ReviewNB |
I've now fixed the tests and added the notebook on conventions (not sure where to put the png file, so I put it in the same folder as the notebooks). See #925 for my answer to @CSSFrancis's question on Kikuchipy vs. pyxem conventions. I don't think that the notebooks on readthedocs.io are affected by this PR (I don't see any template matching there). However, some of the notebooks in pyxem/pyxem-demos are affected. Mainly, since the diffraction patterns are no longer flipped, the value of For the notebook Also, since the value of the Euler angles are changed by this PR, user scripts that rely on the actual numerical values will be affected (for example this one perhaps). Maybe this should somehow be included in the changelog entry? |
Thanks for getting this merged, @CSSFrancis . I see now that one consequence of this fix is that datasets that were template matched before this change, will have the template flipped when using |
What does this PR do?
This pull request seeks to fix the problem raised in issue #925. In short, diffraction patterns to be template matched currently have the y-axis reversed when template matching is performed (when they are converted to polar coordinates). This PR modifies
_warp_polar_custom()
to make the polar angle increase counter-clockwise when converting to polar coordinates. This also required changingplot_template_over_pattern()
.The root cause of this issue, as far as I can see, are the two different coordinate system origin conventions used: top-left origin in hyperspy/pyxem and bottom-left in diffsims. I think both of these make sense in their respective contexts.
There are three failing test functions:
tests.utils.test_indexation_utils.test_results_dict_to_crystal_map()
tests.utils.test_rotation_tempate_match.test_match_image_to_template()
tests.utils.test_rotation_tempate_match.test_match_image_to_template_gpu()
It's not surprising that these tests fail, so I think it is best that I get some initial feedback on this PR before I spend time modifying the tests.
To do