 Timestamp:
 Aug 21, 2020 10:17:41 AM (2 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIImath.py
r4547 r4553 3903 3903 return Ind 3904 3904 3905 def PeaksUnique(data,Ind ):3905 def PeaksUnique(data,Ind,Sel): 3906 3906 '''Finds the symmetry unique set of peaks from those selected. Selects 3907 3907 the one closest to the center of the unit cell. … … 3911 3911 :param data: the phase data structure 3912 3912 :param list Ind: list of selected peak indices 3913 :param int Sel: selected column to find peaks closest to 3913 3914 3914 3915 :returns: the list of symmetry unique peaks from among those given in Ind … … 3924 3925 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 3925 3926 SGData = generalData['SGData'] 3926 mapPeaks = data['Map Peaks'] 3927 3928 3929 Indx = {} 3930 XYZ = {} 3931 for ind in Ind: 3932 XYZ[ind] = np.array(mapPeaks[ind][1:4]) 3933 Indx[ind] = True 3927 mapPeaks = data['Map Peaks'] 3928 XYZ = {ind:np.array(mapPeaks[ind][1:4]) for ind in Ind} 3929 Indx = [True for ind in Ind] 3930 Unique = [] 3931 # scan through peaks, finding all peaks equivalent to peak ind 3934 3932 for ind in Ind: 3935 3933 if Indx[ind]: 3936 3934 xyz = XYZ[ind] 3935 dups = [] 3937 3936 for jnd in Ind: 3938 if ind != jnd and Indx[jnd]: 3937 # only consider peaks we have not looked at before 3938 # and were not already found to be equivalent 3939 if jnd > ind and Indx[jnd]: 3939 3940 Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 3940 3941 xyzs = np.array([equiv[0] for equiv in Equiv]) 3941 Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 3942 Ind = [] 3943 for ind in Indx: 3944 if Indx[ind]: 3945 Ind.append(ind) 3946 return Ind 3947 3948 3949 3950 3951 3952 3953 # XYZ = {ind:np.array(mapPeaks[ind][1:4]) for ind in Ind} 3954 # Indx = [True for ind in Ind] 3955 # Unique = [] 3956 # # scan through peaks, finding all peaks equivalent to peak ind 3957 # for ind in Ind: 3958 # if Indx[ind]: 3959 # xyz = XYZ[ind] 3960 # dups = [] 3961 # for jnd in Ind: 3962 # # only consider peaks we have not looked at before 3963 # # and were not already found to be equivalent 3964 # if jnd > ind and Indx[jnd]: 3965 # Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 3966 # xyzs = np.array([equiv[0] for equiv in Equiv]) 3967 # if not noDuplicate(xyz,xyzs,Amat): 3968 # Indx[jnd] = False 3969 # dups.append(jnd) 3970 # Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 3971 # # # select the unique peak closest to cell center 3972 # # cntr = mapPeaks[ind][1] 3973 # # icntr = ind 3974 # # for jnd in dups: 3975 # # if mapPeaks[jnd][1] < cntr: 3976 # # cntr = mapPeaks[jnd][1] 3977 # # icntr = jnd 3978 # # Unique.append(icntr) 3979 # # return Unique 3980 # Ind = [] 3981 # for ind in Indx: 3982 # if Indx[ind]: 3983 # Ind.append(ind) 3984 # return Ind 3942 if not noDuplicate(xyz,xyzs,Amat): 3943 Indx[jnd] = False 3944 dups.append(jnd) 3945 # select the unique peak closest to cell center 3946 cntr = mapPeaks[ind][Sel] 3947 icntr = ind 3948 for jnd in dups: 3949 if mapPeaks[jnd][Sel] < cntr: 3950 cntr = mapPeaks[jnd][Sel] 3951 icntr = jnd 3952 Unique.append(icntr) 3953 return Unique 3954 3985 3955 ################################################################################ 3986 3956 ##### Dysnomia setup & return stuff 
trunk/GSASIIphsGUI.py
r4551 r4553 11967 11967 Ind = getAtomSelections(MapPeaks) 11968 11968 if Ind: 11969 choice = ['x=0','y=0','z=0','origin','center'] 11970 dlg = wx.SingleChoiceDialog(G2frame,'Peaks closest to:','Select',choice) 11971 if dlg.ShowModal() == wx.ID_OK: 11972 sel = dlg.GetSelection()+1 11973 dlg.Destroy() 11974 else: 11975 dlg.Destroy() 11976 return 11969 11977 wx.BeginBusyCursor() 11970 11978 try: 11971 Ind = G2mth.PeaksUnique(data,Ind )11979 Ind = G2mth.PeaksUnique(data,Ind,sel) 11972 11980 print (' No. unique peaks: %d Unique peak fraction: %.3f'%(len(Ind),float(len(Ind))/len(mapPeaks))) 11973 11981 tbl = MapPeaks.GetTable().data
Note: See TracChangeset
for help on using the changeset viewer.