- Timestamp:
- Jun 7, 2016 2:30:49 PM (9 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIImath.py ¶
r2301 r2311 2788 2788 Ehkl[h,k,l] = E*phasem 2789 2789 # Ehkl[Hmax] = 0.00001 #this to preserve F[0,0,0] 2790 testHKL = np.array(flipData['testHKL'])+Hmax 2790 2791 CEhkl = copy.copy(Ehkl) 2791 2792 MEhkl = ma.array(Ehkl,mask=(Ehkl==0.0)) … … 2794 2795 Ncyc = 0 2795 2796 old = np.seterr(all='raise') 2797 twophases = [] 2796 2798 while True: 2797 2799 CErho = np.real(fft.fftn(fft.fftshift(CEhkl)))*(1.+0j) … … 2802 2804 CFhkl = np.where(CFhkl,CFhkl,1.0) #avoid divide by zero 2803 2805 phase = CFhkl/np.absolute(CFhkl) 2806 twophases.append([np.angle(phase[h,k,l]) for h,k,l in testHKL]) 2804 2807 CEhkl = np.absolute(Ehkl)*phase 2805 2808 Ncyc += 1 … … 2823 2826 mapData['minmax'] = [np.max(mapData['rho']),np.min(mapData['rho'])] 2824 2827 mapData['Type'] = reflDict['Type'] 2825 return mapData 2828 return mapData,twophases 2826 2829 2827 2830 def findSSOffset(SGData,SSGData,A,Fhklm): … … 3114 3117 incre = np.array(rho.shape,dtype=np.float) 3115 3118 step = max(1.0,1./res)+1 3116 steps = np.array( 3*[step,])3119 steps = np.array((3*[step,]),dtype='int32') 3117 3120 except KeyError: 3118 3121 print '**** ERROR - Fourier map not defined' -
TabularUnified trunk/GSASIIphsGUI.py ¶
r2285 r2311 203 203 if 'Flip' not in generalData: 204 204 generalData['Flip'] = {'RefList':'','Resolution':0.5,'Norm element':'None', 205 'k-factor':0.1,'k-Max':20.} 205 'k-factor':0.1,'k-Max':20.,} 206 if 'testHKL' not in generalData['Flip']: 207 generalData['Flip']['testHKL'] = [[0,0,2],[2,0,0],[1,1,1],[0,2,0],[1,2,3]] 206 208 if 'doPawley' not in generalData: 207 209 generalData['doPawley'] = False … … 937 939 pass 938 940 kMax.SetValue("%.1f"%(Flip['k-Max'])) #reset in case of error 941 942 def OnTestHKL(event): 943 Obj = event.GetEventObject() 944 name = Obj.GetName() 945 try: 946 vals = Obj.GetValue().split() 947 id = int(name.split('hkl')[1]) 948 HKL = [int(val) for val in vals] 949 Flip['testHKL'][id] = HKL 950 except ValueError: 951 HKL = Flip['testHKL'][id] 952 Obj.SetValue('%3d %3d %3d'%(HKL[0],HKL[1],HKL[2])) 939 953 940 954 refsList = data['Histograms'].keys() … … 971 985 line2Sizer.Add(kMax,0,WACV) 972 986 flipSizer.Add(line2Sizer,0,WACV) 987 line3Sizer = wx.BoxSizer(wx.HORIZONTAL) 988 line3Sizer.Add(wx.StaticText(General,label=' Test HKLs:'),0,WACV) 989 if len(Flip['testHKL']) < 5: 990 Flip['testHKL'] += [[1,1,1],[0,2,0],[1,2,3]] 991 HKL = Flip['testHKL'] 992 for ih,hkl in enumerate(Flip['testHKL']): 993 hkl = wx.TextCtrl(General,value='%3d %3d %3d'%(HKL[ih][0],HKL[ih][1],HKL[ih][2]), 994 style=wx.TE_PROCESS_ENTER,name='hkl%d'%(ih)) 995 hkl.Bind(wx.EVT_TEXT_ENTER,OnTestHKL) 996 hkl.Bind(wx.EVT_KILL_FOCUS,OnTestHKL) 997 line3Sizer.Add(hkl,0,WACV) 998 flipSizer.Add(line3Sizer) 973 999 return flipSizer 974 1000 … … 7201 7227 screenSize = wx.ClientDisplayRect() 7202 7228 Size = pgbar.GetSize() 7229 testNames = ['%3d%3d%3d'%(h,k,l) for h,k,l in flipData['testHKL']] 7203 7230 if 50 < Size[0] < 500: # sanity check on size, since this fails w/Win & wx3.0 7204 7231 pgbar.SetSize((int(Size[0]*1.2),Size[1])) # increase size a bit along x 7205 7232 pgbar.SetPosition(wx.Point(screenSize[2]-Size[0]-305,screenSize[1]+5)) 7206 7233 try: 7207 mapData.update(G2mth.ChargeFlip(data,ReflData,pgbar)) 7234 result = G2mth.ChargeFlip(data,ReflData,pgbar) 7235 mapData.update(result[0]) 7236 X = range(len(result[1])) 7237 Y = 180.*np.array(result[1]).T/np.pi 7238 XY = [[X,y] for y in Y] 7239 G2plt.PlotXY(G2frame,XY,labelX='charge flip cycle',labelY='phase, deg',newPlot=True, 7240 Title='Test HKL phases',lines=True,names=testNames) 7208 7241 finally: 7209 7242 pgbar.Destroy() -
TabularUnified trunk/GSASIIplot.py ¶
r2310 r2311 2430 2430 2431 2431 def PlotXY(G2frame,XY,XY2=None,labelX=None,labelY=None,newPlot=False, 2432 Title='',lines=False,names=[] ):2432 Title='',lines=False,names=[],names2=[]): 2433 2433 '''simple plot of xy data, used for diagnostic purposes 2434 2434 ''' … … 2480 2480 Page.Offset = [0,0] 2481 2481 2482 if len(XY2) > 1:2482 if XY2 and len(XY2) > 1: 2483 2483 Page.Choice = (' key press','l: offset left','r: offset right','d: offset down', 2484 2484 'u: offset up','o: reset offset',) … … 2505 2505 Ymax = max(Ymax,max(Y)) 2506 2506 if lines: 2507 Plot.plot(X,Y,colors[ixy%6],picker=False) 2507 if len(names): 2508 Plot.plot(X,Y,colors[ixy%6],picker=False,label=names[ixy]) 2509 else: 2510 Plot.plot(X,Y,colors[ixy%6],picker=False) 2508 2511 else: 2509 2512 Plot.plot(X,Y,colors[ixy%6]+'+',picker=False) 2510 if len(XY2):2513 if XY2 and len(XY2): 2511 2514 for ixy,xy in enumerate(XY2): 2512 2515 X,Y = XY2[ixy] 2513 2516 dX = Page.Offset[0]*(ixy+1)*Xmax/500. 2514 2517 dY = Page.Offset[1]*(ixy+1)*Ymax/100. 2515 if len(names ):2516 Plot.plot(X+dX,Y+dY,colors[ixy%6],picker=False,label=names [ixy])2518 if len(names2): 2519 Plot.plot(X+dX,Y+dY,colors[ixy%6],picker=False,label=names2[ixy]) 2517 2520 else: 2518 2521 Plot.plot(X+dX,Y+dY,colors[ixy%6],picker=False)
Note: See TracChangeset
for help on using the changeset viewer.