ax2qu does not raise anymore if last dimension is 1
#493
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description of the change
ax2quconversion function throws if the arrays are multidimensional and last axis size is 1, even though they are broadcastable.I appreciate having a redundant axis in an array is not ideal, but sometimes it is easier to work with it to keep the input and output shapes consistent 😄.
I have looked into the code and there appears to be a lot of shape juggling because the internal functions are numba jitted and ultimately require 2d arrays. These lines in particluar seem to be the issue:
orix/orix/quaternion/_conversions.py
Lines 557 to 561 in 856491e
I believe we should also check here if
axes.shape[:-1] == angles.shapeand this will fix the issue.Progress of the PR
Minimal example of the bug fix or new feature
With the fix in this PR:
For reviewers
__init__.py.section in
CHANGELOG.rst.__credits__inorix/__init__.pyand in.zenodo.json.