Changeset 1341
- Timestamp:
- May 12, 2014 12:32:16 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r1339 r1341 443 443 def OnPlotKeyPress(event): 444 444 newPlot = False 445 if event.key == 'w' and 'PWDR' in plottype:445 if event.key == 'w': 446 446 G2frame.Weight = not G2frame.Weight 447 if not G2frame.Weight :447 if not G2frame.Weight and 'PWDR' in plottype: 448 448 G2frame.SinglePlot = True 449 449 newPlot = True … … 481 481 elif event.key == 'c' and 'PWDR' in plottype: 482 482 newPlot = True 483 G2frame.Contour = not G2frame.Contour484 483 if not G2frame.Contour: 485 484 G2frame.SinglePlot = False 486 485 G2frame.Offset = [0.,0.] 486 else: 487 G2frame.SinglePlot = True 488 G2frame.Contour = not G2frame.Contour 487 489 elif event.key == 'q': 488 490 if 'PWDR' in plottype: … … 846 848 Plot.set_xlabel(r'$TOF, \mathsf{\mu}$s',fontsize=16) 847 849 if G2frame.Weight: 848 Plot.set_ylabel(r'$\mathsf{I/\sigma(I)}$',fontsize=16) 850 if 'PWDR' in plottype: 851 Plot.set_ylabel(r'$\mathsf{I/\sigma(I)}$',fontsize=16) 852 elif 'SASD' in plottype: 853 Plot.set_ylabel(r'$\mathsf{\Delta(I)/\sigma(I)}$',fontsize=16) 849 854 else: 850 855 if 'C' in ParmList[0]['Type'][0]: … … 862 867 ContourY = [] 863 868 Nseq = 0 864 if len(PlotList) < 2:865 G2frame.Contour = False866 869 for N,Pattern in enumerate(PlotList): 867 870 Parms = ParmList[N] … … 948 951 ZB = Z+B 949 952 Plot.set_yscale("log",nonposy='mask') 950 Plot.set_ylim(bottom=np.min(np.trim_zeros(YB))/2.,top=np.max(Y)*2.) 953 if np.any(W>0.): 954 Plot.set_ylim(bottom=np.min(np.trim_zeros(W))/2.,top=np.max(Y)*2.) 955 else: 956 Plot.set_ylim(bottom=np.min(np.trim_zeros(YB))/2.,top=np.max(Y)*2.) 951 957 if G2frame.logPlot: 952 958 if 'PWDR' in plottype: … … 954 960 Plot.plot(X,Y,colors[N%6]+'+',picker=3.,clip_on=False) 955 961 Plot.plot(X,Z,colors[(N+1)%6],picker=False) 956 Plot.plot(X,W,colors[(N+2)%6],picker=False) 962 Plot.plot(X,W,colors[(N+2)%6],picker=False) #background 957 963 elif 'SASD' in plottype: 958 964 Plot.set_xscale("log",nonposx='mask') … … 967 973 else: 968 974 Plot.plot(X,YB,colors[N%6]+'+',picker=3.,clip_on=False) 969 Plot.plot(X,W,colors[(N+2)%6],picker=False) 975 Plot.plot(X,W,colors[(N+2)%6],picker=False) #const. background 970 976 Plot.plot(X,ZB,colors[(N+1)%6],picker=False) 971 977 elif G2frame.Weight and 'PWDR' in plottype: -
trunk/GSASIIsasd.py
r1339 r1341 993 993 Fin = np.min([rx[-1],x[-1],Limits[1][1],refLimits[1][1]]) 994 994 iBeg = np.searchsorted(x,Beg) 995 iFin = np.searchsorted(x,Fin) 995 iFin = np.searchsorted(x,Fin)+1 #include last point 996 996 sum = np.sum(y[iBeg:iFin]) 997 997 refsum = np.sum(np.interp(x[iBeg:iFin],rx,ry,0,0)) … … 1001 1001 return (G*P/Rg**P)*np.exp(scsp.gammaln(P/2)) 1002 1002 1003 def SmearData(Ic,Q,slitLen): 1004 Qtemp = np.concatenate([Q,20*Q]) 1005 Ictemp = np.concatenate([Ic,np.zeros_like(Ic)]) 1006 print Ictemp 1007 Icsm = np.zeros_like(Qtemp) 1003 def SmearData(Ic,Q,slitLen,Back): 1008 1004 Np = Q.shape[0] 1005 Qtemp = np.concatenate([Q,Q[-1]+20*Q]) 1006 Ictemp = np.concatenate([Ic,Ic[-1]*(1-(Qtemp[Np:]-Qtemp[Np])/(20*Qtemp[Np-1]))]) 1007 Icsm = np.zeros_like(Q) 1009 1008 Qsm = 2*slitLen*(np.interp(np.arange(2*Np)/2.,np.arange(Np),Q)-Q[0])/(Q[-1]-Q[0]) 1010 1009 Sp = np.searchsorted(Qsm,slitLen) 1011 for i in range(Np): 1012 Ism = np.interp(np.sqrt(Q[i]**2+Qsm**2),Qtemp,Ictemp) 1013 print Ism 1014 raise Exception 1015 Icsm[i] = np.sum(Ism[:Sp]) 1010 DQsm = np.diff(Qsm)[:Sp] 1011 Ism = np.interp(np.sqrt(Q[:,np.newaxis]**2+Qsm**2),Qtemp,Ictemp) 1012 Icsm = np.sum((Ism[:,:Sp]*DQsm),axis=1) 1016 1013 Icsm /= slitLen 1017 return Icsm #for now1014 return Icsm 1018 1015 1019 1016 ############################################################################### … … 1048 1045 wtFactor = ProfDict['wtFactor'] 1049 1046 Ibeg = np.searchsorted(Q,Qmin) 1050 Ifin = np.searchsorted(Q,Qmax) 1047 Ifin = np.searchsorted(Q,Qmax)+1 #include last point 1051 1048 BinMag = np.zeros_like(Bins) 1052 1049 Ic[:] = 0. … … 1225 1222 slitLen = Sample['SlitLen'] 1226 1223 if slitLen: 1227 Ic = SmearData(Ic,Q,slitLen )1224 Ic = SmearData(Ic,Q,slitLen,parmDict['Back']) 1228 1225 return Ic 1229 1226 … … 1233 1230 wtFactor = ProfDict['wtFactor'] 1234 1231 Ibeg = np.searchsorted(Q,Qmin) 1235 Ifin = np.searchsorted(Q,Qmax) 1232 Ifin = np.searchsorted(Q,Qmax)+1 #include last point 1236 1233 Ic[:] = 0 1237 1234 levelTypes,parmDict,varyList,values = GetModelParms() … … 1301 1298 wtFactor = ProfDict['wtFactor'] 1302 1299 Ibeg = np.searchsorted(Q,Qmin) 1303 Ifin = np.searchsorted(Q,Qmax) 1300 Ifin = np.searchsorted(Q,Qmax)+1 #include last point 1304 1301 Ib[:] = Back[0] 1305 1302 Ic[:] = 0 … … 1377 1374 slitLen = Sample['SlitLen'] 1378 1375 if slitLen: 1379 Ic[Ibeg:Ifin] = SmearData(Ic,Q,slitLen )[Ibeg:Ifin]1376 Ic[Ibeg:Ifin] = SmearData(Ic,Q,slitLen,Back[0])[Ibeg:Ifin] 1380 1377 sasdData['Size Calc'] = [Rbins,Dist] 1381 1378
Note: See TracChangeset
for help on using the changeset viewer.