def test_indexation(self): """Verify indexing solution from a known Laue pattern.""" euler_angles = (191.9, 69.9, 138.9) # degrees, /!\ not in fz orientation = Orientation.from_euler(euler_angles) # list of plane normals, obtained from the detector image hkl_normals = np.array( [[0.11066932863248755, 0.8110118739480003, 0.5744667440465002], [0.10259261224575777, 0.36808036454584847, -0.9241166599236196], [0.12497400210731163, 0.38160000643453934, 0.9158400154428944], [0.21941448008210823, 0.5527234994434788, -0.8039614537359691], [0.10188581412204267, -0.17110594738052967, -0.9799704259066699], [0.10832511255237177, -0.19018912890874434, 0.975752922227471], [0.13621754927492466, -0.8942526135605741, 0.4263297343719016], [0.04704092862601945, -0.45245473334950004, -0.8905458243704446]]) miller_indices = [(3, -5, 0), (5, 4, -2), (2, -5, -1), (3, -4, -5), (2, -2, 3), (-3, 4, -3), (3, -4, 3), (3, -2, 3), (-5, 5, -1), (5, -5, 1)] hkl_planes = [] for indices in miller_indices: (h, k, l) = indices hkl_planes.append(HklPlane(h, k, l, self.ni)) solutions = index(hkl_normals, hkl_planes, tol_angle=0.5, tol_disorientation=3.0) final_orientation = Orientation(solutions[0]) angle, ax1, ax2 = final_orientation.disorientation( orientation, crystal_structure=Symmetry.cubic) self.assertLess(angle * 180 / np.pi, 1.0)
def test_small_disorientation(self): o_ref = Orientation(np.array([[-0.03454188, 0.05599919, -0.99783313], [-0.01223192, -0.99837784, -0.05560633], [-0.99932839, 0.01028467, 0.03517083]])) o_12 = Orientation(np.array([[-0.03807341, -0.06932796, -0.99686712], [-0.0234124, -0.99725469, 0.07024911], [-0.99900064, 0.02601367, 0.03634576]])) (angle, axis, axis_xyz) = o_ref.disorientation(o_12, crystal_structure=Symmetry.cubic) self.assertAlmostEqual(angle * 180 / np.pi, 7.24, 2) o_ref_fz = o_ref.move_to_FZ(symmetry=Symmetry.cubic, verbose=False) o_12_fz = o_12.move_to_FZ(symmetry=Symmetry.cubic, verbose=False) delta = np.dot(o_ref_fz.orientation_matrix(), o_12_fz.orientation_matrix().T) mis_angle = Orientation.misorientation_angle_from_delta(delta) self.assertAlmostEqual(mis_angle * 180 / np.pi, 7.24, 2)