Changeset 4564


Ignore:
Timestamp:
Sep 7, 2020 3:11:02 PM (15 months ago)
Author:
vondreele
Message:

add Roll Map capability to Map Peaks menu - only for charge flip maps

Location:
trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIdataGUI.py

    r4554 r4564  
    62076207        # Phase / Map peaks tab
    62086208        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')
    62106210        self.MapPeaksMenu = wx.MenuBar()
    62116211        self.PrefillDataMenu(self.MapPeaksMenu)
     
    62206220        self.MapPeaksEdit.Append(G2G.wxID_FINDEQVPEAKS,'Equivalent peaks','Find equivalent peaks')
    62216221        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')
    62226223        self.MapPeaksEdit.Append(G2G.wxID_PEAKSUNIQUE,'Unique peaks','Select unique set')
    62236224        self.MapPeaksEdit.Append(G2G.wxID_PEAKSSAVE,'Save peaks','Save peaks to csv file')
  • trunk/GSASIIphsGUI.py

    r4563 r4564  
    1194611946        G2plt.PlotStructure(G2frame,data)
    1194711947       
     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       
    1194811978    def OnPeaksEquiv(event):
    1194911979        if 'Map Peaks' in data:
     
    1250312533        G2frame.Bind(wx.EVT_MENU, OnPeaksEquiv, id=G2G.wxID_FINDEQVPEAKS)
    1250412534        G2frame.Bind(wx.EVT_MENU, OnPeaksInvert, id=G2G.wxID_INVERTPEAKS)
     12535        G2frame.Bind(wx.EVT_MENU, OnRollMap, id=G2G.wxID_ROLLMAP)
    1250512536        G2frame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2G.wxID_PEAKSUNIQUE)
    1250612537        G2frame.Bind(wx.EVT_MENU, OnPeaksSave, id=G2G.wxID_PEAKSSAVE)
Note: See TracChangeset for help on using the changeset viewer.