- Timestamp:
- Sep 7, 2020 3:11:02 PM (3 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIdataGUI.py
r4554 r4564 6207 6207 # Phase / Map peaks tab 6208 6208 G2G.Define_wxId('wxID_PEAKSMOVE', 'wxID_PEAKSCLEAR','wxID_PEAKSUNIQUE', 'wxID_PEAKSDELETE','wxID_PEAKSSAVE','wxID_PEAKSDA', 6209 'wxID_PEAKSDISTVP', 'wxID_PEAKSVIEWPT', 'wxID_FINDEQVPEAKS', 'wxID_SHOWBONDS','wxID_INVERTPEAKS', )6209 'wxID_PEAKSDISTVP', 'wxID_PEAKSVIEWPT', 'wxID_FINDEQVPEAKS', 'wxID_SHOWBONDS','wxID_INVERTPEAKS','wxID_ROLLMAP') 6210 6210 self.MapPeaksMenu = wx.MenuBar() 6211 6211 self.PrefillDataMenu(self.MapPeaksMenu) … … 6220 6220 self.MapPeaksEdit.Append(G2G.wxID_FINDEQVPEAKS,'Equivalent peaks','Find equivalent peaks') 6221 6221 self.MapPeaksEdit.Append(G2G.wxID_INVERTPEAKS,'Invert peak positions','Inverts map & peak positions') 6222 self.MapPeaksEdit.Append(G2G.wxID_ROLLMAP,'Roll map','Roll map by specified steps') 6222 6223 self.MapPeaksEdit.Append(G2G.wxID_PEAKSUNIQUE,'Unique peaks','Select unique set') 6223 6224 self.MapPeaksEdit.Append(G2G.wxID_PEAKSSAVE,'Save peaks','Save peaks to csv file') -
trunk/GSASIIphsGUI.py
r4563 r4564 11946 11946 G2plt.PlotStructure(G2frame,data) 11947 11947 11948 def OnRollMap(event): 11949 if 'Map Peaks' in data: 11950 if mapData['Flip'] != True: 11951 print('Only valid for charge flip maps') 11952 return 11953 mapPeaks = data['Map Peaks'] 11954 generalData = data['General'] 11955 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 11956 mapData = generalData['Map'] 11957 dims = mapData['rho'].shape 11958 dims = [[-D,D] for D in dims] 11959 dlg = G2G.MultiDataDialog(G2frame,title='Roll map by steps', 11960 prompts=['X steps (%d to %d)'%(dims[0][0],dims[0][1]), 11961 'Y steps (%d to %d)'%(dims[1][0],dims[1][1]), 11962 'Z steps (%d to %d)'%(dims[2][0],dims[2][1])],values=[0,0,0,], 11963 limits=dims,formats=['%6d','%6d','%6d']) 11964 if dlg.ShowModal() == wx.ID_OK: 11965 rollsteps = dlg.GetValues() 11966 rollsteps = [int(R) for R in rollsteps] 11967 mapData['rho'] = np.roll(np.roll(np.roll(mapData['rho'],rollsteps[0],axis=0),rollsteps[1],axis=1),rollsteps[2],axis=2) 11968 steps = 1./np.array(dims) 11969 dxy = rollsteps*steps.T[1] 11970 for peak in mapPeaks: 11971 peak[1:4] += dxy 11972 peak[1:4] %= 1. 11973 peak[4] = np.sqrt(np.sum(np.inner(Amat,peak[1:4])**2)) 11974 FillMapPeaksGrid() 11975 G2plt.PlotStructure(G2frame,data) 11976 dlg.Destroy() 11977 11948 11978 def OnPeaksEquiv(event): 11949 11979 if 'Map Peaks' in data: … … 12503 12533 G2frame.Bind(wx.EVT_MENU, OnPeaksEquiv, id=G2G.wxID_FINDEQVPEAKS) 12504 12534 G2frame.Bind(wx.EVT_MENU, OnPeaksInvert, id=G2G.wxID_INVERTPEAKS) 12535 G2frame.Bind(wx.EVT_MENU, OnRollMap, id=G2G.wxID_ROLLMAP) 12505 12536 G2frame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2G.wxID_PEAKSUNIQUE) 12506 12537 G2frame.Bind(wx.EVT_MENU, OnPeaksSave, id=G2G.wxID_PEAKSSAVE)
Note: See TracChangeset
for help on using the changeset viewer.