orix icon indicating copy to clipboard operation
orix copied to clipboard

Moved to and from class methods from Rotation to Quaternion

Open anderscmathisen opened this issue 3 years ago • 0 comments

Description of the change

Because of discussions in #401, #345 and #373, it seemed like there is a need to move the to_ and from_ methods of Rotation to the Quaternion class. And so I have copy pasted them over.

I have changed little to nothing about the methods themselves, other than changing names of variables and updated docstrings.

I did not move the random_vonmises() method as that would also require the angle_with method of Rotation class to be moved as well, and I was unsure whether that should be done or not.

I included an override of from_euler in Rotation to keep the proper vs improper rotation notion as it was originally.

Progress of the PR

Minimal example of the bug fix or new feature

>>> from orix.quaternion import Quaternion, Rotation
>>> import numpy as np
>>> euler = np.random.rand(10, 3)
>>> rot = Rotation.from_euler(euler)
>>> quat = Quaternion.from_euler(euler)

For reviewers

  • [ ] The PR title is short, concise, and will make sense 1 year later.
  • [ ] New functions are imported in corresponding __init__.py.
  • [ ] New features, API changes, and deprecations are mentioned in the unreleased section in CHANGELOG.rst.
  • [ ] Contributor(s) are listed correctly in __credits__ in orix/__init__.py and in .zenodo.json.

anderscmathisen avatar Oct 21 '22 22:10 anderscmathisen