diff --git a/python/damask/_rotation.py b/python/damask/_rotation.py index 91f126c88..28e2b428f 100644 --- a/python/damask/_rotation.py +++ b/python/damask/_rotation.py @@ -627,12 +627,7 @@ class Rotation: return Rotation(q.reshape(r.shape[:-1]+(4,)) if shape is not None else q)._standardize() - # for compatibility (old names do not follow convention) - def asM(self): - return self.M - fromQuaternion = from_quaternion fromEulers = from_Eulers - asAxisAngle = as_axis_angle __mul__ = __matmul__ #################################################################################################### diff --git a/python/tests/test_Orientation.py b/python/tests/test_Orientation.py index 1c5288923..4a7c3e54d 100644 --- a/python/tests/test_Orientation.py +++ b/python/tests/test_Orientation.py @@ -75,7 +75,7 @@ class TestOrientation: for i,r in enumerate(ori.related(model)): ori2 = r.related(model)[i] misorientation = ori.rotation.misorientation(ori2.rotation) - assert misorientation.asAxisAngle(degrees=True)[3]<1.0e-5 + assert misorientation.as_axis_angle(degrees=True)[3]<1.0e-5 @pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch']) @pytest.mark.parametrize('lattice',['fcc','bcc']) @@ -89,3 +89,9 @@ class TestOrientation: table.add('pos',coords) table.to_ASCII(reference) assert np.allclose(eu,damask.Table.from_ASCII(reference).get('Eulers')) + + @pytest.mark.parametrize('lattice',Lattice.lattices) + def test_disorientation360(self,lattice): + R_1 = Orientation(Rotation(),lattice) + R_2 = Orientation(damask.Rotation.from_Eulers([360,0,0],degrees=True),lattice) + assert np.allclose(R_1.disorientation(R_2).as_matrix(),np.eye(3)) diff --git a/python/tests/test_Rotation.py b/python/tests/test_Rotation.py index 0cf2185c0..21d0b5fae 100644 --- a/python/tests/test_Rotation.py +++ b/python/tests/test_Rotation.py @@ -905,3 +905,15 @@ class TestRotation: def test_misorientation(self): R = Rotation.from_random() assert np.allclose(R.misorientation(R).as_matrix(),np.eye(3)) + + def test_misorientation360(self): + R_1 = Rotation() + R_2 = Rotation.from_Eulers([360,0,0],degrees=True) + assert np.allclose(R_1.misorientation(R_2).as_matrix(),np.eye(3)) + + @pytest.mark.parametrize('angle',[10,20,30,40,50,60,70,80,90,100,120]) + def test_average(self,angle): + R_1 = Rotation.from_axis_angle([0,0,1,10],degrees=True) + R_2 = Rotation.from_axis_angle([0,0,1,angle],degrees=True) + avg_angle = R_1.average(R_2).as_axis_angle(degrees=True,pair=True)[1] + assert np.isclose(avg_angle,10+(angle-10)/2.)