Changeset 1682 for trunk/GSASIIpwd.py
- Timestamp:
- Feb 28, 2015 9:16:41 AM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwd.py
r1662 r1682 525 525 cw = np.diff(xdata) 526 526 cw = np.append(cw,cw[-1]) 527 sumBk = [0.,0.,0] 527 528 while True: 528 529 key = pfx+'Back;'+str(nBak) … … 531 532 else: 532 533 break 534 #empirical functions 533 535 if bakType in ['chebyschev','cosine']: 534 536 dt = xdata[-1]-xdata[0] … … 536 538 key = pfx+'Back;'+str(iBak) 537 539 if bakType == 'chebyschev': 538 yb += parmDict[key]*(2.*(xdata-xdata[0])/dt-1.)**iBak540 ybi = parmDict[key]*(2.*(xdata-xdata[0])/dt-1.)**iBak 539 541 elif bakType == 'cosine': 540 yb += parmDict[key]*npcosd(xdata*iBak) 542 ybi = parmDict[key]*npcosd(xdata*iBak) 543 yb += ybi 544 sumBk[0] = np.sum(ybi) 541 545 elif bakType in ['lin interpolate','inv interpolate','log interpolate',]: 542 546 if nBak == 1: … … 561 565 bakInt = si.interp1d(bakPos,bakVals,'linear') 562 566 yb = bakInt(xdata) 567 sumBk[0] = np.sum(yb) 568 #Debye function 563 569 if pfx+'difC' in parmDict: 564 570 ff = 1. … … 578 584 dbR = parmDict[pfx+'DebyeR;'+str(iD)] 579 585 dbU = parmDict[pfx+'DebyeU;'+str(iD)] 580 yb += ff*dbA*np.sin(q*dbR)*np.exp(-dbU*q**2)/(q*dbR) 586 ybi = ff*dbA*np.sin(q*dbR)*np.exp(-dbU*q**2)/(q*dbR) 587 yb += ybi 588 sumBk[1] += np.sum(ybi) 581 589 iD += 1 582 590 except KeyError: 583 591 break 592 #peaks 584 593 iD = 0 585 594 while True: … … 603 612 iFin = np.searchsorted(xdata,pkP+fmax) 604 613 if 'C' in dataType: 605 yb[iBeg:iFin] += pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin]) 614 ybi = pkI*getFCJVoigt3(pkP,pkS,pkG,0.002,xdata[iBeg:iFin]) 615 yb[iBeg:iFin] += ybi 606 616 else: #'T'OF 607 yb[iBeg:iFin] += pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin]) 617 ybi = pkI*getEpsVoigt(pkP,1.,1.,pkS,pkG,xdata[iBeg:iFin]) 618 yb[iBeg:iFin] += ybi 619 sumBk[2] += np.sum(ybi) 608 620 iD += 1 609 621 except KeyError: … … 612 624 print '**** WARNING - backround peak '+str(iD)+' sigma is negative; fix & try again ****' 613 625 break 614 return yb 626 return yb,sumBk 615 627 616 628 def getBackgroundDerv(hfx,parmDict,bakType,dataType,xdata): … … 836 848 'needs a doc string' 837 849 838 yb = getBackground('',parmDict,bakType,dataType,xdata) 850 yb = getBackground('',parmDict,bakType,dataType,xdata)[0] 839 851 yc = np.zeros_like(yb) 840 852 cw = np.diff(xdata) … … 1574 1586 1575 1587 sigDict = dict(zip(varyList,sig)) 1576 yb[xBeg:xFin] = getBackground('',parmDict,bakType,dataType,x[xBeg:xFin]) 1588 yb[xBeg:xFin] = getBackground('',parmDict,bakType,dataType,x[xBeg:xFin])[0] 1577 1589 yc[xBeg:xFin] = getPeakProfile(dataType,parmDict,x[xBeg:xFin],varyList,bakType) 1578 1590 yd[xBeg:xFin] = y[xBeg:xFin]-yc[xBeg:xFin] … … 1685 1697 msg = 'test ' 1686 1698 gplot = plotter.add('FCJ-Voigt, 11BM').gca() 1687 gplot.plot(xdata,getBackground('',parmDict0,bakType,'PXC',xdata) )1699 gplot.plot(xdata,getBackground('',parmDict0,bakType,'PXC',xdata)[0]) 1688 1700 gplot.plot(xdata,getPeakProfile(parmDict0,xdata,varyList,bakType)) 1689 1701 fplot = plotter.add('FCJ-Voigt, Ka1+2').gca() 1690 fplot.plot(xdata,getBackground('',parmDict1,bakType,'PXC',xdata) )1702 fplot.plot(xdata,getBackground('',parmDict1,bakType,'PXC',xdata)[0]) 1691 1703 fplot.plot(xdata,getPeakProfile(parmDict1,xdata,varyList,bakType)) 1692 1704
Note: See TracChangeset
for help on using the changeset viewer.