Changeset 2634
- Timestamp:
- Jan 16, 2017 4:41:14 PM (6 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r2629 r2634 160 160 kind=wx.ITEM_NORMAL,text='&New project') 161 161 self.Bind(wx.EVT_MENU, self.OnFileClose, id=item.GetId()) 162 item = parent.Append( #not a good idea - reads all images as each is expanded! 163 help='Expand all items in GSAS-II data tree',id=wx.ID_ANY, 164 kind=wx.ITEM_NORMAL,text='Expand all') 165 self.Bind(wx.EVT_MENU,self.ExpandAll,id=item.GetId()) 162 166 item = parent.Append(wx.ID_PREFERENCES, text = "&Preferences") 163 167 self.Bind(wx.EVT_MENU, self.OnPreferences, item) … … 3317 3321 finally: 3318 3322 dlg.Destroy() 3323 3324 def ExpandAll(self,event): 3325 self.PatternTree.ExpandAll() 3319 3326 3320 3327 def ExitMain(self, event): -
trunk/GSASIIctrls.py
r2631 r2634 234 234 idata = self.GetItemPyData(TreeId) 235 235 if type(idata[1]) is tuple or type(idata[1]) is list: 236 idata[1] = list(idata[1]) 236 237 idata[1][0] = [imagefile,idata[1][1]] 237 238 else: -
trunk/GSASIIplot.py
r2618 r2634 2348 2348 or multiple plots with waterfall and contour plots as options 2349 2349 ''' 2350 import matplotlib.collections as mplC 2350 2351 if not plotType: 2351 2352 plotType = G2frame.G2plotNB.plotList[G2frame.G2plotNB.nb.GetSelection()] … … 2395 2396 newPlot = True 2396 2397 elif event.key == 's': 2397 if G2frame.Contour: 2398 choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")] 2399 choice.sort() 2400 dlg = wx.SingleChoiceDialog(G2frame,'Select','Color scheme',choice) 2401 if dlg.ShowModal() == wx.ID_OK: 2402 sel = dlg.GetSelection() 2403 G2frame.ContourColor = choice[sel] 2404 else: 2405 G2frame.ContourColor = 'Paired' 2406 dlg.Destroy() 2398 choice = [m for m in mpl.cm.datad.keys() if not m.endswith("_r")] 2399 choice.sort() 2400 dlg = wx.SingleChoiceDialog(G2frame,'Select','Color scheme',choice) 2401 if dlg.ShowModal() == wx.ID_OK: 2402 sel = dlg.GetSelection() 2403 G2frame.ContourColor = choice[sel] 2407 2404 else: 2408 G2frame.SinglePlot = not G2frame.SinglePlot 2405 G2frame.ContourColor = 'Paired' 2406 dlg.Destroy() 2409 2407 elif event.key == 'i': #for smoothing contour plot 2410 2408 choice = ['nearest','bilinear','bicubic','spline16','spline36','hanning', … … 2454 2452 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up', 2455 2453 'o: reset offset','t: toggle legend','c: contour on', 2456 'm: toggle multiplot','s: toggle single plot','f: select data' )2454 'm: toggle multiplot','s: color scheme','f: select data' ) 2457 2455 Page.keyPress = OnPlotKeyPress 2458 2456 PatternId = G2frame.PatternId 2459 if plotType == 'G(R)':2460 Plot.set_xlabel(r'r,$\AA$',fontsize=14)2461 Plot.set_ylabel(r'G(r), $\AA^{-2}$',fontsize=14)2462 Plot.set_title('G(r)')2463 else:2464 Plot.set_xlabel(r'$Q,\AA^{-1}$'+superMinusOne,fontsize=14)2465 Plot.set_ylabel(r''+plotType,fontsize=14)2466 Plot.set_title(plotType)2467 colors=['b','g','r','c','m','k']2468 2457 name = G2frame.PatternTree.GetItemText(PatternId)[4:] 2469 2458 Pattern = [] … … 2490 2479 Pattern.append(item) 2491 2480 PlotList.append(Pattern) 2481 name = plotType 2482 if plotType == 'G(R)': 2483 Plot.set_xlabel(r'r,$\AA$',fontsize=14) 2484 Plot.set_ylabel(r'G(r), $\AA^{-2}$',fontsize=14) 2485 Plot.set_title(name) 2486 else: 2487 Plot.set_xlabel(r'$Q,\AA^{-1}$',fontsize=14) 2488 Plot.set_ylabel(r''+plotType,fontsize=14) 2489 Plot.set_title(name) 2490 colors=['b','g','r','c','m','k'] 2492 2491 PDFdata = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'PDF Controls')) 2493 2492 numbDen = G2pwd.GetNumDensity(PDFdata['ElList'],PDFdata['Form Vol']) … … 2504 2503 ContourY = [] 2505 2504 Nseq = 0 2505 else: 2506 XYlist = [] 2506 2507 for N,Pattern in enumerate(PlotList): 2507 2508 xye = Pattern[1] … … 2520 2521 X = xye[0]+Page.Offset[0]*.005*N 2521 2522 Y = xye[1]+Page.Offset[1]*.01*N 2522 if G2frame.Legend: 2523 Plot.plot(X,Y,colors[N%6],picker=False,label='Azm:'+Pattern[2].split('=')[1]) 2524 else: 2525 Plot.plot(X,Y,colors[N%6],picker=False) 2526 if plotType == 'G(R)': 2527 Xb = [0.,2.5] 2528 Yb = [0.,-10.*np.pi*numbDen] 2529 Plot.plot(Xb,Yb,color='k',dashes=(5,5)) 2530 elif plotType == 'F(Q)': 2531 Plot.axhline(0.,color=wx.BLACK) 2532 elif plotType == 'S(Q)': 2533 Plot.axhline(1.,color=wx.BLACK) 2523 XYlist.append(list(zip(X,Y))) 2524 # if G2frame.Legend: 2525 # Plot.plot(X,Y,colors[N%6],picker=False,label='Azm:'+Pattern[2].split('=')[1]) 2526 # else: 2527 # Plot.plot(X,Y,colors[N%6],picker=False) 2534 2528 if G2frame.Contour and len(Pattern)>1: 2535 2529 acolor = mpl.cm.get_cmap(G2frame.ContourColor) … … 2537 2531 extent=[ContourX[0],ContourX[-1],ContourY[0],ContourY[-1]],aspect='auto',origin='lower') 2538 2532 Page.figure.colorbar(Img) 2539 elif G2frame.Legend: 2540 Plot.legend(loc='best') 2533 else: 2534 XYlist = np.array(XYlist) 2535 Xmin = np.amin(XYlist.T[0]) 2536 Xmax = np.amax(XYlist.T[0]) 2537 dx = 0.02*(Xmax-Xmin) 2538 Ymin = np.amin(XYlist.T[1]) 2539 Ymax = np.amax(XYlist.T[1]) 2540 dy = 0.02*(Ymax-Ymin) 2541 Plot.set_xlim(Xmin-dx,Xmax+dx) 2542 Plot.set_ylim(Ymin-dy,Ymax+dy) 2543 acolor = mpl.cm.get_cmap(G2frame.ContourColor) 2544 if XYlist.shape[0]>1: 2545 lines = mplC.LineCollection(XYlist,cmap=acolor) 2546 else: 2547 lines = mplC.LineCollection(XYlist,color=colors[0]) 2548 lines.set_array(np.arange(XYlist.shape[0])) 2549 Plot.add_collection(lines) 2550 if plotType == 'G(R)': 2551 Xb = [0.,2.5] 2552 Yb = [0.,-10.*np.pi*numbDen] 2553 Plot.plot(Xb,Yb,color='k',dashes=(5,5)) 2554 elif plotType == 'F(Q)': 2555 Plot.axhline(0.,color=wx.BLACK) 2556 elif plotType == 'S(Q)': 2557 Plot.axhline(1.,color=wx.BLACK) 2558 if XYlist.shape[0] > 1: 2559 axcb = Page.figure.colorbar(lines) 2560 axcb.set_label('Run number') 2561 2562 # elif G2frame.Legend: 2563 # Plot.legend(loc='best') 2541 2564 if not newPlot: 2542 2565 Page.toolbar.push_current() -
trunk/GSASIIpwdGUI.py
r2622 r2634 4875 4875 data['Ruland'] = R/10. 4876 4876 G2pwd.CalcPDF(data,inst,limits,xydata) 4877 g = xydata['GofR'][1][1]4878 r = xydata['GofR'][1][0]4879 g0 = g[r < Data['Rmin']] + 4*np.pi*r[r < Data['Rmin']]*numbDen4880 G2plt.PlotXY(G2frame,[[r[r < Data['Rmin']], g0]],Title='G(r)+4pi*r',4881 labelX=r'r, $\AA$',labelY=r'G(r)$+4\pi r$')4877 # g = xydata['GofR'][1][1] 4878 # r = xydata['GofR'][1][0] 4879 # g0 = g[r < Data['Rmin']] + 4*np.pi*r[r < Data['Rmin']]*numbDen 4880 # G2plt.PlotXY(G2frame,[[r[r < Data['Rmin']], g0]],Title='G(r)+4pi*r', 4881 # labelX=r'r, $\AA$',labelY=r'G(r)$+4\pi r$') 4882 4882 EvalLowPDF(GetCurrentVals()) 4883 4883 BkgMax = max(xydata['IofQ'][1][1])/50.
Note: See TracChangeset
for help on using the changeset viewer.