コード例 #1
0
ファイル: test_Orientation.py プロジェクト: hrh741/DAMASK
 def test_relationship_reference(self, update, reference_dir, model,
                                 lattice):
     reference = os.path.join(reference_dir,
                              '{}_{}.txt'.format(lattice, model))
     ori = Orientation(Rotation(), lattice)
     eu = np.array([
         o.rotation.as_Eulers(degrees=True)
         for o in ori.relatedOrientations(model)
     ])
     if update:
         coords = np.array([(1, i + 1) for i, x in enumerate(eu)])
         table = damask.Table(eu, {'Eulers': (3, )})
         table.add('pos', coords)
         table.to_ASCII(reference)
     assert np.allclose(eu,
                        damask.Table.from_ASCII(reference).get('Eulers'))
コード例 #2
0
ファイル: test_Orientation.py プロジェクト: hrh741/DAMASK
 def test_relationship_forward_backward(self, model, lattice):
     ori = Orientation(Rotation.from_random(), lattice)
     for i, r in enumerate(ori.relatedOrientations(model)):
         ori2 = r.relatedOrientations(model)[i]
         misorientation = ori.rotation.misorientation(ori2.rotation)
         assert misorientation.asAxisAngle(degrees=True)[3] < 1.0e-5