def update(imageindex): strimageindex = '%(#)04i' % \ {"#": imageindex} filenameraw=folderraw+'/b_mehta_'+basename+'_'+strimageindex+'.raw'; f1 = open(filenameraw, "r") raw = np.fromfile(f1, dtype=np.uint32) img=raw.reshape(195,487) f1.close() img[0:3,0:3] = 0;img[194,0] = 0;img[0,486] = 0;img[194,486] = 0; img[img > 4.2e9] = 0; Image.normlz=img*fabs[int(imageindex)]; imgplot.set_data(Image.normlz) imgplot.norm=colors.LogNorm(1,Image.normlz.max()) cbar.update_bruteforce(imgplot) filenamePDI=folderpdi+'/b_mehta_'+basename+'_'+strimageindex+'.raw.pdi'; angles,Lambda=ssrl.PDIimp(filenamePDI) HKL=ssrl.angles2HKL(angles,anglescorr,a,b,c,Lambda) # Hplot.set_data(HKL[0]) # Hplot.norm=colors.Normalize(HKL[0].min(), HKL[0].max()) # cbarH.update_bruteforce(Hplot) # Kplot.set_data(HKL[1]) # Kplot.norm=colors.Normalize(HKL[1].min(), HKL[1].max()) # cbarK.update_bruteforce(Kplot) # Lplot.set_data(HKL[2]) # Lplot.norm=colors.Normalize(HKL[2].min(), HKL[2].max()) # cbarL.update_bruteforce(Lplot) plt.suptitle(basename+', imageindex = '+str(imageindex) ) scan.Ldb[int(imageindex)]=HKL[2,db[1],db[0]] scan.angles[int(imageindex),:]=angles; scan.Lambda[int(imageindex)]=Lambda;
def update(imageindex): strimageindex = '%(#)04i' % \ {"#": imageindex} filenameraw = folderraw + '/b_mehta_' + basename + '_' + strimageindex + '.raw' f1 = open(filenameraw, "r") raw = np.fromfile(f1, dtype=np.uint32) img = raw.reshape(195, 487) f1.close() img[0:3, 0:3] = 0 img[194, 0] = 0 img[0, 486] = 0 img[194, 486] = 0 img[img > 4.2e9] = 0 normlz = img * fabs[imageindex_init] imgplot.set_data(normlz) imgplot.norm = colors.LogNorm(1, normlz.max()) cbar.update_bruteforce(imgplot) #cbar.update_normal(imgplot) filenamePDI = folderpdi + '/b_mehta_' + basename + '_' + strimageindex + '.raw.pdi' angles, Lambda = ssrl.PDIimp(filenamePDI) HKL = ssrl.angles2HKL(angles, anglescorr, a, b, c, Lambda) Hplot.set_data(HKL[0]) Hplot.norm = colors.Normalize(HKL[0].min(), HKL[0].max()) cbarH.update_bruteforce(Hplot) Kplot.set_data(HKL[1]) Kplot.norm = colors.Normalize(HKL[1].min(), HKL[1].max()) cbarK.update_bruteforce(Kplot) Lplot.set_data(HKL[2]) Lplot.norm = colors.Normalize(HKL[2].min(), HKL[2].max()) cbarL.update_bruteforce(Lplot) plt.suptitle(basename + ', imageindex = ' + str(imageindex))
ii=np.arange(194) jj=np.arange(486) II, JJ = np.meshgrid(jj,ii); db=[245,118]; w=172; R = 1.020*1e6; dtth=np.degrees((db[0]-II)*w/R) dgamma=np.degrees((db[1]-JJ)*w/R) anglescorr=[dgamma,dtth] filenamePDI=folderraw+'/b_mehta_'+basename+'_'+strimageindex+'.raw.pdi'; angles,Lambda=ssrl.PDIimp(filenamePDI) #angles=[15,30,85,0] #[th tth chi phi] #anglescorr=[0,0] #Lambda= 0.885601; #wavelength in A a=3.905; b=3.905; c=3.905; HKL=ssrl.angles2HKL(angles,anglescorr,a,b,c,Lambda) display('HKL=', HKL)