Changeset 2646
- Timestamp:
- Jan 19, 2017 12:18:51 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASII.py ¶
r2645 r2646 2417 2417 self.Legend = False 2418 2418 self.SinglePlot = True 2419 self.Waterfall = False 2419 2420 self.selections= None 2420 2421 self.PDFselections = None -
TabularUnified trunk/GSASIIgrid.py ¶
r2645 r2646 86 86 ] = [wx.NewId() for item in range(2)] 87 87 88 [ wxID_LOADDIFFAX,wxID_LAYERSIMULATE,wxID_SEQUENCESIMULATE, wxID_ COPYPHASE,89 ] = [wx.NewId() for item in range( 4)]88 [ wxID_LOADDIFFAX,wxID_LAYERSIMULATE,wxID_SEQUENCESIMULATE, wxID_LAYERSFIT, wxID_COPYPHASE, 89 ] = [wx.NewId() for item in range(5)] 90 90 91 91 [ wxID_PAWLEYLOAD, wxID_PAWLEYESTIMATE, wxID_PAWLEYUPDATE, wxID_PAWLEYSELALL, wxID_PAWLEYSELNONE, … … 2326 2326 self.LayerDataEdit.Append(id=wxID_LAYERSIMULATE, kind=wx.ITEM_NORMAL,text='Simulate pattern', 2327 2327 help='Simulate diffraction pattern from layer stacking') 2328 self.LayerDataEdit.Append(id=wxID_LAYERSFIT, kind=wx.ITEM_NORMAL,text='Fit pattern', 2329 help='Fit diffraction pattern with layer stacking model') 2328 2330 self.LayerDataEdit.Append(id=wxID_SEQUENCESIMULATE, kind=wx.ITEM_NORMAL,text='Sequence simulations', 2329 2331 help='Sequence simulation changing one parameter') -
TabularUnified trunk/GSASIIphsGUI.py ¶
r2642 r2646 386 386 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSimulate, id=G2gd.wxID_LAYERSIMULATE) 387 387 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSeqSimulate, id=G2gd.wxID_SEQUENCESIMULATE) 388 G2frame.dataFrame.Bind(wx.EVT_MENU, OnFitLayers, id=G2gd.wxID_LAYERSFIT) 388 389 if 'Wave Data' in pages: 389 390 pass … … 2737 2738 3*[wg.GRID_VALUE_FLOAT+':10,5',]+2*[wg.GRID_VALUE_FLOAT+':10,4',] #x,y,z,frac,Uiso 2738 2739 transTypes = [wg.GRID_VALUE_FLOAT+':10,3',]+3*[wg.GRID_VALUE_FLOAT+':10,5',]+ \ 2739 [wg.GRID_VALUE_CHOICE+": ,P,Dx,Dy,Dz ",wg.GRID_VALUE_BOOL,]2740 [wg.GRID_VALUE_CHOICE+": ,P,Dx,Dy,Dz,Dxy,Dxz,Dyz,Dxyz",wg.GRID_VALUE_BOOL,] 2740 2741 plotDefaults = {'oldxy':[0.,0.],'Quaternion':[0.,0.,0.,1.],'cameraPos':30.,'viewDir':[0,0,1], 2741 2742 'viewPoint':[[0.,0.,0.],[]],} … … 3490 3491 wx.MessageBox('Simulation finished',caption='Stacking fault simulation',style=wx.ICON_EXCLAMATION) 3491 3492 wx.CallAfter(UpdateLayerData) 3493 3494 def OnFitLayers(event): 3495 print ' fit stacking fault model TBD' 3496 import scipy.optimize as opt 3497 wx.BeginBusyCursor() 3498 # Min,Init,Done = SetupPDFEval() 3499 # xstart = Init() 3500 # rms = Min(xstart) 3501 # print('Optimizing corrections to improve G(r) at low r') 3502 # print('start: Flat Bkg={:.1f}, BackRatio={:.3f}, Ruland={:.3f} (RMS:{:.2f})'.format( 3503 # data['Flat Bkg'],data['BackRatio'],data['Ruland'],rms)) 3504 # 3505 # res = opt.minimize(Min,xstart,bounds=([0,None],[0,1],[0.01,1]), 3506 # method='L-BFGS-B',options={'maxiter':5}) 3507 # Done(res['x']) 3508 # print('end: Flat Bkg={:.1f}, BackRatio={:.3f}, Ruland={:.3f} (RMS:{:.2f})\n'.format( 3509 # data['Flat Bkg'],data['BackRatio'],data['Ruland'],res['fun'])) 3510 wx.EndBusyCursor() 3511 wx.CallAfter(UpdateLayerData) 3512 G2plt.PlotPatterns(G2frame,plotType='PWDR') 3492 3513 3493 3514 def OnSeqSimulate(event): … … 7997 8018 G2frame.dataFrame.Bind(wx.EVT_MENU, OnLoadDIFFaX, id=G2gd.wxID_LOADDIFFAX) 7998 8019 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSimulate, id=G2gd.wxID_LAYERSIMULATE) 8020 G2frame.dataFrame.Bind(wx.EVT_MENU, OnFitLayers, id=G2gd.wxID_LAYERSFIT) 7999 8021 G2frame.dataFrame.Bind(wx.EVT_MENU, OnSeqSimulate, id=G2gd.wxID_SEQUENCESIMULATE) 8000 8022 # Draw Options -
TabularUnified trunk/GSASIIplot.py ¶
r2637 r2646 43 43 import OpenGL.GLU as GLU 44 44 import gltext 45 import matplotlib.colors as mpcls 45 46 from matplotlib.backends.backend_wx import _load_bitmap 46 47 from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as Canvas … … 2380 2381 G2frame.SinglePlot = False 2381 2382 Page.Offset = [0.,0.] 2383 elif not G2frame.Contour and event.key == 'w': 2384 G2frame.Waterfall = not G2frame.Waterfall 2382 2385 elif event.key == 'f' and not G2frame.SinglePlot: 2383 2386 choices = G2gd.GetPatternTreeDataNames(G2frame,'PDF ') … … 2450 2453 else: 2451 2454 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down','u: offset up', 2452 'o: reset offset','t: toggle legend','c: contour on', 2455 'o: reset offset','t: toggle legend','c: contour on','w: toggle waterfall colors (slow!)', 2453 2456 'm: toggle multiplot','s: color scheme','f: select data' ) 2454 2457 Page.keyPress = OnPlotKeyPress … … 2536 2539 Ymin = np.amin(XYlist.T[1]) 2537 2540 Ymax = np.amax(XYlist.T[1]) 2541 normcl = mpcls.Normalize(Ymin,Ymax) 2538 2542 dy = 0.02*(Ymax-Ymin) 2539 2543 Plot.set_xlim(Xmin-dx,Xmax+dx) 2540 2544 Plot.set_ylim(Ymin-dy,Ymax+dy) 2541 2545 acolor = mpl.cm.get_cmap(G2frame.ContourColor) 2542 if XYlist.shape[0]>1: 2543 colorRange = np.arange(XYlist.shape[0]) 2544 lines = mplC.LineCollection(XYlist,cmap=acolor) 2545 lines.set_array(colorRange) 2546 if XYlist.shape[0]>1: 2547 if G2frame.Waterfall: 2548 for xylist in XYlist: 2549 ymin = np.amin(xylist.T[1]) 2550 ymax = np.amax(xylist.T[1]) 2551 normcl = mpcls.Normalize(ymin,ymax) 2552 colorRange = xylist.T[1] 2553 segs = np.reshape(np.hstack((xylist[:-1],xylist[1:])),(-1,2,2)) 2554 line = mplC.LineCollection(segs,cmap=acolor,norm=normcl) 2555 line.set_array(colorRange) 2556 Plot.add_collection(line) 2557 axcb = Page.figure.colorbar(line) 2558 axcb.set_label('Intensity') 2559 else: #ok 2560 lines = mplC.LineCollection(XYlist,cmap=acolor) 2561 lines.set_array(np.arange(XYlist.shape[0])) 2562 Plot.add_collection(lines) 2563 axcb = Page.figure.colorbar(lines) 2564 axcb.set_label('PDF number') 2546 2565 else: 2547 lines = mplC.LineCollection(XYlist,color=colors[0]) 2548 Plot.add_collection(lines) 2566 if G2frame.Waterfall: 2567 colorRange = XYlist[0].T[1] 2568 segs = np.reshape(np.hstack((XYlist[0][:-1],XYlist[0][1:])),(-1,2,2)) 2569 line = mplC.LineCollection(segs,cmap=acolor,norm=normcl) 2570 line.set_array(colorRange) 2571 Plot.add_collection(line) 2572 axcb = Page.figure.colorbar(line) 2573 axcb.set_label('Intensity') 2574 else: #ok 2575 line = mplC.LineCollection(XYlist,color=colors[0]) 2576 Plot.add_collection(line) 2549 2577 if plotType == 'G(R)': 2550 2578 Xb = [0.,2.5] … … 2555 2583 elif plotType == 'S(Q)': 2556 2584 Plot.axhline(1.,color=wx.BLACK) 2557 if XYlist.shape[0] > 1:2558 axcb = Page.figure.colorbar(lines)2559 axcb.set_label('PDF number')2560 2585 2561 2586 # elif G2frame.Legend:
Note: See TracChangeset
for help on using the changeset viewer.