consistently have input in radians

This commit is contained in:
Martin Diehl 2022-04-28 15:35:50 +02:00
parent 5c4d481155
commit a0455cadf3
2 changed files with 11 additions and 7 deletions

View File

@ -1010,7 +1010,7 @@ class Rotation:
def from_ODF(weights: np.ndarray, def from_ODF(weights: np.ndarray,
phi: np.ndarray, phi: np.ndarray,
shape: Union[int, IntSequence] = None, shape: Union[int, IntSequence] = None,
degrees: bool = True, degrees: bool = False,
fractions: bool = True, fractions: bool = True,
rng_seed: NumpyRngSeed = None) -> 'Rotation': rng_seed: NumpyRngSeed = None) -> 'Rotation':
""" """
@ -1063,7 +1063,7 @@ class Rotation:
def from_spherical_component(center: 'Rotation', def from_spherical_component(center: 'Rotation',
sigma: float, sigma: float,
shape: Union[int, IntSequence] = None, shape: Union[int, IntSequence] = None,
degrees: bool = True, degrees: bool = False,
rng_seed: NumpyRngSeed = None) -> 'Rotation': rng_seed: NumpyRngSeed = None) -> 'Rotation':
""" """
Initialize with samples from a Gaussian distribution around a given center. Initialize with samples from a Gaussian distribution around a given center.
@ -1100,7 +1100,7 @@ class Rotation:
sample: IntSequence, sample: IntSequence,
sigma: float = 0.0, sigma: float = 0.0,
shape: Union[int, IntSequence] = None, shape: Union[int, IntSequence] = None,
degrees: bool = True, degrees: bool = False,
rng_seed: NumpyRngSeed = None): rng_seed: NumpyRngSeed = None):
""" """
Initialize with samples from a Gaussian distribution around a given direction. Initialize with samples from a Gaussian distribution around a given direction.
@ -1126,10 +1126,14 @@ class Rotation:
Notes Notes
----- -----
Polar coordinates follow the conventions typically used in physics, The default crystal direction (θ=0,φ=0) direction is [0 0 1],
see https://en.wikipedia.org/wiki/Spherical_coordinate_system. the default sample direction (θ=0,φ=0) is z.
The common ranges are 0θπ and 0φ2π for a unique set of coordinates. Polar coordinates follow the ISO 80000-2:2019 convention
typically used in physics.
See https://en.wikipedia.org/wiki/Spherical_coordinate_system.
Ranges 0θπ and 0φ2π give a unique set of coordinates.
Examples Examples
-------- --------

View File

@ -1061,7 +1061,7 @@ class TestRotation:
p = [] p = []
for run in range(5): for run in range(5):
c = Rotation.from_random() c = Rotation.from_random()
o = Rotation.from_spherical_component(c,sigma,shape) o = Rotation.from_spherical_component(c,sigma,shape,degrees=True)
_, angles = c.misorientation(o).as_axis_angle(pair=True,degrees=True) _, angles = c.misorientation(o).as_axis_angle(pair=True,degrees=True)
angles[::2] *= -1 # flip angle for every second to symmetrize distribution angles[::2] *= -1 # flip angle for every second to symmetrize distribution