Changeset 4919
- Timestamp:
- Jun 3, 2021 10:12:41 AM (3 years ago)
- Location:
- trunk
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIctrlGUI.py
r4918 r4919 5405 5405 self.dlg.Destroy() 5406 5406 ################################################################################ 5407 updateNoticeDict = { } # example: {1234:True, 5000:False}5407 updateNoticeDict = {4918:True} # example: {1234:True, 5000:False} 5408 5408 '''A dict with versions that should be noted. The value associated with the 5409 5409 tag is if all older projects should show the warning, or only the first -
trunk/GSASIImpsubs.py
r4800 r4919 75 75 Puts lots of junk into the global namespace in this module. 76 76 ''' 77 global x,ratio,shl,xB,xF,im,lamRatio,kRatio,xMask,Ka2 77 global x,ratio,shl,xB,xF,im,lamRatio,kRatio,xMask,Ka2,cw 78 78 x = ma.getdata(x1) 79 cw = np.diff(x) 80 cw = np.append(cw,cw[-1]) 79 81 ratio = ratio1 80 82 shl = shl1 … … 144 146 return -2 145 147 elif iBeg < iFin: 146 yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getFCJVoigt3(147 refl[5+im],refl[6+im],refl[7+im],shl,x[iBeg:iFin])148 fp,sumfp = G2pwd.getFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,x[iBeg:iFin]) 149 yp[iBeg:iFin] = 100.*refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp 148 150 sInt = refl[11+im]*refl[9+im] 149 151 if Ka2: … … 152 154 iBeg2 = max(xB,np.searchsorted(x,pos2-fmin)) 153 155 iFin2 = min(np.searchsorted(x,pos2+fmax),xF) 154 if iFin2 > iBeg2: 155 yp[iBeg2:iFin2] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(156 pos2,refl[6+im],refl[7+im],shl,x[iBeg2:iFin2])156 if iFin2 > iBeg2: 157 fp2,sumfp2 = G2pwd.getFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,x[iBeg2:iFin2]) 158 yp[iBeg2:iFin2] += 100.*refl[11+im]*refl[9+im]*kRatio*fp2*cw[iBeg2:iFin2]/sumfp2 157 159 sInt *= 1.+kRatio 158 160 refl8im = np.sum(np.where(ratio[iBeg:iFin2]>0.,yp[iBeg:iFin2]*ratio[iBeg:iFin2]/(refl[11+im]*(1.+kRatio)),0.0)) … … 172 174 return -2 173 175 if iBeg < iFin: 174 yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(175 refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])176 fp,sumfp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin]) 177 yp[iBeg:iFin] = refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp 176 178 refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0)) 177 179 return refl8im,refl[11+im]*refl[9+im] … … 190 192 return -2 191 193 if iBeg < iFin: 192 yp[iBeg:iFin] = refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(193 refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])194 fp,sumfp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin]) 195 yp[iBeg:iFin] = refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin]/sumfp 194 196 refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0)) 195 197 return refl8im,refl[11+im]*refl[9+im] … … 202 204 Puts lots of junk into the global namespace in this module. 203 205 ''' 204 global im,shl,x 206 global im,shl,x,cw,yc 205 207 im = im1 206 208 shl = shl1 207 209 x = ma.getdata(x1) 208 global cw209 210 cw = np.diff(x) 210 211 cw = np.append(cw,cw[-1]) 211 212 # create local copies of ycalc array 212 global yc213 213 yc = np.zeros_like(x) 214 215 214 216 215 def ComputePwdrProfCW(profList): 217 216 'Compute the peaks profile for a set of CW peaks and add into the yc array' 218 217 for pos,refl,iBeg,iFin,kRatio in profList: 219 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(220 pos,refl[6+im],refl[7+im],shl,x[iBeg:iFin])218 fp = G2pwd.getFCJVoigt3(pos,refl[6+im],refl[7+im],shl,x[iBeg:iFin])[0] 219 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*fp/cw[iBeg:iFin] 221 220 return yc 222 221 … … 224 223 'Compute the peaks profile for a set of TOF peaks and add into the yc array' 225 224 for pos,refl,iBeg,iFin in profList: 226 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt( 227 pos,refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])/cw[iBeg:iFin] 228 return yc 225 fp = G2pwd.getEpsVoigt(pos,refl[12+im],refl[13+im],refl[6+im],refl[7+im],x[iBeg:iFin])[0] 226 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp*cw[iBeg:iFin] 229 227 230 228 def ComputePwdrProfPink(profList): 231 229 'Compute the peaks profile for a set of TOF peaks and add into the yc array' 232 230 for pos,refl,iBeg,iFin in profList: 233 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(234 pos,refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])/cw[iBeg:iFin]231 fp = G2pwd.getEpsVoigt(pos,refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,x[iBeg:iFin])[0] 232 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp 235 233 return yc -
trunk/GSASIIpwd.py
r4915 r4919 718 718 """) 719 719 720 721 #GSASII peak fitting routine: Finger, Cox & Jephcoat model722 723 720 724 721 class fcjde_gen(st.rv_continuous): … … 741 738 fcj.pdf = [1/sqrt({cos(T)**2/cos(t)**2}-1) - 1/s]/|cos(T)| 742 739 743 * if x >= 0: fcj.pdf = 0 740 * if x >= 0: fcj.pdf = 0 741 744 742 """ 745 743 def _pdf(self,x,t,s,dx): … … 759 757 fcjde = fcjde_gen(name='fcjde',shapes='t,s,dx') 760 758 759 def getFCJVoigt(pos,intens,sig,gam,shl,xdata): 760 '''Compute the Finger-Cox-Jepcoat modified Voigt function for a 761 CW powder peak by direct convolution. This version is not used. 762 ''' 763 DX = xdata[1]-xdata[0] 764 widths,fmin,fmax = getWidthsCW(pos,sig,gam,shl) 765 x = np.linspace(pos-fmin,pos+fmin,256) 766 dx = x[1]-x[0] 767 Norm = norm.pdf(x,loc=pos,scale=widths[0]) 768 Cauchy = cauchy.pdf(x,loc=pos,scale=widths[1]) 769 arg = [pos,shl/57.2958,dx,] 770 FCJ = fcjde.pdf(x,*arg,loc=pos) 771 if len(np.nonzero(FCJ)[0])>5: 772 z = np.column_stack([Norm,Cauchy,FCJ]).T 773 Z = fft.fft(z) 774 Df = fft.ifft(Z.prod(axis=0)).real 775 else: 776 z = np.column_stack([Norm,Cauchy]).T 777 Z = fft.fft(z) 778 Df = fft.fftshift(fft.ifft(Z.prod(axis=0))).real 779 Df /= np.sum(Df) 780 Df = si.interp1d(x,Df,bounds_error=False,fill_value=0.0) 781 return intens*Df(xdata)*DX/dx 782 783 #### GSASII peak fitting routine: Finger, Cox & Jephcoat model 784 761 785 def getWidthsCW(pos,sig,gam,shl): 762 786 '''Compute the peak widths used for computing the range of a peak 763 787 for constant wavelength data. On low-angle side, 50 FWHM are used, 764 on high-angle side 75 are used, lowangle side extended for axial divergence788 on high-angle side 75 are used, high angle side extended for axial divergence 765 789 (for peaks above 90 deg, these are reversed.) 790 791 param pos: peak position; 2-theta in degrees 792 param sig: Gaussian peak variance in centideg^2 793 param gam: Lorentzian peak width in centidegrees 794 param shl: axial divergence parameter (S+H)/ 795 796 returns: widths; [Gaussian sigma, Lornetzian gamma] in degrees 797 returns: low angle, high angle ends of peak; 20FWHM & 50 FWHM from position 798 reverset for 2-theta > 90 deg. 766 799 ''' 767 800 widths = [np.sqrt(sig)/100.,gam/100.] … … 777 810 for constant wavelength data. 50 FWHM are used on both sides each 778 811 extended by exponential coeff. 812 813 param pos: peak position; TOF in musec 814 param alp,bet: TOF peak exponential rise & decay parameters 815 param sig: Gaussian peak variance in musec^2 816 param gam: Lorentzian peak width in musec 817 818 returns: widths; [Gaussian sigma, Lornetzian gamma] in musec 819 returns: low TOF, high TOF ends of peak; 50FWHM from position 779 820 ''' 780 821 widths = [np.sqrt(sig),gam] … … 832 873 return gamFW(2.35482*s,g) #sqrt(8ln2)*sig = FWHM(G) 833 874 834 def getFCJVoigt(pos,intens,sig,gam,shl,xdata):835 '''Compute the Finger-Cox-Jepcoat modified Voigt function for a836 CW powder peak by direct convolution. This version is not used.837 '''838 DX = xdata[1]-xdata[0]839 widths,fmin,fmax = getWidthsCW(pos,sig,gam,shl)840 x = np.linspace(pos-fmin,pos+fmin,256)841 dx = x[1]-x[0]842 Norm = norm.pdf(x,loc=pos,scale=widths[0])843 Cauchy = cauchy.pdf(x,loc=pos,scale=widths[1])844 arg = [pos,shl/57.2958,dx,]845 FCJ = fcjde.pdf(x,*arg,loc=pos)846 if len(np.nonzero(FCJ)[0])>5:847 z = np.column_stack([Norm,Cauchy,FCJ]).T848 Z = fft.fft(z)849 Df = fft.ifft(Z.prod(axis=0)).real850 else:851 z = np.column_stack([Norm,Cauchy]).T852 Z = fft.fft(z)853 Df = fft.fftshift(fft.ifft(Z.prod(axis=0))).real854 Df /= np.sum(Df)855 Df = si.interp1d(x,Df,bounds_error=False,fill_value=0.0)856 return intens*Df(xdata)*DX/dx857 858 875 def getBackground(pfx,parmDict,bakType,dataType,xdata,fixback=None): 859 876 '''Computes the background from vars pulled from gpx file or tree. … … 970 987 iFin = np.searchsorted(xdata,pkP+fmax) 971 988 if 'C' in dataType: 972 ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin]) 973 yb[iBeg:iFin] += ybi 989 ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin])[0] 990 yb[iBeg:iFin] += ybi/cw[iBeg:iFin] 974 991 elif 'T' in dataType: 975 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin]) 992 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin])[0] 976 993 yb[iBeg:iFin] += ybi 977 994 elif 'B' in dataType: 978 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin]) 995 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin])[0] 979 996 yb[iBeg:iFin] += ybi 980 997 sumBk[2] += np.sum(ybi) … … 1130 1147 '''Compute the Finger-Cox-Jepcoat modified Pseudo-Voigt function for a 1131 1148 CW powder peak in external Fortran routine 1149 1150 param pos: peak position in degrees 1151 param sig: Gaussian variance in centideg^2 1152 param gam: Lorentzian width in centideg 1153 param shl: axial divergence parameter (S+H)/L 1154 param xdata: array; profile points for peak to be calculated; bounded by 20FWHM to 50FWHM (or vv) 1155 1156 returns: array: calculated peak function at each xdata 1157 returns: integral of peak; nominally = 1.0 1132 1158 ''' 1133 Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) 1134 Df /= np.sum(Df) 1135 return Df 1159 if len(xdata): 1160 cw = np.diff(xdata) 1161 cw = np.append(cw,cw[-1]) 1162 Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) 1163 return Df,np.sum(100.*Df*cw) 1164 else: 1165 return 0.,1. 1136 1166 1137 1167 def getdFCJVoigt3(pos,sig,gam,shl,xdata): 1138 1168 '''Compute analytic derivatives the Finger-Cox-Jepcoat modified Pseudo-Voigt 1139 1169 function for a CW powder peak 1170 1171 param pos: peak position in degrees 1172 param sig: Gaussian variance in centideg^2 1173 param gam: Lorentzian width in centideg 1174 param shl: axial divergence parameter (S+H)/L 1175 param xdata: array; profile points for peak to be calculated; bounded by 20FWHM to 50FWHM (or vv) 1176 1177 returns: arrays: function and derivatives of pos, sig, gam, & shl 1140 1178 ''' 1141 1179 Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) … … 1145 1183 '''Compute the simple Pseudo-Voigt function for a 1146 1184 small angle Bragg peak in external Fortran routine 1185 1186 param pos: peak position in degrees 1187 param sig: Gaussian variance in centideg^2 1188 param gam: Lorentzian width in centideg 1189 1190 returns: array: calculated peak function at each xdata 1191 returns: integral of peak; nominally = 1.0 1147 1192 ''' 1148 1193 1194 cw = np.diff(xdata) 1195 cw = np.append(cw,cw[-1]) 1149 1196 Df = pyd.pypsvoigt(len(xdata),xdata-pos,sig,gam) 1150 Df /= np.sum(Df) 1151 return Df 1197 return Df,np.sum(100.*Df*cw) 1152 1198 1153 1199 def getdPsVoigt(pos,sig,gam,xdata): 1154 1200 '''Compute the simple Pseudo-Voigt function derivatives for a 1155 1201 small angle Bragg peak peak in external Fortran routine 1202 1203 param pos: peak position in degrees 1204 param sig: Gaussian variance in centideg^2 1205 param gam: Lorentzian width in centideg 1206 1207 returns: arrays: function and derivatives of pos, sig, gam, & shl 1156 1208 ''' 1157 1209 … … 1164 1216 ''' 1165 1217 1218 cw = np.diff(xdata) 1219 cw = np.append(cw,cw[-1]) 1166 1220 Df = pyd.pyepsvoigt(len(xdata),xdata-pos,alp,bet,sig,gam) 1167 Df /= np.sum(Df) 1168 return Df 1221 return Df,np.sum(Df*cw) 1169 1222 1170 1223 def getdEpsVoigt(pos,alp,bet,sig,gam,xdata): … … 1316 1369 1317 1370 def getPeakProfile(dataType,parmDict,xdata,fixback,varyList,bakType): 1318 'Computes the profile for a powder pattern' 1371 '''Computes the profile for a powder pattern for single peak fitting 1372 NB: not used for Rietveld refinement 1373 ''' 1319 1374 1320 1375 yb = getBackground('',parmDict,bakType,dataType,xdata,fixback)[0] 1321 1376 yc = np.zeros_like(yb) 1322 cw = np.diff(xdata)1323 cw = np.append(cw,cw[-1])1377 # cw = np.diff(xdata) 1378 # cw = np.append(cw,cw[-1]) 1324 1379 if 'C' in dataType: 1325 1380 shl = max(parmDict['SH/L'],0.002) … … 1355 1410 elif not iBeg-iFin: #peak above high limit 1356 1411 return yb+yc 1357 yc[iBeg:iFin] += intens*getFCJVoigt3(pos,sig,gam,shl,xdata[iBeg:iFin]) 1412 fp = getFCJVoigt3(pos,sig,gam,shl,xdata[iBeg:iFin])[0] 1413 yc[iBeg:iFin] += intens*fp 1358 1414 if Ka2: 1359 1415 pos2 = pos+lamRatio*tand(pos/2.0) # + 360/pi * Dlam/lam * tan(th) … … 1361 1417 iFin = np.searchsorted(xdata,pos2+fmin) 1362 1418 if iBeg-iFin: 1363 yc[iBeg:iFin] += intens*kRatio*getFCJVoigt3(pos2,sig,gam,shl,xdata[iBeg:iFin]) 1419 fp2 = getFCJVoigt3(pos2,sig,gam,shl,xdata[iBeg:iFin])[0] 1420 yc[iBeg:iFin] += intens*kRatio*fp2 1364 1421 iPeak += 1 1365 1422 except KeyError: #no more peaks to process … … 1405 1462 elif not iBeg-iFin: #peak above high limit 1406 1463 return yb+yc 1407 yc[iBeg:iFin] += intens*getEpsVoigt(pos,alp,bet,sig/1.e4,gam/100.,xdata[iBeg:iFin]) 1464 yc[iBeg:iFin] += intens*getEpsVoigt(pos,alp,bet,sig/1.e4,gam/100.,xdata[iBeg:iFin])[0] 1408 1465 iPeak += 1 1409 1466 except KeyError: #no more peaks to process … … 1463 1520 elif not iBeg-iFin: #peak above high limit 1464 1521 return yb+yc 1465 yc[iBeg:iFin] += intens*getEpsVoigt(pos,alp,bet,sig,gam,xdata[iBeg:iFin]) 1522 yc[iBeg:iFin] += intens*getEpsVoigt(pos,alp,bet,sig,gam,xdata[iBeg:iFin])[0] 1466 1523 iPeak += 1 1467 1524 except KeyError: #no more peaks to process … … 1469 1526 1470 1527 def getPeakProfileDerv(dataType,parmDict,xdata,fixback,varyList,bakType): 1471 'needs a doc string' 1472 # needs to return np.array([dMdx1,dMdx2,...]) in same order as varylist = backVary,insVary,peakVary order 1528 '''Computes the profile derivatives for a powder pattern for single peak fitting 1529 1530 return: np.array([dMdx1,dMdx2,...]) in same order as varylist = backVary,insVary,peakVary order 1531 1532 NB: not used for Rietveld refinement 1533 ''' 1473 1534 dMdv = np.zeros(shape=(len(varyList),len(xdata))) 1474 1535 dMdb,dMddb,dMdpk,dMdfb = getBackgroundDerv('',parmDict,bakType,dataType,xdata,fixback) … … 1529 1590 dMdipk = getdFCJVoigt3(pos,sig,gam,shl,xdata[iBeg:iFin]) 1530 1591 for i in range(1,5): 1531 dMdpk[i][iBeg:iFin] += 100.*cw[iBeg:iFin]*intens*dMdipk[i]1532 dMdpk[0][iBeg:iFin] += 100.*cw[iBeg:iFin]*dMdipk[0]1592 dMdpk[i][iBeg:iFin] += intens*dMdipk[i] 1593 dMdpk[0][iBeg:iFin] += dMdipk[0] 1533 1594 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'sig':dMdpk[2],'gam':dMdpk[3],'shl':dMdpk[4]} 1534 1595 if Ka2: … … 1539 1600 dMdipk2 = getdFCJVoigt3(pos2,sig,gam,shl,xdata[iBeg:iFin]) 1540 1601 for i in range(1,5): 1541 dMdpk[i][iBeg:iFin] += 100.*cw[iBeg:iFin]*intens*kRatio*dMdipk2[i]1542 dMdpk[0][iBeg:iFin] += 100.*cw[iBeg:iFin]*kRatio*dMdipk2[0]1543 dMdpk[5][iBeg:iFin] += 100.*cw[iBeg:iFin]*dMdipk2[0]1602 dMdpk[i][iBeg:iFin] += intens*kRatio*dMdipk2[i] 1603 dMdpk[0][iBeg:iFin] += kRatio*dMdipk2[0] 1604 dMdpk[5][iBeg:iFin] += dMdipk2[0] 1544 1605 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'sig':dMdpk[2],'gam':dMdpk[3],'shl':dMdpk[4],'L1/L2':dMdpk[5]*intens} 1545 1606 for parmName in ['pos','int','sig','gam']: … … 2194 2255 yb *= 0. 2195 2256 yd *= 0. 2196 cw = x[1:]-x[:-1]2197 2257 xBeg = np.searchsorted(x,Limits[0]) 2198 2258 xFin = np.searchsorted(x,Limits[1])+1 … … 2266 2326 FWHM = getFWHM(peak[0],Inst) 2267 2327 try: 2268 binsperFWHM.append(FWHM/cw[x.searchsorted(peak[0])]) 2328 xpk = x.searchsorted(peak[0]) 2329 cw = x[xpk]-x[xpk-1] 2330 binsperFWHM.append(FWHM/cw) 2269 2331 except IndexError: 2270 2332 binsperFWHM.append(0.) … … 4244 4306 hplot = plotter.add('derivatives test for '+name).gca() 4245 4307 hplot.plot(xdata,100.*dx*getdFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)[idx+1]) 4246 y0 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata) 4308 y0 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)[0] 4247 4309 myDict[name] += delt 4248 y1 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata) 4310 y1 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)[0] 4249 4311 hplot.plot(xdata,(y1-y0)/delt,'r+') 4250 4312 -
trunk/GSASIIsasd.py
r4095 r4919 1335 1335 elif 'Bragg' in Type: 1336 1336 Ic += parmDict[cid+'PkInt']*G2pwd.getPsVoigt(parmDict[cid+'PkPos'], 1337 parmDict[cid+'PkSig'],parmDict[cid+'PkGam'],Q) 1337 parmDict[cid+'PkSig'],parmDict[cid+'PkGam'],Q)[0] 1338 1338 Ic += parmDict['Back'] #/parmDict['Scale'] 1339 1339 slitLen = Sample['SlitLen'] -
trunk/GSASIIstrMath.py
r4915 r4919 3206 3206 yb,Histogram['sumBk'] = G2pwd.getBackground(hfx,parmDict,bakType,calcControls[hfx+'histType'],x,fixback) 3207 3207 yc = np.zeros_like(yb) 3208 cw = np.diff(ma.getdata(x))3209 cw = np.append(cw,cw[-1])3208 # cw = np.diff(ma.getdata(x)) 3209 # cw = np.append(cw,cw[-1]) 3210 3210 3211 3211 if 'C' in calcControls[hfx+'histType']: … … 3311 3311 profArgs[iref%ncores].append((refl[5+im],refl,iBeg,iFin,1.)) 3312 3312 else: 3313 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin])) #>90% of time spent here 3313 fp = G2pwd.getFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin]))[0] 3314 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp #>90% of time spent here 3314 3315 if Ka2: 3315 3316 pos2 = refl[5+im]+lamRatio*tand(refl[5+im]/2.0) # + 360/pi * Dlam/lam * tan(th) … … 3326 3327 profArgs[iref%ncores].append((pos2,refl,iBeg,iFin,kRatio)) 3327 3328 else: 3328 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*G2pwd.getFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin])) #and here 3329 fp2 = G2pwd.getFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin]))[0] 3330 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*kRatio*fp2 #and here 3329 3331 elif 'B' in calcControls[hfx+'histType']: 3330 3332 for iref,refl in enumerate(refDict['RefList']): … … 3364 3366 profArgs[iref%ncores].append((refl[5+im],refl,iBeg,iFin,1.)) 3365 3367 else: 3366 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,ma.getdata(x[iBeg:iFin])) 3368 fp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,ma.getdata(x[iBeg:iFin]))[0] 3369 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp #*cw[iBeg:iFin] 3367 3370 elif 'T' in calcControls[hfx+'histType']: 3368 3371 for iref,refl in enumerate(refDict['RefList']): … … 3402 3405 profArgs[iref%ncores].append((refl[5+im],refl,iBeg,iFin)) 3403 3406 else: 3404 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],ma.getdata(x[iBeg:iFin]))/cw[iBeg:iFin] 3407 fp = G2pwd.getEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im],ma.getdata(x[iBeg:iFin]))[0] 3408 yc[iBeg:iFin] += refl[11+im]*refl[9+im]*fp 3405 3409 # print 'profile calc time: %.3fs'%(time.time()-time0) 3406 3410 if useMP and 'C' in calcControls[hfx+'histType']: … … 3434 3438 if len(args) >= 11: tprc=args[10] 3435 3439 if len(args) >= 12: histogram=args[11] 3440 3436 3441 def cellVaryDerv(pfx,SGData,dpdA): 3437 3442 if SGData['SGLaue'] in ['-1',]: … … 3488 3493 if hfx+'BF mult' in varylist: 3489 3494 dMdv[varylist.index(hfx+'BF mult')] += dMdfb 3490 cw = np.diff(ma.getdata(x))3491 cw = np.append(cw,cw[-1])3495 # cw = np.diff(ma.getdata(x)) 3496 # cw = np.append(cw,cw[-1]) 3492 3497 Ka2 = False #also for TOF! 3493 3498 if 'C' in calcControls[hfx+'histType']: … … 3587 3592 dMdipk = G2pwd.getdFCJVoigt3(refl[5+im],refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg:iFin])) 3588 3593 for i in range(5): 3589 dMdpk[i] += 100.*cw[iBeg:iFin]*refl[11+im]*refl[9+im]*dMdipk[i]3594 dMdpk[i] += refl[11+im]*refl[9+im]*dMdipk[i] 3590 3595 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'sig':dMdpk[2],'gam':dMdpk[3],'shl':dMdpk[4],'L1/L2':np.zeros_like(dMdpk[0])} 3591 3596 if Ka2: … … 3598 3603 dMdipk2 = G2pwd.getdFCJVoigt3(pos2,refl[6+im],refl[7+im],shl,ma.getdata(x[iBeg2:iFin2])) 3599 3604 for i in range(5): 3600 dMdpk2[i] = 100.*cw[iBeg2:iFin2]*refl[11+im]*refl[9+im]*kRatio*dMdipk2[i]3601 dMdpk2[5] = 100.*cw[iBeg2:iFin2]*refl[11+im]*dMdipk2[0]3605 dMdpk2[i] = refl[11+im]*refl[9+im]*kRatio*dMdipk2[i] 3606 dMdpk2[5] = refl[11+im]*dMdipk2[0] 3602 3607 dervDict2 = {'int':dMdpk2[0],'pos':dMdpk2[1],'sig':dMdpk2[2],'gam':dMdpk2[3],'shl':dMdpk2[4],'L1/L2':dMdpk2[5]*refl[9]} 3603 3608 elif 'T' in calcControls[hfx+'histType']: … … 3619 3624 dMdipk = G2pwd.getdEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/1.e4,refl[7+im]/100.,ma.getdata(x[iBeg:iFin])) 3620 3625 for i in range(6): 3621 dMdpk[i] = cw[iBeg:iFin]*refl[11+im]*refl[9+im]*dMdipk[i]3626 dMdpk[i] = refl[11+im]*refl[9+im]*dMdipk[i] 3622 3627 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4]/1.e4,'gam':dMdpk[5]/100.} 3623 3628 if Phase['General'].get('doPawley'): -
trunk/versioninfo.txt
r4918 r4919 11 11 # 1234: This is text for version 1234. The second colon here (:) is ignored. 12 12 13 4918: With this version of GSAS-II, the profile functions have been changed to account for possible variation in the powder 14 pattern step size across the scan. This will likely change the histogram scale factor (see Sample Parameters), peak 15 intensities (see Peak List) and background peak intensities (see Background). For Constant Wavelength data, they will change 16 by a factor related to the pattern step size, e.g. for 11BM data with a step size of 0.001 deg 2-theta the new scale factor will be 17 ~0.1 times the old one. If you choose to repeat the refinement for this project, you may need to be sure that parameters affecting 18 peak shape are turned off for the initial refinement. It should converge quickly to the new scale factor. 19 %%For TOF data there may be similar changes to the scale factor && peak intensities as noted above. Significant improvement in profile 20 residuals have been observed in some cases with these new functions. 21 This change is of no consequence for single crystal, small angle or reflectometry data in GSAS-II. 22
Note: See TracChangeset
for help on using the changeset viewer.