Changeset 1300
- Timestamp:
- Apr 25, 2014 12:47:06 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIIO.py
r1298 r1300 1813 1813 np.array(yc), # calc. intensities (zero) 1814 1814 np.array(yd), # obs-calc profiles 1815 np.array(yb), # preset bkg 1815 1816 ''' 1816 1817 self.comments = [] -
trunk/GSASIIplot.py
r1297 r1300 450 450 elif event.key == 'e' and 'SASD' in plottype: 451 451 G2frame.ErrorBars = not G2frame.ErrorBars 452 elif event.key == 'b' and 'PWDR' in plottype:452 elif event.key == 'b': 453 453 G2frame.SubBack = not G2frame.SubBack 454 454 if not G2frame.SubBack: … … 479 479 G2frame.Cmax = 1.0 480 480 G2frame.Offset = [0,0] 481 elif event.key == 'c' :481 elif event.key == 'c' and 'PWDR' in plottype: 482 482 newPlot = True 483 483 G2frame.Contour = not G2frame.Contour … … 766 766 'c: contour on','q: toggle q plot','s: toggle single plot','+: no selection') 767 767 elif 'SASD' in plottype: 768 Page.Choice = (' key press',' c: contour on','n: semilog on',768 Page.Choice = (' key press','b: toggle subtract background','n: semilog on', 769 769 'd: offset down','l: offset left','r: offset right','u: offset up','o: reset offset', 770 770 'q: toggle S(q) plot','s: toggle single plot','+: no selection') … … 775 775 'q: toggle q plot','s: toggle single plot','w: toggle divide by sig','+: no selection') 776 776 elif 'SASD' in plottype: 777 Page.Choice = (' key press',' c: contour on','n: loglog on','e: toggle error bars',777 Page.Choice = (' key press','b: toggle subtract background','n: loglog on','e: toggle error bars', 778 778 'd: offset down','l: offset left','r: offset right','u: offset up','o: reset offset', 779 779 'q: toggle S(q) plot','s: toggle single plot','+: no selection') … … 896 896 Y = xye[1]+offset*N 897 897 elif 'SASD' in plottype: 898 B = xye[5] 898 899 if G2frame.sqPlot: 899 900 Y = xye[1]*Sample['Scale'][0]*(1.005)**(offset*N)*X**4 … … 934 935 elif 'SASD' in plottype: 935 936 if G2frame.sqPlot: 936 D= xye[4]*X**4937 W = xye[4]*X**4 937 938 Z = xye[3]*X**4 939 B = B*X**4 938 940 else: 939 D = xye[4] 941 W = xye[4] 942 if G2frame.SubBack: 943 YB = Y-B 944 ZB = Z 945 else: 946 YB = Y 947 ZB = Z+B 940 948 Plot.set_yscale("log",nonposy='mask') 941 949 Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.) … … 951 959 if G2frame.ErrorBars: 952 960 if G2frame.sqPlot: 953 Plot.errorbar(X,Y ,yerr=X**4*Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])),961 Plot.errorbar(X,YB,yerr=X**4*Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])), 954 962 ecolor=colors[N%6],picker=3.,clip_on=False) 955 963 else: 956 Plot.errorbar(X,Y ,yerr=Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])),964 Plot.errorbar(X,YB,yerr=Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])), 957 965 ecolor=colors[N%6],picker=3.,clip_on=False) 958 966 else: 959 Plot.plot(X,Y ,colors[N%6]+'+',picker=3.,clip_on=False)960 Plot.plot(X, D,colors[(N+2)%6],picker=False)961 Plot.plot(X,Z ,colors[(N+1)%6],picker=False)967 Plot.plot(X,YB,colors[N%6]+'+',picker=3.,clip_on=False) 968 Plot.plot(X,W,colors[(N+2)%6],picker=False) 969 Plot.plot(X,ZB,colors[(N+1)%6],picker=False) 962 970 elif G2frame.Weight and 'PWDR' in plottype: 963 971 DY = xye[1]*np.sqrt(xye[2]) … … 970 978 Plot.axhline(0.,color=wx.BLACK) 971 979 else: 972 if G2frame.SubBack and 'PWDR' in plottype:980 if G2frame.SubBack: 973 981 Plot.plot(Xum,Y-W,colors[N%6]+'+',picker=3.,clip_on=False) 974 982 Plot.plot(X,Z-W,colors[(N+1)%6],picker=False) … … 981 989 if 'PWDR' in plottype: 982 990 Plot.plot(X,W,colors[(N+2)%6],picker=False) 983 Plot.plot(X,D,colors[(N+3)%6],picker=False)991 Plot.plot(X,D,colors[(N+3)%6],picker=False) 984 992 Plot.axhline(0.,color=wx.BLACK) 985 993 Page.canvas.SetToolTipString('') -
trunk/GSASIIpwdGUI.py
r1297 r1300 121 121 'IPG':{'Niter':100,'Approach':0.8,'Power':-1},'Reg':{},}, 122 122 'Particle':{'Matrix':{'Name':'vacuum','VolFrac':[0.0,False]},'Levels':[],}, 123 'Current':'Size dist.', 123 'Current':'Size dist.','BackFile':'', 124 124 } 125 125 … … 2667 2667 if 'Matrix' not in data['Particle']: 2668 2668 data['Particle']['Matrix'] = {'Name':'vacuum','VolFrac':[0.0,False]} 2669 if 'BackFile' not in data: 2670 data['BackFile'] = '' 2669 2671 #end patches 2670 2672 … … 2719 2721 for item in copyList: 2720 2722 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,item) 2721 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Models'), 2722 copy.deepcopy(data)) 2723 newdata = copy.deepcopy(data) 2724 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,Id,'Models'),newdata) 2725 if newdata['BackFile']: 2726 Profile = G2frame.PatternTree.GetItemPyData(Id)[1] 2727 BackId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,newdata['BackFile']) 2728 BackSample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,BackId, 'Sample Parameters')) 2729 Profile[5] = BackSample['Scale'][0]*G2frame.PatternTree.GetItemPyData(BackId)[1][1] 2730 RefreshPlots(True) 2723 2731 2724 2732 def OnCopyFlags(event): … … 2754 2762 finally: 2755 2763 dlg.Destroy() 2756 2757 2758 2764 2759 2765 def OnFitModelAll(event): … … 2818 2824 return 2819 2825 G2sasd.SizeDistribution(Profile,ProfDict,Limits,Substances,Sample,data) 2826 G2plt.PlotSASDSizeDist(G2frame) 2820 2827 RefreshPlots(True) 2821 2828 … … 2859 2866 data['Current'] = fitSel.GetValue() 2860 2867 wx.CallAfter(UpdateModelsGrid,G2frame,data) 2861 2862 def OnValueChange(event):2863 Obj = event.GetEventObject()2864 itemKey,ind,fmt = Indx[Obj.GetId()]2865 try:2866 value = float(Obj.GetValue())2867 except ValueError:2868 value = 0.02869 Obj.SetValue(fmt%(value))2870 data[itemKey][ind] = value2871 if itemKey == 'Back':2872 Profile[4][:] = value2873 RefreshPlots()2874 2868 2875 2869 def OnCheckBox(event): … … 3231 3225 RefreshPlots(True) 3232 3226 3227 def OnBackChange(event): 3228 try: 3229 value = float(backVal.GetValue()) 3230 except ValueError: 3231 value = 0.0 3232 backVal.SetValue('%.3g'%(value)) 3233 data['Back'][0] = value 3234 Profile[4][:] = value 3235 RefreshPlots() 3236 3237 def OnBackFile(event): 3238 data['BackFile'] = backFile.GetValue() 3239 if data['BackFile']: 3240 fixBack = data['Back'][0] 3241 BackId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,data['BackFile']) 3242 BackSample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,BackId, 'Sample Parameters')) 3243 Profile[5] = BackSample['Scale'][0]*G2frame.PatternTree.GetItemPyData(BackId)[1][1] 3244 RefreshPlots(True) 3245 3233 3246 Sample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Sample Parameters')) 3234 3247 Limits = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Limits')) … … 3236 3249 Substances = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId, 'Substances')) 3237 3250 ProfDict,Profile = G2frame.PatternTree.GetItemPyData(G2frame.PatternId)[:2] 3238 3251 if data['BackFile']: 3252 BackId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,data['BackFile']) 3253 BackSample = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,BackId, 'Sample Parameters')) 3254 Profile[5] = BackSample['Scale'][0]*G2frame.PatternTree.GetItemPyData(BackId)[1][1] 3239 3255 if G2frame.dataDisplay: 3240 3256 G2frame.dataFrame.DestroyChildren() … … 3279 3295 backVal = wx.TextCtrl(G2frame.dataDisplay,value='%.3g'%(data['Back'][0]),style=wx.TE_PROCESS_ENTER) 3280 3296 Indx[backVal.GetId()] = ['Back',0,'%.3g'] 3281 backVal.Bind(wx.EVT_TEXT_ENTER,On ValueChange)3282 backVal.Bind(wx.EVT_KILL_FOCUS,On ValueChange)3297 backVal.Bind(wx.EVT_TEXT_ENTER,OnBackChange) 3298 backVal.Bind(wx.EVT_KILL_FOCUS,OnBackChange) 3283 3299 backSizer.Add(backVal,0,WACV) 3284 3300 backVar = wx.CheckBox(G2frame.dataDisplay,label='Refine?') … … 3286 3302 backVar.SetValue(data['Back'][1]) 3287 3303 backVar.Bind(wx.EVT_CHECKBOX, OnCheckBox) 3288 backSizer.Add(backVar,0,WACV) 3304 backSizer.Add(backVar,0,WACV) 3305 backSizer.Add(wx.StaticText(G2frame.dataDisplay,-1,' Background file: '),0,WACV) 3306 Choices = ['',]+G2gd.GetPatternTreeDataNames(G2frame,['SASD',]) 3307 backFile = wx.ComboBox(parent=G2frame.dataDisplay,value=data['BackFile'],choices=Choices, 3308 style=wx.CB_READONLY|wx.CB_DROPDOWN) 3309 backFile.Bind(wx.EVT_COMBOBOX,OnBackFile) 3310 backSizer.Add(backFile) 3289 3311 mainSizer.Add(backSizer) 3290 3312 -
trunk/imports/G2sad_xye.py
r1299 r1300 106 106 np.zeros(N), # calc. intensities (zero) 107 107 np.zeros(N), # obs-calc profiles 108 np.zeros(N), # fix bkg 108 109 ] 109 110 self.smallangleentry[0] = filename … … 203 204 np.zeros(N), # calc. intensities (zero) 204 205 np.zeros(N), # obs-calc profiles 206 np.zeros(N), # fix bkg 205 207 ] 206 208 self.smallangleentry[0] = filename … … 302 304 np.zeros(N), # calc. intensities (zero) 303 305 np.zeros(N), # obs-calc profiles 306 np.zeros(N), # fix bkg 304 307 ] 305 308 self.smallangleentry[0] = filename … … 399 402 np.zeros(N), # calc. intensities (zero) 400 403 np.zeros(N), # obs-calc profiles 404 np.zeros(N), # fix bkg 401 405 ] 402 406 self.smallangleentry[0] = filename
Note: See TracChangeset
for help on using the changeset viewer.