Changeset 5261
- Timestamp:
- Apr 13, 2022 2:38:43 PM (11 months ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwd.py
r5253 r5261 1013 1013 if 'C' in dataType: 1014 1014 ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin])[0] 1015 yb[iBeg:iFin] += ybi1016 1015 elif 'T' in dataType: 1017 1016 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin])[0] 1018 yb[iBeg:iFin] += ybi1019 1017 elif 'B' in dataType: 1020 1018 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS/100.,pkG/1.e4,xdata[iBeg:iFin])[0] 1021 yb[iBeg:iFin] += ybi1022 1019 elif 'E' in dataType: 1023 1020 ybi = pkI*getPsVoigt(pkP,pkS*10.**4,pkG*100.,xdata[iBeg:iFin])[0] 1024 yb[iBeg:iFin] += ybi 1021 else: 1022 raise Exception('dataType of {:} should not happen!'.format(dataType)) 1023 yb[iBeg:iFin] += ybi 1025 1024 sumBk[2] += np.sum(ybi) 1026 1025 iD += 1 … … 2065 2064 lnames = ['position','intensity'] 2066 2065 if FitPgm == 'LaueFringe': 2067 names += [' sig','gam','cells']2068 lnames += ['s igma','gamma','cells']2069 fmt = ["%10.5f","%10. 3f","%10.3f","%10.3f","%10.3f"]2066 names += ['damp','asym','sig','gam'] 2067 lnames += ['satellite\ndamping','satellite\nasym','sigma','gamma'] 2068 fmt = ["%10.5f","%10.2f","%10.3f","%10.3f","%10.3f","%10.3f"] 2070 2069 elif 'C' in dataType: 2071 2070 names += ['sig','gam'] … … 2086 2085 return names, fmt, lnames 2087 2086 2088 def DoPeakFit(FitPgm,Peaks,Background,Limits,Inst,Inst2,data,fixback=None,prevVaryList=[],oneCycle=False,controls=None,wtFactor=1.0,dlg=None,noFit=False): 2087 def DoPeakFit(FitPgm,Peaks,Background,Limits,Inst,Inst2,data,fixback=None,prevVaryList=[], 2088 oneCycle=False,controls=None,wtFactor=1.0,dlg=None,noFit=False): 2089 2089 '''Called to perform a peak fit, refining the selected items in the peak 2090 2090 table as well as selected items in the background. 2091 2091 2092 2092 :param str FitPgm: type of fit to perform. At present this is ignored. 2093 :param list Peaks: a list of peaks. Each peak entry is a list with 8 values: 2094 four values followed by a refine flag where the values are: position, intensity, 2093 :param list Peaks: a list of peaks. Each peak entry is a list with paired values: 2094 The number of pairs depends on the data type (see :func:`getHeaderInfo`). 2095 For CW data there are 2096 four values each followed by a refine flag where the values are: position, intensity, 2095 2097 sigma (Gaussian width) and gamma (Lorentzian width). From the Histogram/"Peak List" 2096 tree entry, dict item "peaks" 2098 tree entry, dict item "peaks". For some types of fits, overall parameters are placed 2099 in a dict entry. 2097 2100 :param list Background: describes the background. List with two items. 2098 2101 Item 0 specifies a background model and coefficients. Item 1 is a dict. … … 2223 2226 return dataType,instDict,insVary 2224 2227 2225 def Get InstParms(parmDict,Inst,varyList,Peaks):2228 def GetPkInstParms(parmDict,Inst,varyList): 2226 2229 for name in Inst: 2227 2230 Inst[name][1] = parmDict[name] … … 2270 2273 2271 2274 def SetPeaksParms(dataType,Peaks): 2272 peak Names = []2275 peakDict = {} 2273 2276 peakVary = [] 2274 peakVals = []2275 2277 names,_,_ = getHeaderInfo(FitPgm,dataType) 2276 2278 for i,peak in enumerate(Peaks): 2279 if type(peak) is dict: 2280 peakDict.update(peak) 2281 continue 2277 2282 for j,name in enumerate(names): 2278 peakVals.append(peak[2*j])2279 2283 parName = name+str(i) 2280 peak Names.append(parName)2284 peakDict[parName] = peak[2*j] 2281 2285 if peak[2*j+1]: 2282 2286 peakVary.append(parName) 2283 return dict(zip(peakNames,peakVals)),peakVary2287 return peakDict,peakVary 2284 2288 2285 2289 def GetPeaksParms(Inst,parmDict,Peaks,varyList): 2286 2290 names,_,_ = getHeaderInfo(FitPgm,Inst['Type'][0]) 2287 2291 for i,peak in enumerate(Peaks): 2292 if type(peak) is dict: 2293 continue 2288 2294 pos = parmDict['pos'+str(i)] 2289 2295 if 'difC' in Inst: … … 2329 2335 ptfmt = dict(zip(names,fmt)) 2330 2336 for i,peak in enumerate(Peaks): 2337 if type(peak) is dict: 2338 continue 2331 2339 ptstr = ':' 2332 2340 for j in range(len(names)): … … 2445 2453 GetBackgroundParms(parmDict,Background) 2446 2454 if bakVary: BackgroundPrint(Background,sigDict) 2447 Get InstParms(parmDict,Inst,varyList,Peaks)2455 GetPkInstParms(parmDict,Inst,varyList) 2448 2456 if insVary: InstPrint(Inst,sigDict) 2449 2457 GetPeaksParms(Inst,parmDict,Peaks,varyList) 2450 2458 binsperFWHM = [] 2451 2459 for peak in Peaks: 2460 if type(peak) is dict: 2461 continue 2452 2462 FWHM = getFWHM(peak[0],Inst) 2453 2463 try:
Note: See TracChangeset
for help on using the changeset viewer.