Changeset 2209
- Timestamp:
- Apr 12, 2016 3:46:54 PM (7 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIphsGUI.py
r2207 r2209 2704 2704 transArray[Yi][Xi][0] /= Psum 2705 2705 wx.CallAfter(UpdateLayerData) 2706 2707 def OnSymProb(event): 2708 if symprob.GetValue(): 2709 Nx = len(Names)-1 2710 Layers['SymTrans'] = True 2711 for Yi,Yname in enumerate(Names): 2712 for Xi,Xname in enumerate(Names): 2713 if transArray[Nx-Yi][Nx-Xi][0] != transArray[Yi][Xi][0]: 2714 Layers['SymTrans'] = False 2715 symprob.SetValue(False) 2716 wx.MessageBox('%s-%s not equal %s-%s'%(Yname,Xname,Xname,Yname), 2717 caption='Probability symmetry error',style=wx.ICON_EXCLAMATION) 2718 break 2719 else: 2720 Layers['SymTrans'] = False 2706 2721 2707 2722 transSizer = wx.BoxSizer(wx.VERTICAL) 2723 transSizer.Add(wx.StaticText(layerData,label=' Layer-Layer transition probabilities: '),0,WACV) 2708 2724 topSizer = wx.BoxSizer(wx.HORIZONTAL) 2709 topSizer.Add(wx.StaticText(layerData,label=' Layer-Layer transition probabilities: '),0,WACV)2710 2725 normprob = wx.CheckBox(layerData,label=' Normalize probabilities?') 2711 2726 normprob.Bind(wx.EVT_CHECKBOX,OnNormProb) 2712 2727 topSizer.Add(normprob,0,WACV) 2728 symprob = wx.CheckBox(layerData,label=' Symmetric probabilities?') 2729 symprob.SetValue(Layers.get('SymTrans',False)) 2730 symprob.Bind(wx.EVT_CHECKBOX,OnSymProb) 2731 topSizer.Add(symprob,0,WACV) 2713 2732 transSizer.Add(topSizer,0,WACV) 2714 2733 Names = [layer['Name'] for layer in Layers['Layers']] … … 2910 2929 mainSizer = wx.BoxSizer(wx.VERTICAL) 2911 2930 topSizer = wx.BoxSizer(wx.VERTICAL) 2912 bottomSizer = wx.BoxSizer(wx.VERTICAL) 2913 topSizer.Add(wx.StaticText(layerData,label=' Global layer description:'),0,WACV) 2931 bottomSizer = wx.BoxSizer(wx.VERTICAL) 2932 headSizer = wx.BoxSizer(wx.HORIZONTAL) 2933 headSizer.Add(wx.StaticText(layerData,label=' Global layer description: '),0,WACV) 2934 if 'Sadp' in Layers: 2935 sadpPlot = wx.CheckBox(layerData,label=' Plot selected area diffraction?') 2936 sadpPlot.Bind(wx.EVT_CHECKBOX,OnSadpPlot) 2937 headSizer.Add(sadpPlot,0,WACV) 2938 if 'seqResults' in Layers: 2939 seqPlot = wx.CheckBox(layerData,label=' Plot sequential result?') 2940 seqPlot.Bind(wx.EVT_CHECKBOX,OnSeqPlot) 2941 headSizer.Add(seqPlot,0,WACV) 2942 topSizer.Add(headSizer) 2914 2943 laueSizer = wx.BoxSizer(wx.HORIZONTAL) 2915 2944 laueSizer.Add(wx.StaticText(layerData,label=' Diffraction Laue symmetry:'),0,WACV) … … 2924 2953 toler.Bind(wx.EVT_KILL_FOCUS,OnToler) 2925 2954 laueSizer.Add(toler,0,WACV) 2926 if 'Sadp' in Layers:2927 sadpPlot = wx.CheckBox(layerData,label=' Plot selected area diffraction?')2928 sadpPlot.Bind(wx.EVT_CHECKBOX,OnSadpPlot)2929 laueSizer.Add(sadpPlot,0,WACV)2930 if 'seqResults' in Layers:2931 seqPlot = wx.CheckBox(layerData,label=' Plot sequential result?')2932 seqPlot.Bind(wx.EVT_CHECKBOX,OnSeqPlot)2933 laueSizer.Add(seqPlot,0,WACV)2934 2955 topSizer.Add(laueSizer,0,WACV) 2935 2956 topSizer.Add(wx.StaticText(layerData,label=' Reference unit cell for all layers:'),0,WACV) … … 3030 3051 XY = np.vstack((profile[0],rat)) 3031 3052 G2plt.PlotXY(G2frame,[XY,],XY2=[],labelX=r'$\mathsf{2\theta}$', 3032 labelY=' ratio',newPlot=True,Title='DIFFaX vs GSASII',lines=True)3053 labelY='difference',newPlot=True,Title='DIFFaX vs GSASII',lines=True) 3033 3054 # GSASIIpath.IPyBreak() 3034 3055 G2plt.PlotPatterns(G2frame,plotType='PWDR') … … 3051 3072 transSel = ['TransP','TransX','TransY','TransZ'] 3052 3073 ctrls = '' 3074 cell = data['Layers']['Cell'] 3053 3075 data['Layers']['seqResults'] = [] 3054 3076 data['Layers']['seqCodes'] = [] … … 3114 3136 iX = int(names[2]) 3115 3137 Trans = Layers['Transitions'][iY] 3138 Nx = len(Trans)-1 3116 3139 if not transId: #i.e. probability 3117 3140 osum = 1.-Trans[iX][0] 3118 3141 nsum = 1.-val 3119 for i in range( len(Trans)):3142 for i in range(Nx+1): 3120 3143 if i != iX: 3121 3144 Trans[i][0] *= (nsum/osum) 3122 Trans[iX][transId] = val 3123 G2pwd.CalcStackingPWDR(Layers,scale,background,limits,inst,profile) 3145 Trans[iX][0] = val 3146 if Layers.get('SymTrans',False): 3147 Layers['Transitions'][Nx-iX][Nx-iY][0] = val 3148 for i in range(Nx+1): 3149 Layers['Transitions'][Nx-iY][Nx-i][0] = Layers['Transitions'][iY][i][0] 3150 else: 3151 Trans[iX][transId] = val 3152 G2pwd.CalcStackingPWDR(Layers,scale,background,limits,inst,profile,False) 3124 3153 resultXY2.append([np.vstack((profile[0],profile[3])),][0]) 3125 3154 data['Layers']['seqResults'] = [resultXY,resultXY2] -
trunk/GSASIIplot.py
r2208 r2209 2471 2471 '''simple plot of xy data, used for diagnostic purposes 2472 2472 ''' 2473 def OnKeyPress(event): 2474 if event.key == 'u': 2475 if Page.Offset[1] < 100.: 2476 Page.Offset[1] += 1. 2477 elif event.key == 'd': 2478 if Page.Offset[1] > 0.: 2479 Page.Offset[1] -= 1. 2480 elif event.key == 'l': 2481 Page.Offset[0] -= 1. 2482 elif event.key == 'r': 2483 Page.Offset[0] += 1. 2484 elif event.key == 'o': 2485 Page.Offset = [0,0] 2486 else: 2487 # print 'no binding for key',event.key 2488 #GSASIIpath.IPyBreak() 2489 return 2490 wx.CallAfter(PlotXY,G2frame,XY,XY2,labelX,labelY,False,Title,False) 2491 2473 2492 def OnMotion(event): 2474 2493 xpos = event.xdata … … 2495 2514 plotNum = G2frame.G2plotNB.plotList.index(Title) 2496 2515 Page = G2frame.G2plotNB.nb.GetPage(plotNum) 2516 Page.canvas.mpl_connect('key_press_event', OnKeyPress) 2497 2517 Page.canvas.mpl_connect('motion_notify_event', OnMotion) 2518 Page.Offset = [0,0] 2498 2519 2499 Page.Choice = None 2520 if len(XY2) > 1: 2521 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down', 2522 'u: offset up','o: reset offset',) 2523 else: 2524 Page.Choice = None 2500 2525 G2frame.G2plotNB.RaisePageNoRefresh(Page) 2501 2526 G2frame.G2plotNB.status.DestroyChildren() … … 2510 2535 Plot.set_ylabel(r'Y',fontsize=14) 2511 2536 colors=['b','g','r','c','m','k'] 2537 Page.keyPress = OnKeyPress 2538 Xmax = 0. 2539 Ymax = 0. 2512 2540 for ixy,xy in enumerate(XY): 2513 2541 X,Y = XY[ixy] 2542 Xmax = max(Xmax,max(X)) 2543 Ymax = max(Ymax,max(Y)) 2514 2544 if lines: 2515 2545 Plot.plot(X,Y,colors[ixy%6],picker=False) … … 2519 2549 for ixy,xy in enumerate(XY2): 2520 2550 X,Y = XY2[ixy] 2521 Plot.plot(X,Y,colors[ixy%6],picker=False) 2551 dX = Page.Offset[0]*(ixy+1)*Xmax/500. 2552 dY = Page.Offset[1]*(ixy+1)*Ymax/100. 2553 Plot.plot(X+dX,Y+dY,colors[ixy%6],picker=False) 2522 2554 if not newPlot: 2523 2555 Page.toolbar.push_current() … … 6008 6040 if il: 6009 6041 TX += np.array(Trans[laySeq[il-1]][laySeq[il]][1:4]) 6042 # TX[0] %= 1. 6043 # TX[1] %= 1. 6010 6044 XYZ += TX 6011 6045 AtNames += atNames … … 6354 6388 Page.camera['backColor'] = np.array([0,0,0,0]) 6355 6389 Page.canvas.SetCurrent() 6356 Draw('main')6390 wx.CallAfter(Draw,'main')
Note: See TracChangeset
for help on using the changeset viewer.