From 8f0240c67bd6ff832b22c77435e790732b71f245 Mon Sep 17 00:00:00 2001 From: Philip Eisenlohr Date: Wed, 27 Apr 2022 08:59:55 -0400 Subject: [PATCH] avoid option clash in Orientation.from_fiber_component --- python/damask/_rotation.py | 14 +++++++------- python/tests/test_Orientation.py | 4 ++-- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 2963925c4..c0fea6a92 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -1096,8 +1096,8 @@ class Rotation: @staticmethod - def from_fiber_component(alpha: IntSequence, - beta: IntSequence, + def from_fiber_component(crystal: IntSequence, + sample: IntSequence, sigma: float = 0.0, shape: Union[int, IntSequence] = None, degrees: bool = True, @@ -1107,9 +1107,9 @@ class Rotation: Parameters ---------- - alpha : numpy.ndarray, shape (2) + crystal : numpy.ndarray, shape (2) Polar coordinates (phi from x, theta from z) of fiber direction in crystal frame. - beta : numpy.ndarray, shape (2) + sample : numpy.ndarray, shape (2) Polar coordinates (phi from x, theta from z) of fiber direction in sample frame. sigma : float, optional Standard deviation of (Gaussian) misorientation distribution. @@ -1117,15 +1117,15 @@ class Rotation: shape : int or sequence of ints, optional Shape of the returned array. Defaults to None, which gives a scalar. degrees : bool, optional - sigma, alpha, and beta are given in degrees. + sigma and polar coordinates are given in degrees. rng_seed : {None, int, array_like[ints], SeedSequence, BitGenerator, Generator}, optional A seed to initialize the BitGenerator. Defaults to None, i.e. unpredictable entropy will be pulled from the OS. """ rng = np.random.default_rng(rng_seed) - sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,alpha,beta)) if degrees else \ - map(np.array, (sigma,alpha,beta)) + sigma_,alpha_,beta_ = (np.radians(coordinate) for coordinate in (sigma,crystal,sample)) if degrees else \ + map(np.array, (sigma,crystal,sample)) d_cr = np.array([np.sin(alpha_[0])*np.cos(alpha_[1]), np.sin(alpha_[0])*np.sin(alpha_[1]), np.cos(alpha_[0])]) d_lab = np.array([np.sin( beta_[0])*np.cos( beta_[1]), np.sin( beta_[0])*np.sin( beta_[1]), np.cos( beta_[0])]) diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 4a7b549fd..f1dcdc478 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -150,9 +150,9 @@ class TestOrientation: == np.eye(3)) def test_from_fiber_component(self): - r = Rotation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), + r = Rotation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), sigma=0.0,shape=1,rng_seed=0) - assert np.all(Orientation.from_fiber_component(alpha=np.zeros(2),beta=np.zeros(2), + assert np.all(Orientation.from_fiber_component(crystal=np.zeros(2),sample=np.zeros(2), sigma=0.0,shape=None,rng_seed=0,family='triclinic').quaternion == r.quaternion)