Changeset 4520
- Timestamp:
- Jul 14, 2020 4:08:55 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImpsubs.py
r4021 r4520 115 115 return sInt,resList 116 116 117 def ComputeFobsSqPinkbatch(profList): 118 sInt = 0 119 resList = [] 120 for refl,iref in profList: 121 icod = ComputeFobsSqPink(refl,iref) 122 if type(icod) is tuple: 123 resList.append((icod[0],iref)) 124 sInt += icod[1] 125 elif icod == -1: 126 resList.append((None,iref)) 127 elif icod == -2: 128 break 129 return sInt,resList 130 117 131 def ComputeFobsSqCW(refl,iref): 118 132 yp = np.zeros(len(x)) # not masked … … 162 176 refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0)) 163 177 return refl8im,refl[11+im]*refl[9+im] 178 179 def ComputeFobsSqPink(refl,iref): 180 yp = np.zeros(len(x)) # not masked 181 refl8im = 0 182 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4) 183 iBeg = max(xB,np.searchsorted(x,refl[5+im]-fmin)) 184 iFin = max(xB,min(np.searchsorted(x,refl[5+im]+fmax),xF)) 185 if not iBeg+iFin: #peak below low limit - skip peak 186 return 0 187 if ma.all(xMask[iBeg:iFin]): #peak entirely masked - skip peak 188 return -1 189 elif not iBeg-iFin: #peak above high limit - done 190 return -2 191 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 refl8im = np.sum(np.where(ratio[iBeg:iFin]>0.,yp[iBeg:iFin]*ratio[iBeg:iFin]/refl[11+im],0.0)) 195 return refl8im,refl[11+im]*refl[9+im] 196 164 197 ################################################################################ 165 198 # Powder Profile computation … … 195 228 return yc 196 229 230 def ComputePwdrProfPink(profList): 231 'Compute the peaks profile for a set of TOF peaks and add into the yc array' 232 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] 235 return yc -
trunk/GSASIIpwd.py
r4519 r4520 801 801 alpTOF = lambda dsp,alp: alp/dsp 802 802 betTOF = lambda dsp,bet0,bet1,betq: bet0+bet1/dsp**4+betq/dsp**2 803 alpPink = lambda pos,alp0,alp1: alp0+alp1*tand(pos/2.) 804 betPink = lambda pos,bet0,bet1: bet0+bet1*tand(pos/2.) 803 805 if 'T' in Inst['Type'][0]: 804 dsp = pos/Inst['difC'][ 0]805 alp = alpTOF(dsp,Inst['alpha'][ 0])806 bet = betTOF(dsp,Inst['beta-0'][ 0],Inst['beta-1'][0],Inst['beta-q'][0])806 dsp = pos/Inst['difC'][1] 807 alp = alpTOF(dsp,Inst['alpha'][1]) 808 bet = betTOF(dsp,Inst['beta-0'][1],Inst['beta-1'][1],Inst['beta-q'][1]) 807 809 s = sigTOF(dsp,Inst['sig-0'][1],Inst['sig-1'][1],Inst['sig-2'][1],Inst['sig-q'][1]) 808 810 g = gamTOF(dsp,Inst['X'][1],Inst['Y'][1],Inst['Z'][1]) 809 811 return getgamFW(g,s)+np.log(2.0)*(alp+bet)/(alp*bet) 810 el se:812 elif 'C' in Inst['Type'][0]: 811 813 s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1]) 812 814 g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1]) 813 815 return getgamFW(g,s)/100. #returns FWHM in deg 816 else: #'B' 817 alp = alpPink(pos,Inst['alpha-0'][1],Inst['alpha-1'][1]) 818 bet = betPink(pos,Inst['beta-0'][1],Inst['beta-1'][1]) 819 s = sig(pos/2.,Inst['U'][1],Inst['V'][1],Inst['W'][1]) 820 g = gam(pos/2.,Inst['X'][1],Inst['Y'][1],Inst['Z'][1]) 821 return getgamFW(g,s)/100.+np.log(2.0)*(alp+bet)/(alp*bet) #returns FWHM in deg 814 822 815 823 def getgamFW(g,s): … … 965 973 ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin]) 966 974 yb[iBeg:iFin] += ybi 967 el se: #'T'OF975 elif 'T' in dataType: 968 976 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin]) 977 yb[iBeg:iFin] += ybi 978 elif 'B' in dataType: 979 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin]) 969 980 yb[iBeg:iFin] += ybi 970 981 sumBk[2] += np.sum(ybi) … … 1776 1787 def InstPrint(Inst,sigDict): 1777 1788 print ('Instrument Parameters:') 1778 if 'C' in Inst['Type'][0] :1789 if 'C' in Inst['Type'][0] or 'B' in Inst['Type'][0]: 1779 1790 ptfmt = "%12.6f" 1780 1791 else: … … 2087 2098 if 'C' in dataType: 2088 2099 ptfmt = {'pos':"%10.5f",'int':"%10.1f",'sig':"%10.3f",'gam':"%10.3f"} 2089 el se: #'T' & 'B'2100 elif 'T' in dataType: 2090 2101 ptfmt = {'pos':"%10.2f",'int':"%10.4f",'alp':"%8.3f",'bet':"%8.5f",'sig':"%10.3f",'gam':"%10.3f"} 2102 else: #'B' 2103 ptfmt = {'pos':"%10.5f",'int':"%10.1f",'alp':"%8.2f",'bet':"%8.4f",'sig':"%10.3f",'gam':"%10.3f"} 2091 2104 for i,peak in enumerate(Peaks): 2092 2105 ptstr = ':' -
trunk/GSASIIpwdGUI.py
r4519 r4520 4812 4812 elif 'T' in Inst['Type'][0]: 4813 4813 refs = np.vstack((refList.T[:18+Super],I100,MuStr,CrSize)).T 4814 elif 'B' in Inst['Type'][0]: 4815 refs = np.vstack((refList.T[:17+Super],I100,MuStr,CrSize)).T 4814 4816 rowLabels = [str(i) for i in range(len(refs))] 4815 4817 Types = (4+Super)*[wg.GRID_VALUE_LONG,]+4*[wg.GRID_VALUE_FLOAT+':10,4',]+ \ … … 4827 4829 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','Prfo','Trans','ExtP','I100','mustrain','Size'] 4828 4830 Types += 6*[wg.GRID_VALUE_FLOAT+':10,3',] 4829 el se:4831 elif 'T' in Inst['Type'][0]: 4830 4832 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','wave','Prfo','Abs','Ext','I100','mustrain','Size'] 4831 4833 Types += 9*[wg.GRID_VALUE_FLOAT+':10,3',] 4834 elif 'B' in Inst['Type'][0]: 4835 colLabels = ['H','K','L','mul','d','pos','sig','gam','Fosq','Fcsq','phase','Icorr','alp','bet','Prfo','Abs','Ext','I100','mustrain','Size'] 4836 Types += 8*[wg.GRID_VALUE_FLOAT+':10,3',] 4832 4837 if Super: 4833 4838 colLabels.insert(3,'M') -
trunk/GSASIIstrIO.py
r4509 r4520 2552 2552 elif 'T' in inst['Type'][0]: 2553 2553 dmin = limits[0]/inst['difC'][1] 2554 else: 2555 wave = inst['Lam'][1] 2556 dmin = wave/(2.0*sind(limits[1]/2.0)) 2554 2557 pfx = str(pId)+':'+str(hId)+':' 2555 2558 if Phases[phase]['General']['doPawley']: … … 2557 2560 hapDict[pfx+'newLeBail'] = True 2558 2561 Tmin = G2lat.Dsp2pos(inst,dmin) 2559 if 'C' in inst['Type'][1]: 2562 if 'T' in inst['Type'][1]: 2563 limits[0] = max(limits[0],Tmin) 2564 else: 2560 2565 limits[1] = min(limits[1],Tmin) 2561 else:2562 limits[0] = max(limits[0],Tmin)2563 2566 else: 2564 2567 hapDict[pfx+'LeBail'] = hapData.get('LeBail',False) … … 2695 2698 # Uniq.append(uniq) 2696 2699 # Phi.append(phi) 2700 elif 'B' in inst['Type'][0]: 2701 pos = G2lat.Dsp2pos(inst,d) 2702 if limits[0] < pos < limits[1]: 2703 refList.append([h,k,l,m,mul,d, pos,0.0,0.0,0.0,1., 0.0,0.0,0.0,0.0, 1.0,1.0,1.0]) 2704 # ... sig,gam,fotsq,fctsq, phase,icorr,alp,bet, prfo,abs,ext 2697 2705 else: 2698 2706 ifSuper = False … … 2721 2729 # Uniq.append(uniq) 2722 2730 # Phi.append(phi) 2731 elif 'B' in inst['Type'][0]: 2732 pos = G2lat.Dsp2pos(inst,d) 2733 if limits[0] < pos < limits[1]: 2734 refList.append([h,k,l,mul,d, pos,0.0,0.0,0.0,1., 0.0,0.0,0.0,0.0, 1.0,1.0,1.0]) 2735 # ... sig,gam,fotsq,fctsq, phase,icorr,alp,bet, prfo,abs,ext 2723 2736 Histogram['Reflection Lists'][phase] = {'RefList':np.array(refList),'FF':{},'Type':inst['Type'][0],'Super':ifSuper} 2724 2737 elif 'HKLF' in histogram: … … 3246 3259 if not instDict[pfx+'beta-0'] and not instDict[pfx+'beta-1']: 3247 3260 instDict[pfx+'beta-1'] = 1.0 3261 elif 'B' in dataType: #trap zero alp, bet coeff. 3262 if not instDict[pfx+'alpha-0'] and not instDict[pfx+'alpha-1']: 3263 instDict[pfx+'alpha-1'] = 1.0 3264 if not instDict[pfx+'beta-0'] and not instDict[pfx+'beta-1']: 3265 instDict[pfx+'beta-1'] = 1.0 3248 3266 return dataType,instDict,insVary 3249 3267 … … 3383 3401 Type,instDict,insVary = GetInstParms(hId,Inst[0]) 3384 3402 controlDict[pfx+'histType'] = Type 3385 if 'XC' in Type :3403 if 'XC' in Type or 'XB' in Type: 3386 3404 if pfx+'Lam1' in instDict: 3387 3405 controlDict[pfx+'keV'] = 12.397639/instDict[pfx+'Lam1'] … … 3401 3419 pFile.write('\n Histogram: %s histogram Id: %d\n'%(histogram,hId)) 3402 3420 pFile.write(135*'='+'\n') 3403 Units = {'C':' deg','T':' msec' }3421 Units = {'C':' deg','T':' msec','B':' deg'} 3404 3422 units = Units[controlDict[pfx+'histType'][2]] 3405 3423 Limits = controlDict[pfx+'Limits'] … … 3423 3441 histDict[pfx+'Lam'] = Inst['Lam'][1] 3424 3442 controlDict[pfx+'keV'] = 12.397639/histDict[pfx+'Lam'] 3425 elif 'NC' in Inst['Type'][0] :3443 elif 'NC' in Inst['Type'][0] or 'NB' in Inst['Type'][0]: 3426 3444 histDict[pfx+'Lam'] = Inst['Lam'][1] 3427 3445 return histVary,histDict,controlDict -
trunk/GSASIIstrMath.py
r4519 r4520 758 758 if not Xdata.size: #no atoms in phase! 759 759 return 760 if 'NC' in calcControls[hfx+'histType'] :760 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 761 761 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 762 762 elif 'X' in calcControls[hfx+'histType']: … … 876 876 mSize = len(Mdata) 877 877 FF = np.zeros(len(Tdata)) 878 if 'NC' in calcControls[hfx+'histType'] :878 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 879 879 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 880 880 elif 'X' in calcControls[hfx+'histType']: … … 1342 1342 mSize = len(Mdata) 1343 1343 FF = np.zeros(len(Tdata)) 1344 if 'NC' in calcControls[hfx+'histType'] :1344 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 1345 1345 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 1346 1346 elif 'X' in calcControls[hfx+'histType']: … … 1534 1534 1535 1535 FF = np.zeros(len(Tdata)) 1536 if 'NC' in calcControls[hfx+'histType'] :1536 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 1537 1537 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 1538 1538 elif 'X' in calcControls[hfx+'histType']: … … 1716 1716 modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']]) 1717 1717 FF = np.zeros(len(Tdata)) 1718 if 'NC' in calcControls[hfx+'histType'] :1718 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 1719 1719 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 1720 1720 elif 'X' in calcControls[hfx+'histType']: … … 1849 1849 modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']]) 1850 1850 FF = np.zeros(len(Tdata)) 1851 if 'NC' in calcControls[hfx+'histType'] :1851 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 1852 1852 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 1853 1853 elif 'X' in calcControls[hfx+'histType']: … … 2094 2094 modQ = np.array([parmDict[pfx+'mV0'],parmDict[pfx+'mV1'],parmDict[pfx+'mV2']]) 2095 2095 FF = np.zeros(len(Tdata)) 2096 if 'NC' in calcControls[hfx+'histType'] :2096 if 'NC' in calcControls[hfx+'histType'] or 'NB' in calcControls[hfx+'histType']: 2097 2097 FP,FPP = G2el.BlenResCW(Tdata,BLtables,parmDict[hfx+'Lam']) 2098 2098 elif 'X' in calcControls[hfx+'histType']: … … 2650 2650 def GetSampleSigGam(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict): 2651 2651 'Needs a doc string' 2652 if 'C' in calcControls[hfx+'histType'] : #All checked & OK2652 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: #All checked & OK 2653 2653 costh = cosd(refl[5+im]/2.) 2654 2654 #crystallite size … … 2723 2723 gamDict = {} 2724 2724 sigDict = {} 2725 if 'C' in calcControls[hfx+'histType'] : #All checked & OK2725 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: #All checked & OK 2726 2726 costh = cosd(refl[5+im]/2.) 2727 2727 tanth = tand(refl[5+im]/2.) … … 2872 2872 d = 1./np.sqrt(G2lat.calc_rDsq(np.array([h,k,l]),A)) 2873 2873 refl[4+im] = d 2874 if 'C' in calcControls[hfx+'histType'] :2874 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 2875 2875 pos = 2.0*asind(wave/(2.0*d))+parmDict[hfx+'Zero'] 2876 2876 const = 9.e-2/(np.pi*parmDict[hfx+'Gonio. radius']) #shifts in microns … … 2899 2899 dst = np.sqrt(dstsq) 2900 2900 dsp = 1./dst 2901 if 'C' in calcControls[hfx+'histType'] :2901 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 2902 2902 pos = refl[5+im]-parmDict[hfx+'Zero'] 2903 2903 const = dpr/np.sqrt(1.0-wave**2*dstsq/4.0) … … 2953 2953 Dij = parmDict[phfx+'D11']*h**2+parmDict[phfx+'D22']*k**2+parmDict[phfx+'D33']*l**2+ \ 2954 2954 parmDict[phfx+'D12']*h*k+parmDict[phfx+'D13']*h*l+parmDict[phfx+'D23']*k*l 2955 if 'C' in calcControls[hfx+'histType'] :2955 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 2956 2956 return -180.*Dij*refl[4+im]**2*tand(refl[5+im]/2.0)/np.pi 2957 2957 else: … … 2985 2985 dDijDict = {phfx+'D11':h**2,phfx+'D22':k**2,phfx+'D33':l**2, 2986 2986 phfx+'D12':h*k,phfx+'D13':h*l,phfx+'D23':k*l} 2987 if 'C' in calcControls[hfx+'histType'] :2987 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 2988 2988 for item in dDijDict: 2989 2989 dDijDict[item] *= 180.0*refl[4+im]**2*tand(refl[5+im]/2.0)/np.pi … … 3109 3109 if parmDict[phfx+'LeBail']: 3110 3110 refDict['RefList'][irefl][9+im] = refDict['RefList'][irefl][8+im] 3111 elif 'B' in calcControls[hfx+'histType']: 3112 for iref,refl in enumerate(refDict['RefList']): 3113 if useMP: 3114 profArgs[iref%G2mp.ncores].append((refl,iref)) 3115 else: 3116 icod= G2mp.ComputeFobsSqPink(refl,iref) 3117 if type(icod) is tuple: 3118 refl[8+im] = icod[0] 3119 sumInt += icod[1] 3120 if parmDict[phfx+'LeBail']: refl[9+im] = refl[8+im] 3121 elif icod == -1: 3122 refl[3+im] *= -1 3123 nExcl += 1 3124 elif icod == -2: 3125 break 3126 if useMP: 3127 for sInt,resList in MPpool.imap_unordered(G2mp.ComputeFobsSqPinkbatch,profArgs): 3128 sumInt += sInt 3129 for refl8im,irefl in resList: 3130 if refl8im is None: 3131 refDict['RefList'][irefl][3+im] *= -1 3132 nExcl += 1 3133 else: 3134 refDict['RefList'][irefl][8+im] = refl8im 3135 if parmDict[phfx+'LeBail']: 3136 refDict['RefList'][irefl][9+im] = refDict['RefList'][irefl][8+im] 3111 3137 if useMP: MPpool.terminate() 3112 3138 sumFo = 0.0 … … 3169 3195 return alp,bet 3170 3196 3197 def GetPinkReflAlpBet(refl,im,hfx,parmDict): 3198 tanPos = tand(refl[5+im]/2.0) 3199 alp = parmDict[hfx+'alpha-0']+parmDict[hfx+'alpha-0']*tanPos 3200 bet = parmDict[hfx+'beta-0']+parmDict[hfx+'beta-1']*tanPos 3201 return alp,bet 3202 3171 3203 hId = Histogram['hId'] 3172 3204 hfx = ':%d:'%(hId) … … 3187 3219 kRatio = parmDict[hfx+'I(L2)/I(L1)'] 3188 3220 else: 3221 wave = parmDict[hfx+'Lam'] 3222 elif 'B' in calcControls[hfx+'histType']: 3189 3223 wave = parmDict[hfx+'Lam'] 3190 3224 else: … … 3281 3315 else: 3282 3316 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 3317 elif 'B' in calcControls[hfx+'histType']: 3318 for iref,refl in enumerate(refDict['RefList']): 3319 if im: 3320 h,k,l,m = refl[:4] 3321 else: 3322 h,k,l = refl[:3] 3323 Uniq = np.inner(refl[:3],SGMT) 3324 refl[5+im] = GetReflPos(refl,im,wave,A,pfx,hfx,phfx,calcControls,parmDict) #corrected reflection position 3325 Lorenz = 1./(2.*sind(refl[5+im]/2.)**2*cosd(refl[5+im]/2.)) #Lorentz correction 3326 refl[6+im:8+im] = GetReflSigGamCW(refl,im,wave,G,GB,phfx,calcControls,parmDict) #peak sig & gam 3327 refl[12+im:14+im] = GetPinkReflAlpBet(refl,im,hfx,parmDict) #TODO - skip if alp, bet tabulated? 3328 refl[11+im],refl[14+im],refl[15+im],refl[16+im] = GetIntensityCorr(refl,im,Uniq,G,g,pfx,phfx,hfx,SGData,calcControls,parmDict) 3329 refl[11+im] *= Vst*Lorenz 3330 3331 if Phase['General'].get('doPawley'): 3332 try: 3333 if im: 3334 pInd = pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d,%d'%(h,k,l,m)]) 3335 else: 3336 pInd = pfx+'PWLref:%d'%(pawleyLookup[pfx+'%d,%d,%d'%(h,k,l)]) 3337 refl[9+im] = parmDict[pInd] 3338 except KeyError: 3339 # print ' ***Error %d,%d,%d missing from Pawley reflection list ***'%(h,k,l) 3340 continue 3341 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4) 3342 iBeg = np.searchsorted(x,refl[5+im]-fmin) 3343 iFin = np.searchsorted(x,refl[5+im]+fmax) 3344 if not iBeg+iFin: #peak below low limit - skip peak 3345 continue 3346 elif not iBeg-iFin: #peak above high limit - done 3347 break 3348 elif iBeg > iFin: #bad peak coeff - skip 3349 badPeak = True 3350 continue 3351 if useMP: 3352 profArgs[iref%ncores].append((refl[5+im],refl,iBeg,iFin,1.)) 3353 else: 3354 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])) 3283 3355 elif 'T' in calcControls[hfx+'histType']: 3284 3356 for iref,refl in enumerate(refDict['RefList']): … … 3324 3396 yc += y 3325 3397 MPpool.terminate() 3326 elif useMP :3398 elif useMP and 'T' in calcControls[hfx+'histType']: 3327 3399 for y in MPpool.imap_unordered(G2mp.ComputePwdrProfTOF,profArgs): 3400 yc += y 3401 MPpool.terminate() 3402 elif useMP and 'B' in calcControls[hfx+'histType']: 3403 for y in MPpool.imap_unordered(G2mp.ComputePwdrProfPink,profArgs): 3328 3404 yc += y 3329 3405 MPpool.terminate() … … 3409 3485 else: 3410 3486 wave = parmDict[hfx+'Lam'] 3487 elif 'B' in calcControls[hfx+'histType']: 3488 wave = parmDict[hfx+'Lam'] 3411 3489 for phase in Histogram['Reflection Lists']: 3412 3490 refDict = Histogram['Reflection Lists'][phase] … … 3476 3554 if 'C' in calcControls[hfx+'histType']: #CW powder 3477 3555 Wd,fmin,fmax = G2pwd.getWidthsCW(refl[5+im],refl[6+im],refl[7+im],shl) 3478 el se: #'T'OF3556 elif 'T' in calcControls[hfx+'histType']: 3479 3557 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im],refl[13+im],refl[6+im],refl[7+im]) 3558 elif 'B' in calcControls[hfx+'histType']: 3559 Wd,fmin,fmax = G2pwd.getWidthsTOF(refl[5+im],refl[12+im]/100.,refl[13+im]/1.e4,refl[6+im],refl[7+im]) 3480 3560 iBeg = np.searchsorted(x,refl[5+im]-fmin) 3481 3561 iFin = np.searchsorted(x,refl[5+im]+fmax) … … 3506 3586 dMdpk2[5] = 100.*cw[iBeg2:iFin2]*refl[11+im]*dMdipk2[0] 3507 3587 dervDict2 = {'int':dMdpk2[0],'pos':dMdpk2[1],'sig':dMdpk2[2],'gam':dMdpk2[3],'shl':dMdpk2[4],'L1/L2':dMdpk2[5]*refl[9]} 3508 el se: #'T'OF3588 elif 'T' in calcControls[hfx+'histType']: 3509 3589 lenBF = iFin-iBeg 3510 3590 if lenBF < 0: #bad peak coeff … … 3514 3594 for i in range(6): 3515 3595 dMdpk[i] += refl[11+im]*refl[9+im]*dMdipk[i] #cw[iBeg:iFin]* 3596 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4],'gam':dMdpk[5]} 3597 elif 'B' in calcControls[hfx+'histType']: 3598 tanth = tand(pos/2.0) 3599 costh = cosd(pos/2.0) 3600 lenBF = iFin-iBeg 3601 if lenBF < 0: #bad peak coeff 3602 break 3603 dMdpk = np.zeros(shape=(6,lenBF)) 3604 dMdipk = G2pwd.getdEpsVoigt(refl[5+im],refl[12+im],refl[13+im],refl[6+im]/100.,refl[7+im]/1.e4,ma.getdata(x[iBeg:iFin])) 3605 for i in range(6): 3606 dMdpk[i] += refl[11+im]*refl[9+im]*dMdipk[i] 3516 3607 dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'alp':dMdpk[2],'bet':dMdpk[3],'sig':dMdpk[4],'gam':dMdpk[5]} 3517 3608 if Phase['General'].get('doPawley'): … … 3542 3633 else: 3543 3634 names.update({hfx+'Absorption':[dFdAb,'int'],}) 3544 el se: #'T'OF3635 elif 'T' in calcControls[hfx+'histType']: #'T'OF 3545 3636 dpdA,dpdZ,dpdDC,dpdDA,dpdDB,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict) 3546 3637 names = {hfx+'Scale':[dIdsh,'int'],phfx+'Scale':[dIdsp,'int'], … … 3550 3641 hfx+'beta-q':[1./refl[4+im]**2,'bet'],hfx+'sig-0':[1.0,'sig'],hfx+'sig-1':[refl[4+im]**2,'sig'], 3551 3642 hfx+'sig-2':[refl[4+im]**4,'sig'],hfx+'sig-q':[refl[4+im],'sig'], 3643 hfx+'Absorption':[dFdAb,'int'],phfx+'Extinction':[dFdEx,'int'],} 3644 elif 'B' in calcControls[hfx+'histType']: #'T'OF 3645 dpdA,dpdw,dpdZ,dpdSh,dpdTr,dpdX,dpdY,dpdV = GetReflPosDerv(refl,im,0.0,A,pfx,hfx,phfx,calcControls,parmDict) 3646 names = {hfx+'Scale':[dIdsh,'int'],phfx+'Scale':[dIdsp,'int'],hfx+'Lam':[dpdw,'pos'], 3647 hfx+'Zero':[dpdZ,'pos'],hfx+'X':[1.0/costh,'gam'],hfx+'Y':[tanth,'gam'],hfx+'Z':[1.0,'gam'], 3648 hfx+'U':[tanth**2,'sig'],hfx+'V':[tanth,'sig'],hfx+'W':[1.0,'sig'],hfx+'Polariz.':[dIdpola,'int'], 3649 hfx+'alpha-0':[1.0,'alp'],hfx+'alpha-1':[tanth,'alp'],hfx+'beta-0':[1.0,'bet'],hfx+'beta-1':[tanth,'bet'], 3552 3650 hfx+'Absorption':[dFdAb,'int'],phfx+'Extinction':[dFdEx,'int'],} 3553 3651 for name in names: … … 3619 3717 if Ka2 and iFin2-iBeg2: 3620 3718 depDerivDict[name][iBeg2:iFin2] += dpdV[i]*dervDict2['pos'] 3621 if 'C' in calcControls[hfx+'histType'] :3719 if 'C' in calcControls[hfx+'histType'] or 'B' in calcControls[hfx+'histType']: 3622 3720 sigDict,gamDict = GetSampleSigGamDerv(refl,im,wave,G,GB,SGData,hfx,phfx,calcControls,parmDict) 3623 3721 else: #'T'OF
Note: See TracChangeset
for help on using the changeset viewer.