Changeset 354


Ignore:
Timestamp:
Aug 25, 2011 10:11:29 AM (11 years ago)
Author:
vondreele
Message:

more cleanup of derivatives

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r353 r354  
    558558    Df,dFdp,dFds,dFdg,dFdsh = pyd.pydpsvfcj(len(xdata),xdata-pos,pos,sig,gam,shl) #might have to make these numpy arrays?
    559559    sumDf = np.sum(Df)
    560     return Df/sumDf,dFdp,dFds,dFdg,dFdsh
     560    return Df,dFdp,dFds,dFdg,dFdsh
    561561   
    562562
     
    679679            dMdpk = np.zeros(shape=(6,len(xdata)))
    680680            dMdipk = getdFCJVoigt3(pos,sig,gam,shl,xdata[iBeg:iFin])
    681             for i in range(5):
    682                 dMdpk[i][iBeg:iFin] = 100.*dx*intens*dMdipk[i]
    683             dMdpk[0][iBeg:iFin] = dMdipk[0]
     681            for i in range(1,5):
     682                dMdpk[i][iBeg:iFin] += 100.*dx*intens*dMdipk[i]
     683            dMdpk[0][iBeg:iFin] += 100.*dx*dMdipk[0]
    684684            dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'sig':dMdpk[2],'gam':dMdpk[3],'shl':dMdpk[4]}
    685685            if Ka2:
     
    689689                iFin = min(lenX,iFin+kdelt)
    690690                if iBeg-iFin:
    691                     dMdipk = getdFCJVoigt3(pos2,sig,gam,shl,xdata[iBeg:iFin])
    692                     for i in range(5):
    693                         dMdpk[i][iBeg:iFin] += 100.*dx*intens*kRatio*dMdipk[i]
    694                     dMdpk[0][iBeg:iFin] += kRatio*dMdipk[0]
    695                     dMdpk[5][iBeg:iFin] += dMdipk[0]
     691                    dMdipk2 = getdFCJVoigt3(pos2,sig,gam,shl,xdata[iBeg:iFin])
     692                    for i in range(1,5):
     693                        dMdpk[i][iBeg:iFin] += 100.*dx*intens*kRatio*dMdipk2[i]
     694                    dMdpk[0][iBeg:iFin] += 100.*dx*kRatio*dMdipk2[0]
     695                    dMdpk[5][iBeg:iFin] += 100.*dx*dMdipk2[0]
    696696                    dervDict = {'int':dMdpk[0],'pos':dMdpk[1],'sig':dMdpk[2],'gam':dMdpk[3],'shl':dMdpk[4],'L1/L2':dMdpk[5]*intens}
    697697            for parmName in ['pos','int','sig','gam']:
     
    10641064    global parmDict2
    10651065    parmDict2 = {
    1066         'pos0':5.7,'int0':10.0,'sig0':0.5,'gam0':1.0,
    1067         'U':1.,'V':-1.,'W':0.1,'X':0.0,'Y':2.,'SH/L':0.004,
     1066        'pos0':5.7,'int0':1000.0,'sig0':0.5,'gam0':1.0,
     1067        'U':2.,'V':-2.,'W':5.,'X':1.0,'Y':2.,'SH/L':0.01,
    10681068        'Back0':5.,'Back1':-0.02,'Back2':.004,
    10691069        'Lam1':1.540500,'Lam2':1.544300,'I(L2)/I(L1)':0.5,
     
    10921092    if NeedTestData: TestData()
    10931093    varyList = [name,]
    1094     xdata = np.linspace(5.6,5.8,800)
     1094    xdata = np.linspace(5.6,5.8,400)
    10951095    hplot = plotter.add('derivatives test for '+name).gca()
    10961096    hplot.plot(xdata,getPeakProfileDerv(parmDict2,xdata,varyList,bakType)[0])
     
    11071107    plotter = plot.PlotNotebook()
    11081108#    test0()
    1109     test2('I(L2)/I(L1)',.0001)
     1109    for name in ['int0','pos0','sig0','gam0','U','V','W','X','Y','SH/L','I(L2)/I(L1)']:
     1110        test2(name,.001)
    11101111    print "OK"
    11111112    plotter.StartEventLoop()
Note: See TracChangeset for help on using the changeset viewer.