Changeset 355
- Timestamp:
- Aug 25, 2011 12:14:25 PM (12 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIpwd.py
r354 r355 1064 1064 global parmDict2 1065 1065 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, 1068 1068 '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, 1070 1070 } 1071 1071 global varyList … … 1100 1100 hplot.plot(xdata,(y1-y0)/delt,'r+') 1101 1101 1102 1102 def 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+') 1103 1115 1104 1116 if __name__ == '__main__': … … 1107 1119 plotter = plot.PlotNotebook() 1108 1120 # 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) 1111 1127 print "OK" 1112 1128 plotter.StartEventLoop() -
trunk/fsource/pypowder.for
r353 r355 62 62 END 63 63 64 SUBROUTINE PYPSVFCJO(NPTS,DTT,TTHETA,SIG,GAM,SPH,PRFUNC) 65 C DTT in degrees 66 C TTHETA in degrees 67 C SPH is S/L + H/L 68 C RETURNS FUNCTION ONLY 69 Cf2py intent(in) NPTS 70 Cf2py intent(in) DTT 71 cf2py depend(NPTS) DTT 72 Cf2py intent(in) TTHETA 73 Cf2py intent(in) SIG 74 Cf2py intent(in) GAM 75 Cf2py intent(in) SPH 76 Cf2py intent(out) PRFUNC 77 Cf2py 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) 92 C DTT in degrees 93 C TTHETA in degrees 94 C SPH is S/L + H/L 95 C RETURNS FUNCTION & DERIVATIVES 96 Cf2py intent(in) NPTS 97 Cf2py intent(in) DTT 98 cf2py depend(NPTS) DTT 99 Cf2py intent(in) TTHETA 100 Cf2py intent(in) SIG 101 Cf2py intent(in) GAM 102 Cf2py intent(in) SHL 103 Cf2py intent(out) PRFUNC 104 Cf2py depend(NPTS) PRFUNC 105 Cf2py intent(out) DPRDT 106 Cf2py depend(NPTS) DPRDT 107 Cf2py intent(out) SIGPART 108 Cf2py depend(NPTS) SIGPART 109 Cf2py intent(out) GAMPART 110 Cf2py depend(NPTS) GAMPART 111 Cf2py intent(out) SLPART 112 Cf2py 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.