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)
Hkl planes are added to the lattice and displayed. ''' # Create the Renderer and RenderWindow ren = vtk.vtkRenderer() ren.SetBackground(white) # crystal orientation o = Orientation.from_euler((15.0, -45.0, 0.0)) o = None # hexagonal lattice a = 1.0 # 0.321 # nm c = 1.5 # 0.521 # nm l = Lattice.hexagonal(a, c) grid = hexagonal_lattice_grid(l) print(np.array(HklPlane.four_to_three_indices(1, 0, -1, 0)) / 0.6) # prismatic 1 print(np.array(HklPlane.four_to_three_indices(0, 1, -1, 0)) / 0.6) # prismatic 2 print(np.array(HklPlane.four_to_three_indices(0, 1, -1, 1)) / 0.6 * 3) # pyramidal 1 print(np.array(HklPlane.four_to_three_indices(1, 1, -2, 2)) / 0.6 * 3) # pyramidal 2 print(np.array(HklPlane.four_to_three_indices(0, 0, 0, 1))) # basal p1 = HklPlane(2., 1, 0, lattice=l) # attach the plane to the hexagonal lattice p2 = HklPlane(-1, 2, 0, lattice=l) p3 = HklPlane(-3., 6., 5., lattice=l) p4 = HklPlane(3, 9, 10, lattice=l) p5 = HklPlane(0, 0, 1, lattice=l) # basal hklplanes = [p3, p5] hexagon = vtk.vtkAssembly()
Hkl planes are added to the lattice and displayed. ''' # Create the Renderer and RenderWindow ren = vtk.vtkRenderer() ren.SetBackground(white) # crystal orientation o = Orientation.from_euler((15.0, -45.0, 0.0)) o = None # hexagonal lattice a = 1.0 # 0.321 # nm c = 1.5 # 0.521 # nm l = Lattice.hexagonal(a, c) grid = hexagonal_lattice_grid(l) print np.array(HklPlane.four_to_three_indices(1, 0, -1, 0)) / 0.6 # prismatic 1 print np.array(HklPlane.four_to_three_indices(0, 1, -1, 0)) / 0.6 # prismatic 2 print np.array(HklPlane.four_to_three_indices(0, 1, -1, 1)) / 0.6 * 3 # pyramidal 1 print np.array(HklPlane.four_to_three_indices(1, 1, -2, 2)) / 0.6 * 3 # pyramidal 2 print np.array(HklPlane.four_to_three_indices(0, 0, 0, 1)) # basal p1 = HklPlane(2., 1, 0, lattice=l) # attach the plane to the hexagonal lattice p2 = HklPlane(-1, 2, 0, lattice=l) p3 = HklPlane(-3., 6., 5., lattice=l) p4 = HklPlane(3, 9, 10, lattice=l) p5 = HklPlane(0, 0, 1, lattice=l) # basal hklplanes = [p3, p5] hexagon = vtk.vtkAssembly()