Changeset 2132
- Timestamp:
- Jan 22, 2016 10:10:43 AM (7 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2129 r2132 3166 3166 dsp = G2lat.Pos2dsp(Inst,peak[0]) 3167 3167 if 'T' in Type: #TOF - more cols 3168 sig = 2.35482*np.sqrt(peak[8])3168 sig = np.sqrt(peak[8]) 3169 3169 gam = peak[10] 3170 FWHM = 2.*G2pwd.getgamFW(gam,sig) #to get delta-TOF from Gam(peak)3170 FWHM = G2pwd.getgamFW(gam,sig) #to get delta-TOF from Gam(peak) 3171 3171 file.write("%10.2f %10.5f %12.2f %10.3f %10.3f %10.3f %10.3f %10.3f\n" % \ 3172 3172 (peak[0],dsp,peak[2],np.sqrt(max(0.0001,peak[4])),peak[6],peak[8],peak[10],FWHM)) 3173 3173 else: #CW 3174 sig = 2.35482*np.sqrt(peak[4])/100.3175 gam = peak[6]/100. 3176 FWHM = 2.*G2pwd.getgamFW(gam,sig) #to get delta-2-theta in deg. from Gam(peak)3174 sig = np.sqrt(peak[4])/100. #var -> sig in deg 3175 gam = peak[6]/100. #-> gam in deg 3176 FWHM = G2pwd.getgamFW(gam,sig) #to get delta-2-theta in deg. from Gam(peak) 3177 3177 file.write("%10.3f %10.5f %12.2f %10.5f %10.5f %10.5f \n" % \ 3178 3178 (peak[0],dsp,peak[2],np.sqrt(max(0.0001,peak[4]))/100.,peak[6]/100.,FWHM/100.)) #convert to deg … … 3210 3210 for peak in peaks['RefList']: 3211 3211 if 'T' in peaks.get('Type','PXC'): 3212 sig = 2.35482*np.sqrt(peak[6])3212 sig = np.sqrt(peak[6]) 3213 3213 gam = peak[7] 3214 FWHM = 2.*G2pwd.getgamFW(gam,sig)3214 FWHM = G2pwd.getgamFW(gam,sig) 3215 3215 file.write(" %3d %3d %3d %3d %10.5f %10.2f %10.5f %10.3f \n" % \ 3216 3216 (int(peak[0]),int(peak[1]),int(peak[2]),int(peak[3]),peak[4],peak[5],FWHM,peak[8])) 3217 3217 else: 3218 sig = 2.35482*np.sqrt(peak[6])/100.3218 sig = np.sqrt(peak[6])/100. 3219 3219 gam = peak[7]/100. 3220 FWHM = 2.*G2pwd.getgamFW(gam,sig)3220 FWHM = G2pwd.getgamFW(gam,sig) 3221 3221 file.write(" %3d %3d %3d %3d %10.5f %10.5f %10.5f %10.3f \n" % \ 3222 3222 (int(peak[0]),int(peak[1]),int(peak[2]),int(peak[3]),peak[4],peak[5],FWHM/100.,peak[8])) -
trunk/GSASIImath.py
r2129 r2132 4082 4082 h,k,l,m,d,pos,sig,gam,f = ref[:9] 4083 4083 if d >= MCSA['dmin']: 4084 sig = G2pwd.getgamFW(gam,sig)/sq8ln2 #--> sig from FWHM 4084 sig = np.sqrt(sig) #var -> sig in centideg 4085 sig = G2pwd.getgamFW(gam,sig)/sq8ln2 #FWHM -> sig in centideg 4085 4086 SQ = 0.25/d**2 4086 4087 allFF.append(allM*[G2el.getFFvalues(FFtables,SQ,True)[i] for i in allT]/np.max(allM)) -
trunk/GSASIIphsGUI.py
r2116 r2132 5844 5844 indx = np.searchsorted(xdata[0],pos) 5845 5845 try: 5846 FWHM = max(0.001,G2pwd.getFWHM(pos,Inst)) /100.05846 FWHM = max(0.001,G2pwd.getFWHM(pos,Inst)) 5847 5847 # We want to estimate Pawley F^2 as a drop-in replacement for F^2 calculated by the structural 5848 5848 # routines, which use Icorr * F^2 * peak profile, where peak profile has an area of 1. So -
trunk/GSASIIplot.py
r2127 r2132 2663 2663 Z = np.ones_like(X) 2664 2664 data = G2mth.setPeakparms(Parms,Parms2,X,Z) 2665 s = 1.17741*np.sqrt(data[4])*np.pi/18000.2666 g = data[6]*np.pi/ 36000.2667 G = G2pwd.getgamFW(g,s) 2665 s = np.sqrt(data[4])*np.pi/18000. #var -> sig(radians) 2666 g = data[6]*np.pi/18000. #centideg -> radians 2667 G = G2pwd.getgamFW(g,s)/2. #delt-theta 2668 2668 Y = s/nptand(X/2.) 2669 2669 Z = g/nptand(X/2.) … … 2674 2674 2675 2675 fit = G2mth.setPeakparms(Parms,Parms2,X,Z,useFit=True) 2676 sf = 1.17741*np.sqrt(fit[4])*np.pi/18000.2677 gf = fit[6]*np.pi/ 36000.2678 Gf = G2pwd.getgamFW(gf,sf) 2676 sf = np.sqrt(fit[4])*np.pi/18000. 2677 gf = fit[6]*np.pi/18000. 2678 Gf = G2pwd.getgamFW(gf,sf)/2. 2679 2679 Yf = sf/nptand(X/2.) 2680 2680 Zf = gf/nptand(X/2.) … … 2692 2692 X.append(4.0*math.pi*sind(peak[0]/2.0)/lam) 2693 2693 try: 2694 s = 1.17741*math.sqrt(peak[4])*math.pi/18000.2694 s = math.sqrt(peak[4])*math.pi/18000. 2695 2695 except ValueError: 2696 2696 s = 0.01 2697 g = peak[6]*math.pi/ 36000.2698 G = G2pwd.getgamFW(g,s) 2697 g = peak[6]*math.pi/18000. 2698 G = G2pwd.getgamFW(g,s)/2. 2699 2699 Y.append(s/tand(peak[0]/2.)) 2700 2700 Z.append(g/tand(peak[0]/2.)) -
trunk/GSASIIpwd.py
r2129 r2132 482 482 483 483 def getFWHM(pos,Inst): 484 '1.17741*pi/180 = sqrt(8ln2)/(2pi/180)' 485 sig = lambda Th,U,V,W: 1.17741*np.sqrt(max(0.001,U*tand(Th)**2+V*tand(Th)+W))*np.pi/180. 484 '''Compute total FWHM from Thompson, Cox & Hastings (1987), J. Appl. Cryst. 20, 79-83 485 via getgamFW(g,s). 486 487 :param pos: float peak position in deg 2-theta or tof in musec 488 :param Inst: dict instrument parameters 489 490 :returns float: total FWHM of pseudoVoigt in deg or musec 491 ''' 492 493 sig = lambda Th,U,V,W: np.sqrt(max(0.001,U*tand(Th)**2+V*tand(Th)+W)) 486 494 sigTOF = lambda dsp,S0,S1,S2,Sq: S0+S1*dsp**2+S2*dsp**4+Sq/dsp**2 487 gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th)) *math.pi/180.495 gam = lambda Th,X,Y: (X/cosd(Th)+Y*tand(Th)) 488 496 gamTOF = lambda dsp,X,Y: X*dsp+Y*dsp**2 489 497 if 'C' in Inst['Type'][0]: 490 s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1])*100. 491 g = gam(pos/2.,Inst['X'][1],Inst['Y'][1])*100. 498 s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1]) 499 g = gam(pos/2.,Inst['X'][1],Inst['Y'][1]) 500 return getgamFW(g,s)/100. #returns FWHM in deg 492 501 else: 493 502 dsp = pos/Inst['difC'][0] 494 503 s = sigTOF(dsp,Inst['sig-0'][1],Inst['sig-1'][1],Inst['sig-2'][1],Inst['sig-q'][1]) 495 504 g = gamTOF(dsp,Inst['X'][1],Inst['Y'][1]) 496 return getgamFW(g,s)505 return getgamFW(g,s) 497 506 498 507 def getgamFW(g,s): 499 508 '''Compute total FWHM from Thompson, Cox & Hastings (1987), J. Appl. Cryst. 20, 79-83 500 501 :param g: float Lorentzian FWHM 502 :param s: float Gaussian FWHM 509 lambda fxn needs FWHM for both Gaussian & Lorentzian components 510 511 :param g: float Lorentzian gamma = FWHM(L) 512 :param s: float Gaussian sig 503 513 504 514 :returns float: total FWHM of pseudoVoigt 505 515 ''' 506 516 gamFW = lambda s,g: np.exp(np.log(s**5+2.69269*s**4*g+2.42843*s**3*g**2+4.47163*s**2*g**3+0.07842*s*g**4+g**5)/5.) 507 return gamFW( s,g)517 return gamFW(2.35482*s,g) #sqrt(8ln2)*sig = FWHM(G) 508 518 509 519 def getFCJVoigt(pos,intens,sig,gam,shl,xdata): -
trunk/exports/G2export_csv.py
r2103 r2132 268 268 else: #convert to deg 269 269 h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:14] 270 FWHM = G2pwd.getgamFW(gam,sig) 271 self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult, \ 272 np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,i)) 270 s = np.sqrt(max(sig,0.0001))/100. #var -> sig in deg 271 g = gam/100. #-> deg 272 FWHM = G2pwd.getgamFW(g,s) 273 self.Write(fmt.format(h,k,l,m,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,i)) 273 274 else: 274 275 WriteList(self,("h","k","l",tname,"F_obs","F_calc","phase","mult","sig","gam","FWHM","Prfo","phase #")) … … 285 286 else: #convert to deg 286 287 h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,Icorr,Prfo = refItem[:13] 287 FWHM = G2pwd.getgamFW(gam,sig) 288 self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult, \ 289 np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,Prfo,i)) 288 g = gam/100. 289 s = np.sqrt(max(sig,0.0001))/100. 290 FWHM = G2pwd.getgamFW(g,s) 291 self.Write(fmt.format(h,k,l,pos,Fobs,Fcalc,phase,mult,s,g,FWHM,Prfo,i)) 290 292 self.CloseFile() 291 293 print(str(hist)+'reflections written to file '+str(self.fullpath)) -
trunk/exports/G2export_examples.py
r1997 r2132 212 212 if 'T' in phasDict['Type']: 213 213 h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:17] 214 FWHM = 2.*G2pwd.getgamFW(gam,sig)214 FWHM = G2pwd.getgamFW(gam,sig) 215 215 self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,sig,gam,FWHM,prfo)) 216 216 else: 217 217 h,k,l,m,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:14] 218 FWHM = 2.*G2pwd.getgamFW(gam,sig) 219 self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult, \ 220 np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,prfo)) 218 g = gam/100. #centideg -> deg 219 s = np.sqrt(max(sig,0.0001))/100. #var -> sig in deg 220 FWHM = G2pwd.getgamFW(g,s) #FWHM 221 self.Write(fmt.format(hklfmt.format(h,k,l,m),pos,Fobs,Fcalc,phase,mult,s,g,FWHM,prfo)) 221 222 else: 222 223 self.Write(94*'=') … … 233 234 if 'T' in phasDict['Type']: 234 235 h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,x,x,x,prfo = refItem[:16] 235 FWHM = 2.*G2pwd.getgamFW(gam,sig)236 FWHM = G2pwd.getgamFW(gam,sig) 236 237 self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult,np.sqrt(max(sig,0.0001)),gam,FWHM,prfo)) 237 238 else: 238 239 h,k,l,mult,dsp,pos,sig,gam,Fobs,Fcalc,phase,x,prfo = refItem[:13] 239 FWHM = 2.*G2pwd.getgamFW(gam,sig) 240 g = gam/100. #centideg -> deg 241 s = np.sqrt(max(sig,0.0001))/100. #var -> sig in deg 242 FWHM = G2pwd.getgamFW(g,s) 240 243 self.Write(fmt.format(hklfmt.format(h,k,l),pos,Fobs,Fcalc,phase,mult, \ 241 np.sqrt(max(sig,0.0001))/100.,gam/100.,FWHM/100.,prfo))244 s,g,FWHM,prfo)) 242 245 self.CloseFile() 243 246 print(str(hist)+'reflections written to file '+str(self.fullpath))
Note: See TracChangeset
for help on using the changeset viewer.