import pytest import numpy as np from damask import Rotation from damask import Orientation from damask import Lattice rot0= Rotation.from_random() rot1= Rotation.from_random() rot2= Rotation.from_random() rot3= Rotation.from_random() #disorientation #fromaverage #average class TestOrientation_vec: @pytest.mark.parametrize('model',['Bain','KS','GT','GT_prime','NW','Pitsch']) @pytest.mark.parametrize('lattice',['fcc','bcc']) def test_relatedOrientations_vec(self,model,lattice): ori0=Orientation(rot0,lattice) ori1=Orientation(rot1,lattice) ori2=Orientation(rot2,lattice) ori3=Orientation(rot3,lattice) quat=np.array([rot0.as_quaternion(),rot1.as_quaternion(),rot2.as_quaternion(),rot3.as_quaternion()]) ori_vec=Orientation(quat,lattice) for s in range(len(ori1.lattice.relationOperations(model)['rotations'])): assert all(ori_vec.relatedOrientations_vec(model).rotation.as_Eulers()[s,0] == \ ori0.relatedOrientations(model)[s].rotation.as_Eulers()) assert all(ori_vec.relatedOrientations_vec(model).rotation.as_quaternion()[s,1] == \ ori1.relatedOrientations(model)[s].rotation.as_quaternion()) assert all(ori_vec.relatedOrientations_vec(model).rotation.as_Rodrigues()[s,2] == \ ori2.relatedOrientations(model)[s].rotation.as_Rodrigues()) assert all(ori_vec.relatedOrientations_vec(model).rotation.as_cubochoric()[s,3] == \ ori3.relatedOrientations(model)[s].rotation.as_cubochoric())