#bkgd200path = '/home/nate/wimv/Data/316L_AM/Horizontal_BDup/Cr Tube/Bkgd_100_316L_horiz.xrdml' #bkgd220path = '/home/nate/wimv/Data/316L_AM/Horizontal_BDup/Cr Tube/Bkgd_100_316L_horiz.xrdml' # #bkgds = [bkgd111path,bkgd200path,bkgd220path] #bkgd = poleFigure(bkgds, hkls, crystalSym, 'xrdml',subtype='bkgd') # #pf111path = '/home/nate/wimv/Data/316L_AM/Horizontal_BDup/Cr Tube/110_pf_316L_horiz.xrdml' #pf200path = '/home/nate/wimv/Data/316L_AM/Horizontal_BDup/Cr Tube/200_pf_316L_horiz.xrdml' #pf220path = '/home/nate/wimv/Data/316L_AM/Horizontal_BDup/Cr Tube/211_pf_316L_horiz.xrdml' bkgd111path = '/home/nate/wimv/Data/32.5_ bkgd.xrdml' bkgd200path = '/home/nate/wimv/Data/55_bkgd.xrdml' bkgd220path = '/home/nate/wimv/Data/55_bkgd.xrdml' bkgds = [bkgd111path,bkgd200path,bkgd220path] bkgd = poleFigure(bkgds, hkls, crystalSym, 'xrdml',subtype='bkgd') def111path = '/home/nate/wimv/Data/defocus_38.xrdml' def200path = '/home/nate/wimv/Data/defocus_45.xrdml' def220path = '/home/nate/wimv/Data/defocus_65.xrdml' defs = [def111path,def200path,def220path] defocus = poleFigure(defs, hkls, crystalSym, 'xrdml',subtype='defocus') pf111path = '/home/nate/wimv/Data/111pf_2T=38.xrdml' pf200path = '/home/nate/wimv/Data/200pf_2T=45.xrdml' pf220path = '/home/nate/wimv/Data/220pf_2theta=65.xrdml' #bkgd111path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/Bkgd_45_Ti18_asrec.xrdml' #bkgd200path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/Bkgd_60_Ti18_asrec.xrdml' #bkgd220path = '/home/nate/wimv/ARL/Microbeam Collimator/Ti18_asrec/Bkgd_80_Ti18_asrec.xrdml'
#tube radius theta = np.deg2rad(8) #tube exponent tube_exp = 1 """ NRSF2 .jul """ #define pole figures data_path = os.path.join(dir_path, 'Data', 'HB2B - Aluminum') hkls = np.array([(2, 2, 2), (3, 1, 1), (4, 0, 0)]) pf222path = os.path.join(data_path, 'HB2B_exp129_3Chi_222.jul') pf311path = os.path.join(data_path, 'HB2B_exp129_3Chi_311.jul') pf400path = os.path.join(data_path, 'HB2B_exp129_3Chi_400.jul') #load pole figures pf = poleFigure([pf222path, pf311path, pf400path], hkls, crystalSym, 'jul') rot = R.from_euler('XZX', (90, 90, 90), degrees=True).as_matrix() """ peak-fitted pole figures """ # hkls = [] # files = [] # # datadir = os.path.join(dir_path,'Data','NOMAD Aluminum - no abs','combined') # # datadir = os.path.join(dir_path,'Data','NOMAD Nickel - full abs - peak int','pole figures','combined') # # datadir = os.path.join(dir_path,'Data','NOMAD Aluminum - no abs - peak int','combined') # # datadir = '/media/nate/2E7481AA7481757D/Users/Nate/Dropbox/ORNL/Texture/NRSF2/mtex_export' # # datadir = '/mnt/c/Users/Nate/pyReducePF/pole figures/pole figures peak int Al absCorr/combined' # datadir = '/mnt/c/Users/Nate/pyReducePF/pole figures/pole figures integ int Al absCorr 2ndFit/combined' # for file in os.listdir(datadir):
dir_path = os.path.dirname(os.path.realpath('__file__')) data_path = os.path.join(dir_path, 'Data') P = 1 crystalSym = 'm-3m' sampleSym = '1' cellSize = np.deg2rad(5) hkls = [(1, 1, 1), (2, 0, 0), (2, 2, 0)] bkgd111path = os.path.join(data_path, '32.5_ bkgd.xrdml') bkgd200path = os.path.join(data_path, '55_bkgd.xrdml') bkgd220path = os.path.join(data_path, '55_bkgd.xrdml') bkgds = [bkgd111path, bkgd200path, bkgd220path] bkgd = poleFigure(bkgds, hkls, crystalSym, 'xrdml', subtype='bkgd') def111path = os.path.join(data_path, 'defocus_38.xrdml') def200path = os.path.join(data_path, 'defocus_45.xrdml') def220path = os.path.join(data_path, 'defocus_65.xrdml') defs = [def111path, def200path, def220path] defocus = poleFigure(defs, hkls, crystalSym, 'xrdml', subtype='defocus') pf111path = os.path.join(data_path, '111pf_2T=38.xrdml') pf200path = os.path.join(data_path, '200pf_2T=45.xrdml') pf220path = os.path.join(data_path, '220pf_2theta=65.xrdml') pfs = [pf111path, pf200path, pf220path] pf = poleFigure(pfs, hkls, crystalSym, 'xrdml')
try: hkls.append(tuple([int(c) for c in pfName])) files.append(os.path.join(datadir, file)) except: #not hkls continue sortby = [sum([c**2 for c in h]) for h in hkls] hkls = [x for _, x in sorted(zip(sortby, hkls), key=lambda pair: pair[0])] files = [ x for _, x in sorted(zip(sortby, files), key=lambda pair: pair[0]) ] """ rotate """ # rot = R.from_euler('XZY',(13,-88,90), degrees=True).as_dcm() pf = poleFigure(files, hkls, crystalSym, 'nd') # pf.rotate(rot) test = np.copy(pf.y[0]) test = test[:, [0, 1, 2]] test_sph = XYZtoSPH(test, upperOnly=True) import matplotlib.pyplot as plt fig = plt.figure() ax = fig.add_subplot(projection='polar') ax.set_ylim([0, np.pi / 2]) ax.scatter(test_sph[:, 0], test_sph[:, 1])
hkls = np.array([(2,2,2), (3,1,1), (4,0,0)]) re_hkls = np.array([(1,1,1), (2,0,0), (2,2,0)]) P = 1 crystalSym = 'm-3m' sampleSym = '1' cellSize = np.deg2rad(5) theta = np.deg2rad(5) omega = np.radians(np.arange(0,360+5,5)) pf222path = os.path.join(data_path, 'HB2B_exp129_3Chi_222.jul') pf311path = os.path.join(data_path, 'HB2B_exp129_3Chi_311.jul') pf400path = os.path.join(data_path, 'HB2B_exp129_3Chi_400.jul') pfs = [pf222path,pf311path,pf400path] pf = poleFigure(pfs, hkls, crystalSym, 'jul') od = bunge(cellSize, crystalSym, sampleSym) hkls = normalize(hkls) re_hkls = normalize(re_hkls) """ ones for refl_wgt """ refl_wgt = {} for hi,h in enumerate(hkls): refl_wgt[hi] = 1 hkl_str = [''.join(tuple(map(str,h))) for h in hkls] """ rotate """
pfName = file.split(')')[0].split('(')[1] try: hkls.append(tuple([int(c) for c in pfName])) files.append(os.path.join(datadir, file)) except: #not hkls continue sortby = [sum([c**2 for c in h]) for h in hkls] hkls = [x for _, x in sorted(zip(sortby, hkls), key=lambda pair: pair[0])] files = [ x for _, x in sorted(zip(sortby, files), key=lambda pair: pair[0]) ] rot = R.from_euler('XZY', (13, -88, 90), degrees=True).as_dcm() pf = poleFigure(files, hkls, crystalSym, 'sparse') """ rotate """ pf.rotate(rot) od = bunge(cellSize, crystalSym, sampleSym) hkls = np.array(hkls) phi = np.linspace(0, 2 * pi, 73) """ symmetry after """ fibre_e = {} fibre_q = {} weights = {} refls = symmetrise(crystalSym, hkls) hkls = normalize(hkls)