Changeset 350 for trunk/GSASIIpwd.py


Ignore:
Timestamp:
Aug 20, 2011 11:18:31 AM (11 years ago)
Author:
vondreele
Message:

implement fortran psVoigt routine - faster by 2X over python fft version

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r345 r350  
    2828import GSASIIgrid as G2gd
    2929import GSASIIIO as G2IO
     30import pypowder as pyd
    3031
    3132# trig functions in degrees
     
    534535    return intens*Df(xdata)*DX/dx
    535536
     537#use old fortran routine
     538def getFCJVoigt3(pos,intens,sig,gam,shl,xdata):
     539   
     540    Df = pyd.pypsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl)
     541    Df /= np.sum(Df)
     542    return intens*Df
     543
    536544def getPeakProfile(parmDict,xdata,varyList,bakType):
    537545   
     
    581589            elif not iBeg-iFin:     #peak above high limit
    582590                return yb+yc
    583             yc[iBeg:iFin] += getFCJVoigt(pos,intens,sig,gam,shl,xdata[iBeg:iFin])
     591            yc[iBeg:iFin] += getFCJVoigt3(pos,intens,sig,gam,shl,xdata[iBeg:iFin])
    584592            if Ka2:
    585593                pos2 = pos+lamRatio*tand(pos/2.0)       # + 360/pi * Dlam/lam * tan(th)
     
    588596                iFin = min(lenX,iFin+kdelt)
    589597                if iBeg-iFin:
    590                     yc[iBeg:iFin] += getFCJVoigt(pos2,intens*kRatio,sig,gam,shl,xdata[iBeg:iFin])
     598                    yc[iBeg:iFin] += getFCJVoigt3(pos2,intens*kRatio,sig,gam,shl,xdata[iBeg:iFin])
    591599            iPeak += 1
    592600        except KeyError:        #no more peaks to process
     
    770778            dlg.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5))
    771779            try:
    772                 result = so.leastsq(errPeakProfile,values,full_output=True,             #ftol=Ftol,
     780                result = so.leastsq(errPeakProfile,values,full_output=True,epsfcn=1.e-8,ftol=Ftol,
    773781                    args=(x[xBeg:xFin],y[xBeg:xFin],w[xBeg:xFin],parmDict,varyList,bakType,dlg))
    774782            finally:
Note: See TracChangeset for help on using the changeset viewer.