more tests and cleaning
This commit is contained in:
parent
a7e3dd5a56
commit
be1eb996e0
|
@ -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__
|
||||
|
||||
####################################################################################################
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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.)
|
||||
|
|
Loading…
Reference in New Issue