#calculate pole figure y's sph = np.array(np.divmod(np.ravel(pf_grid), pf_grid.shape[1])).T sph = sph * pf.res sph[:, 0] = np.where(sph[:, 0] == 0, 0.004363323, sph[:, 0]) #1/4deg tilt off center to avoid issues #convert to xyz xyz_pf = np.zeros((sph.shape[0], 3)) xyz_pf[:, 0] = np.sin(sph[:, 0]) * np.cos(sph[:, 1]) xyz_pf[:, 1] = np.sin(sph[:, 0]) * np.sin(sph[:, 1]) xyz_pf[:, 2] = np.cos(sph[:, 0]) od = bunge(cellSize, crystalSym, sampleSym) """ refl weights """ a = 4.046 #Angstrom latt = Lattice.cubic(a) structure = Structure(latt, ["Al", "Al", "Al", "Al"], [[0, 0, 0], [0.5, 0.5, 0], [0, 0.5, 0.5], [0.5, 0, 0.5]]) rad = 'CuKa' refl_wgt = calc_XRDreflWeights(structure, hkls, rad='CuKa') refl_wgt = {0: 1.0, 1: 1.0, 2: 1.0} omega = np.radians(np.arange(0, 365, 5)) """ symmetry after """ hkls = normalize(np.array(hkls))
#def200path = '/home/nate/wimv/ARL/Microbeam Collimator/Defocus_220_Si.xrdml' #def220path = '/home/nate/wimv/ARL/Microbeam Collimator/Defocus_311_Si.xrdml' # #defs = [def111path,def200path,def220path] #defocus = poleFigure(defs, hkls, crystalSym, 'xrdml',subtype='defocus') # #pf111path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/beta_110_Ti18_asrec.xrdml' #pf200path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/beta_200_Ti18_asrec.xrdml' #pf220path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/beta_211_Ti18_asrec.xrdml' pfs = [pf111path,pf200path,pf220path] pf = poleFigure(pfs, hkls, crystalSym, 'xrdml') pf.correct(bkgd=bkgd,defocus=defocus) pf.normalize() od = bunge(cellSize, crystalSym, sampleSym) pf_grid, alp, bet = pf.grid(full=True,ret_ab=True) recalc_pf, calc_od, pf_od, od_pf = wimv(pf, od, ret_pointer=True) # %% ### FIBER CALC ### import rowan from tqdm import tqdm from pyTex.orientation import ro2ax, ax2om, om2eu #calculate pole figure y's
@author: nate """ ## testing fiber import numpy as np from scipy.spatial.transform import Rotation as R from pyTex.orientation import symmetrise as symOri from pyTex.orientation import om2eu, eu2om from pyTex.utils import genSymOps from pyTex import bunge cs = 'm-3m' ss = 'mmm' od = bunge(np.deg2rad(5), cs, ss) hkl = np.array([2, 1, 3]) hkl = np.divide(hkl, np.linalg.norm(hkl)) test = R.from_euler('ZXZ', [40.5, 42.7, 85.0], degrees=True) testSym = symOri(test.as_matrix(), cs, ss) #try transpose testSym = testSym.transpose((0, 2, 1)) # convert to euler testSym_eu = om2eu(testSym) # pick fundamental zone fz = (testSym_eu[:, 0] <= 2 * np.pi) & (testSym_eu[:, 1] <= np.pi / 2) & (