Changeset 774


Ignore:
Timestamp:
Oct 3, 2012 10:36:22 AM (9 years ago)
Author:
vondreele
Message:

Add find equivalent peaks to mappeaks

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/GSASIIgrid.py

    r765 r774  
    4141[ wxID_FOURCALC, wxID_FOURSEARCH, wxID_FOURCLEAR, wxID_PEAKSMOVE, wxID_PEAKSCLEAR,
    4242    wxID_CHARGEFLIP, wxID_PEAKSUNIQUE, wxID_PEAKSDELETE, wxID_PEAKSDA,
    43     wxID_PEAKSDISTVP, wxID_PEAKSVIEWPT,
    44 ] = [wx.NewId() for item in range(11)]
     43    wxID_PEAKSDISTVP, wxID_PEAKSVIEWPT, wxID_FINDEQVPEAKS,
     44] = [wx.NewId() for item in range(12)]
    4545
    4646[ wxID_PWDRADD, wxID_HKLFADD, wxID_DATADELETE,
     
    760760        self.MapPeaksEdit.Append(id=wxID_PEAKSDA, kind=wx.ITEM_NORMAL,text='Calc dist/ang',
    761761            help='Calculate distance or angle for selection')
     762        self.MapPeaksEdit.Append(id=wxID_FINDEQVPEAKS, kind=wx.ITEM_NORMAL,text='Equivalent peaks',
     763            help='Find equivalent peaks')
    762764        self.MapPeaksEdit.Append(id=wxID_PEAKSUNIQUE, kind=wx.ITEM_NORMAL,text='Unique peaks',
    763765            help='Select unique set')
  • trunk/GSASIImath.py

    r764 r774  
    918918        X.append(D[key])
    919919    return X
     920
     921def PeaksEquiv(data,Ind):
     922
     923    def Duplicate(xyz,peaks,Amat):
     924        if True in [np.allclose(np.inner(Amat,xyz),np.inner(Amat,peak),atol=0.5) for peak in peaks]:
     925            return True
     926        return False
     927                           
     928    generalData = data['General']
     929    cell = generalData['Cell'][1:7]
     930    Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7])
     931    A = G2lat.cell2A(cell)
     932    SGData = generalData['SGData']
     933    mapPeaks = data['Map Peaks']
     934    XYZ = np.array([xyz[1:4] for xyz in mapPeaks])
     935    Indx = {}
     936    for ind in Ind:
     937        xyz = np.array(mapPeaks[ind][1:4])
     938        xyzs = np.array([equiv[0] for equiv in G2spc.GenAtom(xyz,SGData,Move=True)])
     939        for jnd,xyz in enumerate(XYZ):       
     940            Indx[jnd] = Duplicate(xyz,xyzs,Amat)
     941    Ind = []
     942    for ind in Indx:
     943        if Indx[ind]:
     944            Ind.append(ind)
     945    return Ind
    920946               
    921947def PeaksUnique(data,Ind):
     948#    XYZE = np.array([[equiv[0] for equiv in G2spc.GenAtom(xyz[1:4],SGData,Move=True)] for xyz in mapPeaks]) #keep this!!
    922949
    923950    def noDuplicate(xyz,peaks,Amat):
  • trunk/GSASIIphsGUI.py

    r773 r774  
    41554155        FillMapPeaksGrid()
    41564156        G2plt.PlotStructure(G2frame,data)
     4157       
     4158    def OnPeaksEquiv(event):
     4159        if 'Map Peaks' in data:
     4160            mapPeaks = data['Map Peaks']
     4161            Ind = MapPeaks.GetSelectedRows()
     4162            if Ind:
     4163                wx.BeginBusyCursor()
     4164                try:
     4165                    Ind = G2mth.PeaksEquiv(data,Ind)
     4166                    for r in range(MapPeaks.GetNumberRows()):
     4167                        if r in Ind:
     4168                            MapPeaks.SelectRow(r,addToSelected=True)
     4169                        else:
     4170                            MapPeaks.DeselectRow(r)
     4171                finally:
     4172                    wx.EndBusyCursor()
     4173                G2plt.PlotStructure(G2frame,data)       
    41574174               
    41584175    def OnPeaksUnique(event):
     
    44574474            G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDistVP, id=G2gd.wxID_PEAKSDISTVP)
    44584475            G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDA, id=G2gd.wxID_PEAKSDA)
     4476            G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksEquiv, id=G2gd.wxID_FINDEQVPEAKS)
    44594477            G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2gd.wxID_PEAKSUNIQUE)
    44604478            G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDelete, id=G2gd.wxID_PEAKSDELETE)
Note: See TracChangeset for help on using the changeset viewer.