def test_topotomo_tilts(self): # tests cases from ma2285 experiment on id11, omega offset = -90 T = np.array([[0, -1, 0], [1, 0, 0], [0, 0, 1]]) al = Lattice.from_symbol('Al') p = HklPlane(0, 0, 2, lattice=al) rod = [0.1449, -0.0281, 0.0616] o = Orientation.from_rodrigues(rod) (ut, lt) = o.topotomo_tilts(p, T) self.assertAlmostEqual(180 / np.pi * ut, 2.236, 3) self.assertAlmostEqual(180 / np.pi * lt, 16.615, 3) # use test case from AlLi_sam8_dct_cen_ p = HklPlane(2, 0, 2, lattice=al) rod = [0.0499, -0.3048, 0.1040] o = Orientation.from_rodrigues(rod) (ut, lt) = o.topotomo_tilts(p, T) self.assertAlmostEqual(180 / np.pi * ut, -11.04, 2) self.assertAlmostEqual(180 / np.pi * lt, -0.53, 2) # test case from ma3921 T = Orientation.compute_instrument_transformation_matrix(-1.2, 0.7, 90) Ti7Al = Lattice.hexagonal(0.2931, 0.4694) # nm (h, k, l) = HklPlane.four_to_three_indices(-1, 2, -1, 0) p = HklPlane(h, k, l, Ti7Al) o = Orientation.from_rodrigues([0.7531, 0.3537, 0.0621]) (ut, lt) = o.topotomo_tilts(p, T) self.assertAlmostEqual(180 / np.pi * ut, 11.275, 2) self.assertAlmostEqual(180 / np.pi * lt, -4.437, 2)
def test_Bragg_condition(self): al = Lattice.from_symbol('Al') p = HklPlane(0, 0, 2, lattice=al) lambda_keV = 42 lambda_nm = lambda_keV_to_nm(lambda_keV) rod = [0.1449, -0.0281, 0.0616] o = Orientation.from_rodrigues(rod) (w1, w2) = o.dct_omega_angles(p, lambda_keV, verbose=False) # test the two solution of the rotating crystal for omega in (w1, w2): alpha = o.compute_XG_angle(p, omega, verbose=True) theta_bragg = p.bragg_angle(lambda_keV) self.assertAlmostEqual(alpha, 180 / np.pi * (np.pi / 2 - theta_bragg))
def test_topotomo_tilts(self): al = Lattice.from_symbol('Al') p = HklPlane(0, 0, 2, lattice=al) rod = [0.1449, -0.0281, 0.0616] o = Orientation.from_rodrigues(rod) (ut, lt) = o.topotomo_tilts(p) self.assertAlmostEqual(180 / np.pi * ut, 2.236, 3) self.assertAlmostEqual(180 / np.pi * lt, -16.615, 3) # use test case from AlLi_sam8_dct_cen_ p = HklPlane(2, 0, 2, lattice=al) rod = [0.0499, -0.3048, 0.1040] o = Orientation.from_rodrigues(rod) (ut, lt) = o.topotomo_tilts(p) self.assertAlmostEqual(180 / np.pi * ut, -11.04, 2) self.assertAlmostEqual(180 / np.pi * lt, 0.53, 2)
def setUp(self): """testing the laue module:""" self.ni = Lattice.from_symbol('Ni') self.al = Lattice.face_centered_cubic(0.40495) self.g4 = Orientation.from_rodrigues( [0.0499199, -0.30475322, 0.10396082]) self.spots = np.array([[76, 211], [77, 281], [86, 435], [90, 563], [112, 128], [151, 459], [151, 639], [161, 543], [170, 325], [176, 248], [189, 70], [190, 375], [213, 670], [250, 167], [294, 54], [310, 153], [323, 262], [358, 444], [360, 507], [369, 163], [378, 535], [384, 86], [402, 555], [442, 139], [444, 224], [452, 565], [476, 292], [496, 88], [501, 547], [514, 166], [522, 525], [531, 433], [536, 494], [559, 264], [581, 57], [625, 168], [663, 607], [679, 69], [686, 363], [694, 240], [703, 315], [728, 437], [728, 518], [743, 609], [756, 128], [786, 413], [789, 271], [790, 534], [791, 205], [818, 123]])
def test_from_symbol(self): al = Lattice.from_symbol('Al') for i in range(0, 3): self.assertAlmostEqual(al._lengths[i], 0.40495, 4) self.assertEqual(al._angles[i], 90.0)