Changeset 1479
 Timestamp:
 Aug 26, 2014 4:04:57 PM (8 years ago)
 File:

 1 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIstrMath.py
r1478 r1479 1157 1157 return dIdsh,dIdsp,dIdPola,dIdPO,dFdODF,dFdSA,dFdAb,dFdEx 1158 1158 1159 def GetSampleSigGam(refl,wave,G,GB, hfx,phfx,calcControls,parmDict):1159 def GetSampleSigGam(refl,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict): 1160 1160 'Needs a doc string' 1161 1161 if 'C' in calcControls[hfx+'histType']: … … 1186 1186 Mgam = 0.018*Si*Sa*tand(refl[5]/2.)/(np.pi*np.sqrt((Si*cosP)**2+(Sa*sinP)**2)) 1187 1187 else: #generalized  P.W. Stephens model 1188 pwrs = calcControls[phfx+'MuPwrs']1189 sum = 01190 for i, pwr in enumerate(pwrs):1191 sum += parmDict[phfx+'Mustrain:'+str(i)]*refl[0]**pwr[0]*refl[1]**pwr[1]*refl[2]**pwr[2]1192 Mgam = 0.018*refl[4]**2*tand(refl[5]/2.)*sum1188 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1189 Sum = 0 1190 for i,strm in enumerate(Strms): 1191 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1192 Mgam = refl[4]**2*tand(refl[5]/2.)*np.sqrt(Sum) 1193 1193 elif 'T' in calcControls[hfx+'histType']: 1194 1194 #crystallite size … … 1217 1217 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]*Si*Sa/np.sqrt((Si*cosP)**2+(Sa*sinP)**2) 1218 1218 else: #generalized  P.W. Stephens model 1219 pwrs = calcControls[phfx+'MuPwrs']1220 sum = 01221 for i, pwr in enumerate(pwrs):1222 sum += parmDict[phfx+'Mustrain:'+str(i)]*refl[0]**pwr[0]*refl[1]**pwr[1]*refl[2]**pwr[2]1223 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]**2* sum1219 Sum = 0 1220 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1221 for i,strm in enumerate(Strms): 1222 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1223 Mgam = 1.e6*parmDict[hfx+'difC']*refl[4]**2*Sum 1224 1224 1225 1225 gam = Sgam*parmDict[phfx+'Size;mx']+Mgam*parmDict[phfx+'Mustrain;mx'] … … 1228 1228 return sig,gam 1229 1229 1230 def GetSampleSigGamDerv(refl,wave,G,GB, hfx,phfx,calcControls,parmDict):1230 def GetSampleSigGamDerv(refl,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict): 1231 1231 'Needs a doc string' 1232 1232 gamDict = {} … … 1289 1289 sigDict[phfx+'Mustrain;a'] = 2*(Mgam/Sa+dsa)*Mgam*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1290 1290 else: #generalized  P.W. Stephens model 1291 pwrs = calcControls[phfx+'MuPwrs'] 1292 const = 0.018*refl[4]**2*tanth 1293 sum = 0 1294 for i,pwr in enumerate(pwrs): 1295 term = refl[0]**pwr[0]*refl[1]**pwr[1]*refl[2]**pwr[2] 1296 sum += parmDict[phfx+'Mustrain:'+str(i)]*term 1297 gamDict[phfx+'Mustrain:'+str(i)] = const*term*parmDict[phfx+'Mustrain;mx'] 1298 sigDict[phfx+'Mustrain:'+str(i)] = \ 1299 2.*const*term*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1300 Mgam = 0.018*refl[4]**2*tand(refl[5]/2.)*sum 1301 for i in range(len(pwrs)): 1302 sigDict[phfx+'Mustrain:'+str(i)] *= Mgam 1291 const = refl[4]**2*tanth 1292 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1293 Sum = 0 1294 for i,strm in enumerate(Strms): 1295 Sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1296 gamDict[phfx+'Mustrain:'+str(i)] = strm*parmDict[phfx+'Mustrain;mx']/2. 1297 sigDict[phfx+'Mustrain:'+str(i)] = strm*(1.parmDict[phfx+'Mustrain;mx'])**2 1298 Mgam = const*np.sqrt(Sum) 1299 for i in range(len(Strms)): 1300 gamDict[phfx+'Mustrain:'+str(i)] *= Mgam/Sum 1301 sigDict[phfx+'Mustrain:'+str(i)] *= const**2/ateln2 1303 1302 gamDict[phfx+'Mustrain;mx'] = Mgam 1304 1303 sigDict[phfx+'Mustrain;mx'] = 2.*Mgam**2*(1.parmDict[phfx+'Mustrain;mx'])/ateln2 … … 1358 1357 else: #generalized  P.W. Stephens model 1359 1358 pwrs = calcControls[phfx+'MuPwrs'] 1359 Strms = G2spc.MustrainCoeff(refl[:3],SGData) 1360 1360 const = 1.e6*parmDict[hfx+'difC']*refl[4]**2 1361 1361 sum = 0 1362 for i,pwr in enumerate(pwrs): 1363 term = refl[0]**pwr[0]*refl[1]**pwr[1]*refl[2]**pwr[2] 1364 sum += parmDict[phfx+'Mustrain:'+str(i)]*term 1365 gamDict[phfx+'Mustrain:'+str(i)] = const*term*parmDict[phfx+'Mustrain;mx'] 1362 for i,strm in enumerate(Strms): 1363 sum += parmDict[phfx+'Mustrain:'+str(i)]*strm 1364 gamDict[phfx+'Mustrain:'+str(i)] = const*strm*parmDict[phfx+'Mustrain;mx'] 1366 1365 sigDict[phfx+'Mustrain:'+str(i)] = \ 1367 1366 2.*const*term*(1.parmDict[phfx+'Mustrain;mx'])**2/ateln2 1368 1367 Mgam = const*sum 1369 for i in range(len( pwrs)):1368 for i in range(len(Strms)): 1370 1369 sigDict[phfx+'Mustrain:'+str(i)] *= Mgam 1371 1370 gamDict[phfx+'Mustrain;mx'] = Mgam … … 1578 1577 Y = parmDict[hfx+'Y'] 1579 1578 tanPos = tand(refl[5]/2.0) 1580 Ssig,Sgam = GetSampleSigGam(refl,wave,G,GB, hfx,phfx,calcControls,parmDict)1579 Ssig,Sgam = GetSampleSigGam(refl,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict) 1581 1580 sig = U*tanPos**2+V*tanPos+W+Ssig #save peak sigma 1582 1581 sig = max(0.001,sig) … … 1589 1588 parmDict[hfx+'sig2']*refl[4]**4+parmDict[hfx+'sigq']/refl[4]**2 1590 1589 gam = parmDict[hfx+'X']*refl[4]+parmDict[hfx+'Y']*refl[4]**2 1591 Ssig,Sgam = GetSampleSigGam(refl,0.0,G,GB, hfx,phfx,calcControls,parmDict)1590 Ssig,Sgam = GetSampleSigGam(refl,0.0,G,GB,SGData,hfx,phfx,calcControls,parmDict) 1592 1591 sig += Ssig 1593 1592 sig = max(0.001,sig) … … 1922 1921 depDerivDict[name][iBeg2:iFin2] += dDijDict[name]*dervDict2['pos'] 1923 1922 if 'C' in calcControls[hfx+'histType']: 1924 sigDict,gamDict = GetSampleSigGamDerv(refl,wave,G,GB, hfx,phfx,calcControls,parmDict)1923 sigDict,gamDict = GetSampleSigGamDerv(refl,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict) 1925 1924 else: #'T'OF 1926 sigDict,gamDict = GetSampleSigGamDerv(refl,0.0,G,GB, hfx,phfx,calcControls,parmDict)1925 sigDict,gamDict = GetSampleSigGamDerv(refl,0.0,G,GB,SGData,hfx,phfx,calcControls,parmDict) 1927 1926 for name in gamDict: 1928 1927 if name in varylist:
Note: See TracChangeset
for help on using the changeset viewer.