Changeset 2895 for branch/2frame/GSASIIplot.py
- Timestamp:
- Jul 2, 2017 7:27:09 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branch/2frame/GSASIIplot.py
r2891 r2895 1181 1181 ##### PlotPatterns 1182 1182 ################################################################################ 1183 def SequentialPlotPattern(G2frame,refdata,histogram): 1184 '''This is passed into :func:`GSASIIstrMain.SeqRefine` where it is used to 1185 provide a plot of the current powder histogram just after a refinement. It 1186 takes the old refinement information (Rfactors, curve locations, etc.) and 1187 combines it with the refinement results in refdata and passes that to 1188 :func:`PlotPatterns` 1189 ''' 1190 if not histogram.startswith('PWDR'): return 1191 pickId = G2frame.PickId 1192 G2frame.PickId = G2frame.PatternId = G2gd.GetPatternTreeItemId(G2frame, G2frame.root, histogram) 1193 treedata = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1194 PlotPatterns(G2frame,newPlot=True,plotType='PWDR',data=[treedata[0],refdata]) 1195 wx.Yield() # force a plot update (needed on Windows?) 1196 G2frame.PickId = pickId 1197 1183 1198 def ReplotPattern(G2frame,newPlot,plotType,PatternName=None,PickName=None): 1184 1199 '''This does the same as PlotPatterns except that it expects the information … … 1196 1211 PlotPatterns(G2frame,newPlot,plotType) 1197 1212 1198 def PlotPatterns(G2frame,newPlot=False,plotType='PWDR' ):1213 def PlotPatterns(G2frame,newPlot=False,plotType='PWDR',data=None): 1199 1214 '''Powder pattern plotting package - displays single or multiple powder patterns as intensity vs 1200 1215 2-theta, q or TOF. Can display multiple patterns as "waterfall plots" or contour plots. Log I … … 1220 1235 return 1221 1236 #patch 1222 data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1237 if data is None: 1238 data = G2frame.PatternTree.GetItemPyData(G2frame.PatternId) 1223 1239 if 'Offset' not in data[0] and plotType in ['PWDR','SASD','REFD']: #plot offset data 1224 1240 Ymax = max(data[1][1]) … … 1824 1840 Page.canvas.mpl_connect('button_press_event',OnPress) 1825 1841 if 'PWDR' in G2frame.PatternTree.GetItemText(G2frame.PickId): 1842 Histograms,Phases = G2frame.GetUsedHistogramsAndPhasesfromTree() 1843 refColors=['b','r','c','g','m','k'] 1844 Page.phaseColors = {p:refColors[i%len(refColors)] for i,p in enumerate(Phases)} 1826 1845 Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Reflection Lists')) 1827 1846 Page.phaseList = sorted(Phases.keys()) # define an order for phases (once!) … … 2215 2234 elif G2frame.PatternTree.GetItemText(PickId) in ['Reflection Lists'] or \ 2216 2235 'PWDR' in G2frame.PatternTree.GetItemText(PickId): 2217 refColors=['b','r','c','g','m','k']2218 2236 Phases = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists')) 2219 2237 l = GSASIIpath.GetConfigValue('Tick_length',8.0) … … 2230 2248 peak = np.array([[peak[4],peak[5]] for peak in peaks]) 2231 2249 pos = Pattern[0]['refOffset']-pId*Pattern[0]['refDelt']*np.ones_like(peak) 2250 plsym = Page.phaseColors.get(phase,'y')+'|' # yellow should never happen! 2232 2251 if G2frame.plotStyle['qPlot']: 2233 Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2252 Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2234 2253 elif G2frame.plotStyle['dPlot']: 2235 Page.tickDict[phase],j = Plot.plot(peak.T[0],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2254 Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2236 2255 else: 2237 Page.tickDict[phase],j = Plot.plot(peak.T[1],pos, refColors[pId%6]+'|',mew=w,ms=l,picker=3.,label=phase)2256 Page.tickDict[phase],j = Plot.plot(peak.T[1],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2238 2257 if len(Phases): 2239 2258 handles,legends = Plot.get_legend_handles_labels() #got double entries in the legends for some reason
Note: See TracChangeset
for help on using the changeset viewer.