Changeset 1460
- Timestamp:
- Aug 12, 2014 4:08:52 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r1459 r1460 3723 3723 3724 3724 def FindPeaksBonds(XYZ): 3725 rFact = data['Drawing'] ['radiusFactor']3725 rFact = data['Drawing'].get('radiusFactor',0.85) #data['Drawing'] could be empty! 3726 3726 Bonds = [[] for x in XYZ] 3727 3727 for i,xyz in enumerate(XYZ): -
trunk/GSASIIpwdGUI.py
r1459 r1460 2516 2516 I100 *= 100.0/Imax 2517 2517 if 'C' in Inst['Type'][0]: 2518 refs = np.vstack((refList.T[:1 1],I100)).T2518 refs = np.vstack((refList.T[:15],I100)).T 2519 2519 elif 'T' in Inst['Type'][0]: 2520 refs = np.vstack((refList.T[:1 5],I100)).T2520 refs = np.vstack((refList.T[:18],I100)).T 2521 2521 2522 2522 for i in range(len(refs)): rowLabels.append(str(i)) … … 2525 2525 [wg.GRID_VALUE_FLOAT+':10,3',] 2526 2526 if HKLF: 2527 colLabels = ['H','K','L','mul','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','Ext ',]2527 colLabels = ['H','K','L','mul','d','Fosq','sig','Fcsq','FoTsq','FcTsq','phase','ExtC',] 2528 2528 else: 2529 2529 if 'C' in Inst['Type'][0]: 2530 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr',' I100',]2531 Types += [wg.GRID_VALUE_FLOAT+':10,3',]2530 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','Prfo','Trans','ExtP','I100'] 2531 Types += 4*[wg.GRID_VALUE_FLOAT+':10,3',] 2532 2532 elif 'T' in Inst['Type'][0]: 2533 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave',' I100',]2534 Types += 4*[wg.GRID_VALUE_FLOAT+':10,3',]2533 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave','Prfo','Abs','Ext','I100'] 2534 Types += 7*[wg.GRID_VALUE_FLOAT+':10,3',] 2535 2535 2536 2536 G2frame.PeakTable = G2gd.Table(refs,rowLabels=rowLabels,colLabels=colLabels,types=Types) -
trunk/GSASIIstrIO.py
r1459 r1460 1813 1813 pos = 2.0*asind(wave/(2.0*d))+Zero 1814 1814 if limits[0] < pos < limits[1]: 1815 refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,0.0, 0.0,0.0]) 1815 refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,0.0, 0.0,0.0,1.0,1.0,1.0]) 1816 #... sig,gam,fotsq,fctsq, phase,icorr,prfo,abs,ext 1816 1817 Uniq.append(uniq) 1817 1818 Phi.append(phi) … … 1820 1821 if limits[0] < pos < limits[1]: 1821 1822 wave = inst['difC'][1]*d/(252.816*inst['fltPath'][0]) 1822 refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,wave]) 1823 refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,0.0, 0.0,0.0,0.0,0.0,wave, 1.0,1.0,1.0]) 1824 # ... sig,gam,fotsq,fctsq, phase,icorr,alp,bet,wave, prfo,abs,ext 1823 1825 Uniq.append(uniq) 1824 1826 Phi.append(phi) -
trunk/GSASIIstrMath.py
r1459 r1460 802 802 corrections needed for derivatives 803 803 ''' 804 ref[11]= 1.0804 extCor = 1.0 805 805 dervCor = 1.0 806 806 dervDict = {} … … 869 869 dervDict[phfx+'Eg'] = -ref[7]*PLZ*PF3*(PSIG/parmDict[phfx+'Eg'])**3*PL**2 870 870 871 ref[11] = 1./extCor 872 return dervCor,dervDict 871 return 1./extCor,dervCor,dervDict 873 872 874 873 def Dict2Values(parmdict, varylist): … … 1018 1017 1019 1018 def GetPrefOri(refl,uniq,G,g,phfx,hfx,SGData,calcControls,parmDict): 1020 ' Needs a doc string'1019 'March-Dollase preferred orientation correction' 1021 1020 POcorr = 1.0 1022 if calcControls[phfx+'poType'] == 'MD': 1023 MD = parmDict[phfx+'MD'] 1024 if MD != 1.0: 1025 MDAxis = calcControls[phfx+'MDAxis'] 1026 sumMD = 0 1027 for H in uniq: 1028 cosP,sinP = G2lat.CosSinAngle(H,MDAxis,G) 1029 A = 1.0/np.sqrt((MD*cosP)**2+sinP**2/MD) 1030 sumMD += A**3 1031 POcorr = sumMD/len(uniq) 1032 else: #spherical harmonics 1033 if calcControls[phfx+'SHord']: 1034 POcorr = SHPOcal(refl,g,phfx,hfx,SGData,calcControls,parmDict) 1021 MD = parmDict[phfx+'MD'] 1022 if MD != 1.0: 1023 MDAxis = calcControls[phfx+'MDAxis'] 1024 sumMD = 0 1025 for H in uniq: 1026 cosP,sinP = G2lat.CosSinAngle(H,MDAxis,G) 1027 A = 1.0/np.sqrt((MD*cosP)**2+sinP**2/MD) 1028 sumMD += A**3 1029 POcorr = sumMD/len(uniq) 1035 1030 return POcorr 1036 1031 … … 1074 1069 return G2pwd.AbsorbDerv('Cylinder',parmDict[hfx+'Absorption'],refl[5],0,0) 1075 1070 else: 1076 return G2pwd.SurfaceRoughDerv(parmDict[hfx+'SurfRoughA'],parmDict[hfx+'SurfRoughB'],refl[5]) 1071 return np.array(G2pwd.SurfaceRoughDerv(parmDict[hfx+'SurfRoughA'],parmDict[hfx+'SurfRoughB'],refl[5])) 1072 1073 def GetPwdrExt(refl,pfx,phfx,hfx,calcControls,parmDict): 1074 'Needs a doc string' 1075 coef = np.array([-0.5,0.25,-0.10416667,0.036458333,-0.0109375,2.8497409E-3]) 1076 pi2 = np.sqrt(np.pi/2.) 1077 if 'T' in calcControls[hfx+'histType']: 1078 sth2 = sind(parmDict[hfx+'2-theta']/2.)**2 1079 wave = refl[12] 1080 else: #'C'W 1081 sth2 = sind(refl[5]/2.)**2 1082 wave = parmDict.get(hfx+'Lam',parmDict.get(hfx+'Lam1',1.0)) 1083 c2th = 1.-2.0*sth2 1084 flv2 = refl[9]*(wave/parmDict[pfx+'Vol'])**2 1085 if 'X' in calcControls[hfx+'histType']: 1086 flv2 *= 0.079411*(1.0+c2th**2)/2.0 1087 xfac = flv2*parmDict[phfx+'Extinction'] 1088 exb = 1.0 1089 if xfac > -1.: 1090 exb = 1./(1.+xfac) 1091 exl = 1.0 1092 if 0 < xfac <= 1.: 1093 xn = np.array([xfac**(i+1) for i in range(6)]) 1094 exl = np.sum(xn*coef) 1095 elif xfac > 1.: 1096 xfac2 = 1./np.sqrt(xfac) 1097 exl = pi2*(1.-0.125/xfac)*xfac2 1098 return exb*sth2+exl*(1.-sth2) 1099 1100 def GetPwdrExtDerv(refl,pfx,phfx,hfx,calcControls,parmDict): 1101 'Needs a doc string' 1102 coef = np.array([-0.5,0.25,-0.10416667,0.036458333,-0.0109375,2.8497409E-3]) 1103 pi2 = np.sqrt(np.pi/2.) 1104 if 'T' in calcControls[hfx+'histType']: 1105 sth2 = sind(parmDict[hfx+'2-theta']/2.)**2 1106 wave = refl[12] 1107 else: #'C'W 1108 sth2 = sind(refl[5]/2.)**2 1109 wave = parmDict.get(hfx+'Lam',parmDict.get(hfx+'Lam1',1.0)) 1110 c2th = 1.-2.0*sth2 1111 flv2 = refl[9]*(wave/parmDict[pfx+'Vol'])**2 1112 return 0. 1113 # 1114 # STH2 = STHETA**2 1115 # C2TH = 1-2.0*STH2 1116 # FLV2 = FCSQ*(LAM/VOL(IPHAS))**2 1117 # IF ( HTYPE(2:2).EQ.'X' ) FLV2 = 0.079411*FLV2*(1.0+C2TH**2)/2.0 1118 # XFAC = FLV2*EXTPOWD(IHST,IPHAS) 1119 # IF ( XFAC.LE.-1.0 ) THEN 1120 # EXB = 1.0 1121 # DBDE = -500.0*FLV2 1122 # ELSE 1123 # EXB = 1.0/SQRT(1.0+XFAC) 1124 # DBDE = -0.5*FLV2*EXB**3 1125 # END IF 1126 # IF ( XFAC.LE.0.0 ) THEN 1127 # EXL = 1.0 1128 # DLDE = 0.0 1129 # ELSE IF ( XFAC.LE.1.0 ) THEN 1130 # EXL = 1.0 1131 # DLDE = 0.0 1132 # DO I=1,6 1133 # XN =XFAC**I 1134 # EXL = EXL+COEF(I)*XN 1135 # DLDE = DLDE+FLOAT(I)*FLV2*COEF(I)*XN/XFAC 1136 # END DO 1137 # ELSE 1138 # XFAC2 = 1.0/SQRT(XFAC) 1139 # EXL = PI2*(1.0-0.125/XFAC)*XFAC2 1140 # DLDE = 0.5*FLV2*PI2*XFAC2*(-1.0/XFAC+0.375/XFAC**2) 1141 # END IF 1142 # EXTCOR = EXB*STH2+EXL*(1.0-STH2) 1143 # DFDEX = DBDE*STH2+DLDE*(1.0-STH2) 1077 1144 1078 1145 def GetIntensityCorr(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict): … … 1081 1148 if 'X' in parmDict[hfx+'Type']: 1082 1149 Icorr *= G2pwd.Polarization(parmDict[hfx+'Polariz.'],refl[5],parmDict[hfx+'Azimuth'])[0] 1083 Icorr *= GetPrefOri(refl,uniq,G,g,phfx,hfx,SGData,calcControls,parmDict) 1084 if pfx+'SHorder' in parmDict: 1085 Icorr *= SHTXcal(refl,g,pfx,hfx,SGData,calcControls,parmDict) 1086 Icorr *= GetAbsorb(refl,hfx,calcControls,parmDict) 1087 return Icorr 1150 POcorr = 1.0 1151 if pfx+'SHorder' in parmDict: #generalized spherical harmonics texture 1152 POcorr = SHTXcal(refl,g,pfx,hfx,SGData,calcControls,parmDict) 1153 elif calcControls[phfx+'poType'] == 'MD': #March-Dollase 1154 POcorr = GetPrefOri(refl,uniq,G,g,phfx,hfx,SGData,calcControls,parmDict) 1155 elif calcControls[phfx+'SHord']: #cylindrical spherical harmonics 1156 POcorr = SHPOcal(refl,g,phfx,hfx,SGData,calcControls,parmDict) 1157 Icorr *= POcorr 1158 AbsCorr = 1.0 1159 AbsCorr = GetAbsorb(refl,hfx,calcControls,parmDict) 1160 Icorr *= AbsCorr 1161 ExtCorr = GetPwdrExt(refl,pfx,phfx,hfx,calcControls,parmDict) 1162 Icorr *= ExtCorr 1163 return Icorr,POcorr,AbsCorr,ExtCorr 1088 1164 1089 1165 def GetIntensityDerv(refl,uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict): … … 1096 1172 else: #'N' 1097 1173 dIdPola = 0.0 1098 POcorr,dIdPO = GetPrefOriDerv(refl,uniq,G,g,phfx,hfx,SGData,calcControls,parmDict)1099 for iPO in dIdPO:1100 dIdPO[iPO] /= POcorr1101 1174 dFdODF = {} 1102 1175 dFdSA = [0,0,0] … … 1107 1180 for i in range(3): 1108 1181 dFdSA[i] /= odfCor 1109 dFdAb = GetAbsorbDerv(refl,hfx,calcControls,parmDict) 1110 return dIdsh,dIdsp,dIdPola,dIdPO,dFdODF,dFdSA,dFdAb 1182 elif calcControls[phfx+'poType'] == 'MD' or calcControls[phfx+'SHord']: 1183 POcorr,dIdPO = GetPrefOriDerv(refl,uniq,G,g,phfx,hfx,SGData,calcControls,parmDict) 1184 for iPO in dIdPO: 1185 dIdPO[iPO] /= POcorr 1186 AbsCorr = GetAbsorb(refl,hfx,calcControls,parmDict) 1187 dFdAb = GetAbsorbDerv(refl,hfx,calcControls,parmDict)/AbsCorr 1188 dFdEx = GetPwdrExtDerv(refl,pfx,phfx,hfx,calcControls,parmDict) 1189 return dIdsh,dIdsp,dIdPola,dIdPO,dFdODF,dFdSA,dFdAb,dFdEx 1111 1190 1112 1191 def GetSampleSigGam(refl,wave,G,GB,hfx,phfx,calcControls,parmDict): … … 1588 1667 refl[5] += GetHStrainShift(refl,SGData,phfx,parmDict) #apply hydrostatic strain shift 1589 1668 refl[6:8] = GetReflSigGamCW(refl,wave,G,GB,phfx,calcControls,parmDict) #peak sig & gam 1590 refl[11] = GetIntensityCorr(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)*Vst*Lorenz 1669 refl[11:15] = GetIntensityCorr(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict) 1670 refl[11] *= Vst*Lorenz 1591 1671 1592 1672 if Phase['General'].get('doPawley'): … … 1623 1703 refl[6:8] = GetReflSigGamTOF(refl,G,GB,phfx,calcControls,parmDict) #peak sig & gam 1624 1704 refl[12:14] = GetReflAlpBet(refl,hfx,parmDict) 1625 refl[11] = GetIntensityCorr(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)*Vst*Lorenz 1705 refl[11],refl[15],refl[16],refl[17] = GetIntensityCorr(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict) 1706 refl[11] *= Vst*Lorenz 1626 1707 if Phase['General'].get('doPawley'): 1627 1708 try: … … 1729 1810 h,k,l = refl[:3] 1730 1811 Uniq = np.inner(refl[:3],SGMT) 1731 dIdsh,dIdsp,dIdpola,dIdPO,dFdODF,dFdSA,dFdAb = GetIntensityDerv(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict)1812 dIdsh,dIdsp,dIdpola,dIdPO,dFdODF,dFdSA,dFdAb,dFdEx = GetIntensityDerv(refl,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict) 1732 1813 if 'C' in calcControls[hfx+'histType']: #CW powder 1733 1814 Wd,fmin,fmax = G2pwd.getWidthsCW(refl[5],refl[6],refl[7],shl) … … 1766 1847 dMdpk = np.zeros(shape=(6,lenBF)) 1767 1848 dMdipk = G2pwd.getdEpsVoigt(refl[5],refl[12],refl[13],refl[6],refl[7],ma.getdata(x[iBeg:iFin])) 1768 for i in range( 5):1769 dMdpk[i] += 100.*cw[iBeg:iFin]*refl[11]*refl[9]*dMdipk[i]1849 for i in range(6): 1850 dMdpk[i] += cw[iBeg:iFin]*refl[11]*refl[9]*dMdipk[i] 1770 1851 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4],'gam':dMdpk[5]} 1771 1852 if Phase['General'].get('doPawley'): … … 1800 1881 hfx+'alpha':[1./refl[4],'alp'],hfx+'beta-0':[1.0,'bet'],hfx+'beta-1':[1./refl[4]**4,'bet'], 1801 1882 hfx+'beta-q':[1./refl[4],'bet'],hfx+'sig-0':[1.0,'sig'],hfx+'sig-1':[refl[4]**2,'sig'], 1802 hfx+'sig-q':[refl[4],'sig'],hfx+'Absorption':[dFdAb,'int'], }1883 hfx+'sig-q':[refl[4],'sig'],hfx+'Absorption':[dFdAb,'int'],hfx+'Extinction':[dFdEx,'int'],} 1803 1884 for name in names: 1804 1885 item = names[name] … … 1945 2026 for iref,ref in enumerate(refDict['RefList']): 1946 2027 if ref[6] > 0: 1947 dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]2028 dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist)[1:] 1948 2029 w = 1.0/ref[6] 1949 2030 if w*ref[5] >= calcControls['minF/sig']: … … 1972 2053 for iref,ref in enumerate(refDict['RefList']): 1973 2054 if ref[5] > 0.: 1974 dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]2055 dervCor,dervDict = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist)[1:] 1975 2056 Fo = np.sqrt(ref[5]) 1976 2057 Fc = np.sqrt(ref[7]) … … 1980 2061 for j,var in enumerate(varylist): 1981 2062 if var in dFdvDict: 1982 dMdvh[j][iref] = w*dFdvDict[var][iref]*parmDict[phfx+'Scale']* dervCor*ref[11]2063 dMdvh[j][iref] = w*dFdvDict[var][iref]*parmDict[phfx+'Scale']*ref[11] #*dervCor 1983 2064 for var in dependentVars: 1984 2065 if var in dFdvDict: 1985 depDerivDict[var][iref] = w*dFdvDict[var][iref]*parmDict[phfx+'Scale']* dervCor*ref[11]2066 depDerivDict[var][iref] = w*dFdvDict[var][iref]*parmDict[phfx+'Scale']*ref[11] #*dervCor 1986 2067 if phfx+'Scale' in varylist: 1987 dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[9]* dervCor2068 dMdvh[varylist.index(phfx+'Scale')][iref] = w*ref[9]*ref[11] #*dervCor 1988 2069 elif phfx+'Scale' in dependentVars: 1989 depDerivDict[phfx+'Scale'][iref] = w*ref[9]* dervCor2070 depDerivDict[phfx+'Scale'][iref] = w*ref[9]*ref[11] #*dervCor 1990 2071 for item in ['Ep','Es','Eg']: 1991 2072 if phfx+item in varylist and dervDict: … … 2211 2292 for i,ref in enumerate(refDict['RefList']): 2212 2293 if ref[6] > 0: 2213 SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]2294 ref[11] = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist)[0] 2214 2295 w = 1.0/ref[6] 2215 2296 ref[7] = parmDict[phfx+'Scale']*ref[9]*ref[11] #correct Fc^2 for extinction … … 2227 2308 for i,ref in enumerate(refDict['RefList']): 2228 2309 if ref[5] > 0.: 2229 SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist) #puts correction in refl[11]2230 ref[7] = parmDict[phfx+'Scale']*ref[9]*ref[11] #correct Fc^2 for extinctio 2310 ref[11] = SCExtinction(ref,phfx,hfx,pfx,calcControls,parmDict,varylist)[0] 2311 ref[7] = parmDict[phfx+'Scale']*ref[9]*ref[11] #correct Fc^2 for extinction 2231 2312 ref[8] = ref[5]/(parmDict[phfx+'Scale']*ref[11]) 2232 2313 Fo = np.sqrt(ref[5])
Note: See TracChangeset
for help on using the changeset viewer.