Changeset 3761
- Timestamp:
- Dec 12, 2018 2:38:33 PM (5 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r3757 r3761 4991 4991 # PWDR & SASD 4992 4992 G2G.Define_wxId('wxID_PWDANALYSIS','wxID_PWDCOPY','wxID_PLOTCTRLCOPY','wxID_MERGEHKL', 4993 'wxID_PWDHKLPLOT', 'wxID_PWD3DHKLPLOT','wxID_3DALLHKLPLOT', )4993 'wxID_PWDHKLPLOT', 'wxID_PWD3DHKLPLOT','wxID_3DALLHKLPLOT','wxID_1DHKLSTICKPLOT',) 4994 4994 self.PWDRMenu = wx.MenuBar() 4995 4995 self.PrefillDataMenu(self.PWDRMenu) … … 5012 5012 self.ErrorAnal.Append(G2G.wxID_PWDANALYSIS,'Error Analysis','Error analysis on single crystal data') 5013 5013 self.ErrorAnal.Append(G2G.wxID_MERGEHKL,'Merge HKLs','Transform & merge HKLF data to new histogram') 5014 self.ErrorAnal.Append(G2G.wxID_1DHKLSTICKPLOT,'Plot 1D HKLs','Plot of HKLs from single crystal data in 1D') 5014 5015 self.ErrorAnal.Append(G2G.wxID_PWD3DHKLPLOT,'Plot 3D HKLs','Plot HKLs from single crystal data in 3D') 5015 5016 self.ErrorAnal.Append(G2G.wxID_3DALLHKLPLOT,'Plot all 3D HKLs','Plot HKLs from all single crystal data in 3D') … … 5174 5175 self.ReflMenu.Append(menu=self.ReflEdit, title='Reflection List') 5175 5176 self.SelectPhase = self.ReflEdit.Append(G2G.wxID_SELECTPHASE,'Select phase','Select phase for reflection list') 5176 self.ReflEdit.Append(G2G.wxID_PWDHKLPLOT,'Plot HKLs','Plot HKLs from powder pattern') 5177 self.ReflEdit.Append(G2G.wxID_PWD3DHKLPLOT,'Plot 3D HKLs','Plot HKLs from powder pattern in 3D') 5177 self.ReflEdit.Append(G2G.wxID_1DHKLSTICKPLOT,'Plot 1D HKLs','Plot of HKLs in 1D') 5178 self.ReflEdit.Append(G2G.wxID_PWDHKLPLOT,'Plot HKLs','Plot HKLs in 2D') 5179 self.ReflEdit.Append(G2G.wxID_PWD3DHKLPLOT,'Plot 3D HKLs','Plot HKLs in 3D') 5178 5180 self.PostfillDataMenu() 5179 5181 … … 7318 7320 [(Tmin,Tmax),[Tmin,Tmax]]) 7319 7321 wx.CallAfter(UpdatePWHKPlot,G2frame,kind,item) # redisplay data screen 7322 7323 def OnPlot1DHKL(event): 7324 refList = data[1]['RefList'] 7325 G2plt.Plot1DSngl(G2frame,newPlot=True,hklRef=refList,Super=Super,Title=phaseName) 7320 7326 7321 7327 def OnPlot3DHKL(event): … … 7513 7519 G2frame.Bind(wx.EVT_MENU, OnErrorAnalysis, id=G2G.wxID_PWDANALYSIS) 7514 7520 G2frame.Bind(wx.EVT_MENU, OnMergeHKL, id=G2G.wxID_MERGEHKL) 7521 G2frame.Bind(wx.EVT_MENU, OnPlot1DHKL, id=G2G.wxID_1DHKLSTICKPLOT) 7515 7522 G2frame.Bind(wx.EVT_MENU, OnPlot3DHKL, id=G2G.wxID_PWD3DHKLPLOT) 7516 7523 G2frame.Bind(wx.EVT_MENU, OnPlotAll3DHKL, id=G2G.wxID_3DALLHKLPLOT) -
trunk/GSASIIphsGUI.py
r3759 r3761 2820 2820 2821 2821 r,c = event.GetRow(),event.GetCol() 2822 replot = True 2822 2823 if r >= 0 and c >= 0: 2823 2824 ci = colLabels.index('I/A') … … 2880 2881 ci = colLabels.index('I/A') 2881 2882 atomData[r][c] = atomData[r][c].replace(rbAtmDict.get(atomData[r][ci+8],''),'') 2883 replot = False 2882 2884 elif Atoms.GetColLabelValue(c) in ['Mx','My','Mz']: 2883 2885 value = atomData[r][c] … … 2890 2892 if iM == CSI[0][i]: 2891 2893 atomData[r][i+colLabels.index('Mx')] = value*CSI[1][i] 2892 if 'Atoms' in data['Drawing'] :2894 if 'Atoms' in data['Drawing'] and replot: 2893 2895 ci = colLabels.index('I/A') 2894 2896 DrawAtomsReplaceByID(data['Drawing'],ci+8,atomData[r],ID) -
trunk/GSASIIplot.py
r3759 r3761 24 24 :func:`PlotStructure` Crystal structure plotting with balls, sticks, lines, 25 25 ellipsoids, polyhedra and magnetic moments 26 :func:'Plot1DSngl' 1D stick plots of structure factors 26 27 :func:`PlotSngl` Structure factor plotting 27 28 :func:`Plot3DSngl` 3D Structure factor plotting … … 1068 1069 Plot.set_ylim((HKLmin[pzone[izone][1]],HKLmax[pzone[izone][1]])) 1069 1070 Page.canvas.draw() 1071 1072 ################################################################################ 1073 ##### Plot1DSngl 1074 ################################################################################ 1075 def Plot1DSngl(G2frame,newPlot=False,hklRef=None,Super=0,Title=False): 1076 '''1D Structure factor plotting package - displays reflections as sticks proportional 1077 to F, F**2, etc. as requested 1078 ''' 1079 from matplotlib.collections import LineCollection 1080 print('1D stick plot - TBD') 1081 global xylim 1082 def OnKeyPress(event): 1083 # if event.key == 'u': 1084 # if Page.Offset[1] < 100.: 1085 # Page.Offset[1] += 1. 1086 # elif event.key == 'd': 1087 # if Page.Offset[1] > 0.: 1088 # Page.Offset[1] -= 1. 1089 # elif event.key == 'l': 1090 # Page.Offset[0] -= 1. 1091 # elif event.key == 'r': 1092 # Page.Offset[0] += 1. 1093 # elif event.key == 'o': 1094 # Page.Offset = [0,0] 1095 # elif event.key == 's': 1096 # if len(XY): 1097 # G2IO.XYsave(G2frame,XY,labelX,labelY,names) 1098 # if len(XY2): 1099 # G2IO.XYsave(G2frame,XY2,labelX,labelY,names2) 1100 ## else: 1101 ## return 1102 Draw() 1103 1104 def OnMotion(event): 1105 xpos = event.xdata 1106 if xpos: #avoid out of frame mouse position 1107 ypos = event.ydata 1108 Page.canvas.SetCursor(wx.CROSS_CURSOR) 1109 try: 1110 G2frame.G2plotNB.status.SetStatusText('X =%9.3f %s =%9.3f'%(xpos,Title,ypos),1) 1111 except TypeError: 1112 G2frame.G2plotNB.status.SetStatusText('Select '+Title+' pattern first',1) 1113 1114 def Draw(): 1115 global xylim 1116 Plot.clear() 1117 Plot.set_title(Title) 1118 Plot.set_xlabel(r'd-spacing',fontsize=14) 1119 Plot.set_ylabel(r'Fsq',fontsize=14) 1120 colors=['b','r','g','c','m','k'] 1121 Page.keyPress = OnKeyPress 1122 1123 X = hklRef.T[4+Super] 1124 Y = hklRef.T[8+Super] 1125 Z = hklRef.T[9+Super] 1126 Plot.plot([X,X],[np.zeros_like(X),Y],color=colors[0]) 1127 Plot.plot([X,X],[np.zeros_like(X),Z],color=colors[1]) 1128 Plot.plot([X,X],[np.zeros_like(X),Y-Z],color=colors[2]) 1129 1130 if not newPlot: 1131 Page.toolbar.push_current() 1132 Plot.set_xlim(xylim[0]) 1133 Plot.set_ylim(xylim[1]) 1134 xylim = [] 1135 Page.toolbar.push_current() 1136 Page.toolbar.draw() 1137 Page.canvas.draw() 1138 else: 1139 Page.canvas.draw() 1140 1141 new,plotNum,Page,Plot,lim = G2frame.G2plotNB.FindPlotTab(Title,'mpl') 1142 Page.Offset = [0,0] 1143 if not new: 1144 if not newPlot: 1145 xylim = lim 1146 else: 1147 newPlot = True 1148 Page.canvas.mpl_connect('key_press_event', OnKeyPress) 1149 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 1150 Page.Offset = [0,0] 1151 1152 Page.Choice = (' key press','f: plot Fhkl','s: plot F^2hkl','d: d-spacing plot','q: q plot') 1153 Draw() 1154 1070 1155 1071 1156 ################################################################################ … … 2364 2449 Page.canvas.mpl_disconnect(b) 2365 2450 Page.bindings = [] 2366 Page.bindings.append( 2367 Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress) 2368 ) 2451 Page.bindings.append(Page.canvas.mpl_connect('key_press_event', OnPlotKeyPress)) 2369 2452 if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId): 2370 2453 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() -
trunk/GSASIIpwdGUI.py
r3753 r3761 4404 4404 if 'UsrReject' in Controls: 4405 4405 dMin = Controls['UsrReject'].get('MinD',0.05) 4406 4407 def OnPlot1DHKL(event): 4408 phaseName = G2frame.RefList 4409 if phaseName not in ['Unknown',]: 4410 pId = G2gd.GetGPXtreeItemId(G2frame,G2frame.root,'Phases') 4411 phaseId = G2gd.GetGPXtreeItemId(G2frame,pId,phaseName) 4412 General = G2frame.GPXtree.GetItemPyData(phaseId)['General'] 4413 Super = General.get('Super',0) 4414 else: 4415 Super = 0 4416 if 'list' in str(type(data)): #single crystal data is 2 dict in list 4417 refList = data[1]['RefList'] 4418 else: #powder data is a dict of dicts; each same structure as SC 2nd dict 4419 if 'RefList' in data[phaseName]: 4420 refList = np.array(data[phaseName]['RefList']) 4421 else: 4422 wx.MessageBox('No reflection list - do Refine first',caption='Reflection plotting') 4423 return 4424 G2plt.Plot1DSngl(G2frame,newPlot=True,hklRef=refList,Super=Super,Title=phaseName) 4425 4406 4426 def OnPlotHKL(event): 4407 4427 '''Plots a layer of reflections … … 4622 4642 if HKLF: 4623 4643 G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2G.wxID_PWDHKLPLOT) 4644 G2frame.Bind(wx.EVT_MENU, OnPlot1DHKL, id=G2G.wxID_1DHKLSTICKPLOT) 4624 4645 G2frame.Bind(wx.EVT_MENU, OnPlot3DHKL, id=G2G.wxID_PWD3DHKLPLOT) 4625 4646 G2frame.dataWindow.SelectPhase.Enable(False) 4626 4647 else: 4627 4648 G2frame.Bind(wx.EVT_MENU, OnSelectPhase, id=G2G.wxID_SELECTPHASE) 4649 G2frame.Bind(wx.EVT_MENU, OnPlot1DHKL, id=G2G.wxID_1DHKLSTICKPLOT) 4628 4650 G2frame.Bind(wx.EVT_MENU, OnPlotHKL, id=G2G.wxID_PWDHKLPLOT) 4629 4651 G2frame.Bind(wx.EVT_MENU, OnPlot3DHKL, id=G2G.wxID_PWD3DHKLPLOT)
Note: See TracChangeset
for help on using the changeset viewer.