Changeset 355


Ignore:
Timestamp:
Aug 25, 2011 12:14:25 PM (11 years ago)
Author:
vondreele
Message:

done with peak fitting

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIpwd.py

    r354 r355  
    10641064    global parmDict2
    10651065    parmDict2 = {
    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,
     1066        'pos0':5.7,'int0':1000.0,'sig0':0.5,'gam0':0.5,
     1067        'U':2.,'V':-2.,'W':5.,'X':0.5,'Y':0.5,'SH/L':0.02,
    10681068        'Back0':5.,'Back1':-0.02,'Back2':.004,
    1069         'Lam1':1.540500,'Lam2':1.544300,'I(L2)/I(L1)':0.5,
     1069#        'Lam1':1.540500,'Lam2':1.544300,'I(L2)/I(L1)':0.5,
    10701070        }
    10711071    global varyList
     
    11001100    hplot.plot(xdata,(y1-y0)/delt,'r+')
    11011101   
    1102    
     1102def test3(name,delt):
     1103    if NeedTestData: TestData()
     1104    names = ['pos','sig','gam','shl']
     1105    idx = names.index(name)
     1106    myDict = {'pos':parmDict2['pos0'],'sig':parmDict2['sig0'],'gam':parmDict2['gam0'],'shl':parmDict2['SH/L']}
     1107    xdata = np.linspace(5.6,5.8,800)
     1108    dx = xdata[1]-xdata[0]
     1109    hplot = plotter.add('derivatives test for '+name).gca()
     1110    hplot.plot(xdata,100.*dx*getdFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)[idx+1])
     1111    y0 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)
     1112    myDict[name] += delt
     1113    y1 = getFCJVoigt3(myDict['pos'],myDict['sig'],myDict['gam'],myDict['shl'],xdata)
     1114    hplot.plot(xdata,(y1-y0)/delt,'r+')
    11031115
    11041116if __name__ == '__main__':
     
    11071119    plotter = plot.PlotNotebook()
    11081120#    test0()
    1109     for name in ['int0','pos0','sig0','gam0','U','V','W','X','Y','SH/L','I(L2)/I(L1)']:
    1110         test2(name,.001)
     1121#    for name in ['int0','pos0','sig0','gam0','U','V','W','X','Y','SH/L','I(L2)/I(L1)']:
     1122    for name,shft in [['int0',0.1],['pos0',0.0001],['sig0',0.01],['gam0',0.00001],
     1123        ['U',0.1],['V',0.01],['W',0.01],['X',0.0001],['Y',0.0001],['SH/L',0.00005]]:
     1124        test2(name,shft)
     1125    for name,shft in [['pos',0.0001],['sig',0.01],['gam',0.0001],['shl',0.00005]]:
     1126        test3(name,shft)
    11111127    print "OK"
    11121128    plotter.StartEventLoop()
  • trunk/fsource/pypowder.for

    r353 r355  
    6262      END
    6363
     64      SUBROUTINE PYPSVFCJO(NPTS,DTT,TTHETA,SIG,GAM,SPH,PRFUNC)
     65C DTT in degrees
     66C TTHETA in degrees
     67C SPH is S/L + H/L
     68C RETURNS FUNCTION ONLY
     69Cf2py intent(in) NPTS
     70Cf2py intent(in) DTT
     71cf2py depend(NPTS) DTT
     72Cf2py intent(in) TTHETA
     73Cf2py intent(in) SIG
     74Cf2py intent(in) GAM
     75Cf2py intent(in) SPH
     76Cf2py intent(out) PRFUNC
     77Cf2py depend(NPTS) PRFUNC
     78
     79      REAL*4 DTT(0:NPTS-1),PRFUNC(0:NPTS-1)
     80      FW = (2.355*SQRT(SIG)+GAM)/100.0
     81      FMIN = 10.0*(-FW-SPH*COSD(TTHETA))
     82      FMAX = 15.0*FW
     83      DO I=0,NPTS-1
     84        CALL PSVFCJO(DTT(I)*100.,TTHETA*100.,SIG,GAM,SPH/2.0,SPH/2.0,
     85     1    PRFUNC(I),DPRDT,SIGPART,GAMPART,SLPART,HLPART)
     86      END DO
     87      RETURN
     88      END
     89
     90      SUBROUTINE PYDPSVFCJO(NPTS,DTT,TTHETA,SIG,GAM,SHL,PRFUNC,
     91     1  DPRDT,SIGPART,GAMPART,SLPART)
     92C DTT in degrees
     93C TTHETA in degrees
     94C SPH is S/L + H/L
     95C RETURNS FUNCTION & DERIVATIVES
     96Cf2py intent(in) NPTS
     97Cf2py intent(in) DTT
     98cf2py depend(NPTS) DTT
     99Cf2py intent(in) TTHETA
     100Cf2py intent(in) SIG
     101Cf2py intent(in) GAM
     102Cf2py intent(in) SHL
     103Cf2py intent(out) PRFUNC
     104Cf2py depend(NPTS) PRFUNC
     105Cf2py intent(out) DPRDT
     106Cf2py depend(NPTS) DPRDT
     107Cf2py intent(out) SIGPART
     108Cf2py depend(NPTS) SIGPART
     109Cf2py intent(out) GAMPART
     110Cf2py depend(NPTS) GAMPART
     111Cf2py intent(out) SLPART
     112Cf2py depend(NPTS) SLPART
     113
     114      REAL*4 DTT(0:NPTS-1),DPRDT(0:NPTS-1),SIGPART(0:NPTS-1),
     115     1  GAMPART(0:NPTS-1),SLPART(0:NPTS-1),PRFUNC(0:NPTS-1)
     116      FW = (2.355*SQRT(SIG)+GAM)/100.0
     117      FMIN = 10.0*(-FW-SPH*COSD(TTHETA))
     118      FMAX = 15.0*FW
     119      DO I=0,NPTS-1
     120        CALL PSVFCJO(DTT(I)*100.,TTHETA*100.,SIG,GAM,SHL/2.,SHL/2.,
     121     1    PRFUNC(I),DPRDT(I),SIGPART(I),GAMPART(I),SPART,HPART)
     122          SLPART(I) = SPART
     123        DPRDT(I) = DPRDT(I)*100.
     124      END DO
     125      RETURN
     126      END
     127
Note: See TracChangeset for help on using the changeset viewer.