Changeset 721
- Timestamp:
- Aug 19, 2012 2:13:13 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIgrid.py ¶
r715 r721 39 39 40 40 [ wxID_FOURCALC, wxID_FOURSEARCH, wxID_FOURCLEAR, wxID_PEAKSMOVE, wxID_PEAKSCLEAR, 41 wxID_CHARGEFLIP, wxID_PEAKSUNIQUE, wxID_PEAKSDELETE, 42 ] = [wx.NewId() for item in range( 8)]41 wxID_CHARGEFLIP, wxID_PEAKSUNIQUE, wxID_PEAKSDELETE, wxID_PEAKSDA, 42 ] = [wx.NewId() for item in range(9)] 43 43 44 44 [ wxID_PWDRADD, wxID_HKLFADD, wxID_DATADELETE, … … 614 614 self.MapPeaksEdit.Append(id=wxID_PEAKSMOVE, kind=wx.ITEM_NORMAL,text='Move peaks', 615 615 help='Move selected peaks to atom list') 616 self.MapPeaksEdit.Append(id=wxID_PEAKSDA, kind=wx.ITEM_NORMAL,text='Calc dist/ang', 617 help='Calculate distance or angle for selection') 616 618 self.MapPeaksEdit.Append(id=wxID_PEAKSUNIQUE, kind=wx.ITEM_NORMAL,text='Unique peaks', 617 help=' Reduce map peak list tounique set')619 help='Select unique set') 618 620 self.MapPeaksEdit.Append(id=wxID_PEAKSDELETE, kind=wx.ITEM_NORMAL,text='Delete peaks', 619 621 help='Delete selected peaks') … … 624 626 625 627 def _init_ctrls(self, parent,name=None,size=None,pos=None): 626 wx.Frame.__init__(self,parent=parent,style=wx.DEFAULT_FRAME_STYLE ^ wx.CLOSE_BOX, 628 wx.Frame.__init__(self,parent=parent, 629 style=wx.DEFAULT_FRAME_STYLE | wx.FRAME_FLOAT_ON_PARENT ^ wx.CLOSE_BOX, 627 630 size=size,pos=pos,title='GSAS-II data display') 628 631 self._init_menus() -
TabularUnified trunk/GSASIImath.py ¶
r709 r721 796 796 Rcf = 100. 797 797 break 798 del MEhkl,Emask,DEhkl,CErho,CEsig 798 799 np.seterr(**old) 799 800 print ' Charge flip time: %.4f'%(time.time()-time0),'no. elements: %d'%(Ehkl.size) 801 CErho = np.real(fft.fftn(fft.fftshift(CEhkl))) 800 802 print ' No.cycles = ',Ncyc,'Residual Rcf =%8.3f%s'%(Rcf,'%')+' Map size:',CErho.shape 801 CErho = np.real(fft.fftn(fft.fftshift(CEhkl)))802 803 roll = findOffset(SGData,CEhkl) 803 804 … … 821 822 822 823 def noDuplicate(xyz,peaks,Amat): 823 if True in [np.allclose(np.inner(Amat,xyz),np.inner(Amat,peak),atol=0.5) for peak in peaks]: 824 XYZ = np.inner(Amat,xyz) 825 if True in [np.allclose(XYZ,np.inner(Amat,peak),atol=0.5) for peak in peaks]: 824 826 print ' Peak',xyz,' <0.5A from another peak' 825 827 return False 826 828 return True 827 829 830 def fixSpecialPos(xyz,SGData,Amat): 831 equivs = G2spc.GenAtom(xyz,SGData,Move=True) 832 X = [] 833 xyzs = [equiv[0] for equiv in equivs] 834 for x in xyzs: 835 if np.sqrt(np.sum(np.inner(Amat,xyz-x)**2,axis=0))<0.5: 836 X.append(x) 837 if len(X) > 1: 838 return np.average(X,axis=0) 839 else: 840 return xyz 841 828 842 def findRoll(rhoMask,mapHalf): 829 843 indx = np.array(ma.nonzero(rhoMask)).T … … 906 920 if keepDup: 907 921 if noDuplicate(peak,peaks,Amat): 922 peak = fixSpecialPos(peak,SGData,Amat) 908 923 peaks.append(peak) 909 924 mags.append(x1[0]) … … 912 927 mags.append(x1[0]) 913 928 GoOn = Pgbar.Update(len(peaks),newmsg='%s%d'%('No. Peaks found =',len(peaks)))[0] 914 if not GoOn or len(peaks) > 300:929 if not GoOn or len(peaks) > 500: 915 930 break 916 931 rho[rMM[0]:rMP[0],rMM[1]:rMP[1],rMM[2]:rMP[2]] = peakFunc(x1,rX,rY,rZ,rhoPeak,res,SGData['SGLaue']) … … 919 934 920 935 def PeaksUnique(data,Ind): 936 937 def noDuplicate(xyz,peaks,Amat): 938 if True in [np.allclose(np.inner(Amat,xyz),np.inner(Amat,peak),atol=0.5) for peak in peaks]: 939 return False 940 return True 941 921 942 generalData = data['General'] 922 943 cell = generalData['Cell'][1:7] … … 925 946 SGData = generalData['SGData'] 926 947 mapPeaks = data['Map Peaks'] 948 Indx = {} 949 XYZ = {} 927 950 for ind in Ind: 928 XYZ = np.array(mapPeaks[ind][1:]) 929 Equiv = G2spc.GenAtom(XYZ,SGData,Move=True)[1:] #remove self 930 for equiv in Equiv: #special position fixer 931 Dx = XYZ-np.array(equiv[0]) 932 dist = np.sqrt(np.sum(np.inner(Amat,Dx)**2,axis=0)) 933 if dist < 0.5: 934 print equiv[0],Dx,dist 935 mapPeaks[ind][1:] -= Dx/2. 951 XYZ[ind] = np.array(mapPeaks[ind][1:]) 952 Indx[ind] = True 953 for ind in Ind: 954 if Indx[ind]: 955 xyz = XYZ[ind] 956 for jnd in Ind: 957 if ind != jnd and Indx[jnd]: 958 Equiv = G2spc.GenAtom(XYZ[jnd],SGData,Move=True) 959 xyzs = np.array([equiv[0] for equiv in Equiv]) 960 Indx[jnd] = noDuplicate(xyz,xyzs,Amat) 961 Ind = [] 962 for ind in Indx: 963 if Indx[ind]: 964 Ind.append(ind) 965 return Ind -
TabularUnified trunk/GSASIIphsGUI.py ¶
r719 r721 45 45 46 46 class SymOpDialog(wx.Dialog): 47 def __init__(self,parent,SGData,New=True ):47 def __init__(self,parent,SGData,New=True,ForceUnit=False): 48 48 wx.Dialog.__init__(self,parent,-1,'Select symmetry operator', 49 49 pos=wx.DefaultPosition,style=wx.DEFAULT_DIALOG_STYLE) … … 51 51 self.SGData = SGData 52 52 self.New = New 53 self.OpSelected = [0,0,0,[0,0,0],False] 53 self.Force = ForceUnit 54 self.OpSelected = [0,0,0,[0,0,0],False,False] 54 55 mainSizer = wx.BoxSizer(wx.VERTICAL) 56 if ForceUnit: 57 choice = ['No','Yes'] 58 self.force = wx.RadioBox(panel,-1,'Force to unit cell?',choices=choice) 59 self.force.Bind(wx.EVT_RADIOBOX, self.OnOpSelect) 60 mainSizer.Add(self.force,0,wx.ALIGN_CENTER_VERTICAL) 55 61 mainSizer.Add((5,5),0) 56 62 if SGData['SGInv']: … … 124 130 if self.New: 125 131 self.OpSelected[4] = self.new.GetSelection() 132 if self.Force: 133 self.OpSelected[5] = self.force.GetSelection() 126 134 127 135 def GetSelection(self): … … 1429 1437 try: 1430 1438 if dlg.ShowModal() == wx.ID_OK: 1431 Inv,Cent,Opr,Cell,New = dlg.GetSelection()1439 Inv,Cent,Opr,Cell,New,Force = dlg.GetSelection() 1432 1440 Cell = np.array(Cell) 1433 1441 cent = SGData['SGCen'][Cent] … … 1965 1973 try: 1966 1974 if dlg.ShowModal() == wx.ID_OK: 1967 Inv,Cent,Opr,Cell,New = dlg.GetSelection()1975 Inv,Cent,Opr,Cell,New,Force = dlg.GetSelection() 1968 1976 Cell = np.array(Cell) 1969 1977 cent = SGData['SGCen'][Cent] … … 2010 2018 try: 2011 2019 if dlg.ShowModal() == wx.ID_OK: 2012 Inv,Cent,Opr,Cell,New = dlg.GetSelection()2020 Inv,Cent,Opr,Cell,New,Force = dlg.GetSelection() 2013 2021 Cell = np.array(Cell) 2014 2022 cent = SGData['SGCen'][Cent] … … 3924 3932 Ind = MapPeaks.GetSelectedRows() 3925 3933 if Ind: 3926 G2mth.PeaksUnique(data,Ind) 3927 FillMapPeaksGrid() 3934 Ind = G2mth.PeaksUnique(data,Ind) 3935 for r in range(MapPeaks.GetNumberRows()): 3936 if r in Ind: 3937 MapPeaks.SelectRow(r,addToSelected=True) 3938 else: 3939 MapPeaks.DeselectRow(r) 3928 3940 G2plt.PlotStructure(G2frame,data) 3929 3941 3942 def OnPeaksDA(event): 3943 #distance, angle 3944 indx = MapPeaks.GetSelectedRows() 3945 if len(indx) not in [2,3]: 3946 print '**** ERROR - wrong number of atoms for distance or angle calculation' 3947 return 3948 generalData = data['General'] 3949 Amat,Bmat = G2lat.cell2AB(generalData['Cell'][1:7]) 3950 mapPeaks = data['Map Peaks'] 3951 xyz = [] 3952 for i in indx: 3953 xyz.append(mapPeaks[i][1:4]) 3954 if len(indx) == 2: 3955 print ' distance for atoms %s = %.3f'%(str(indx),G2mth.getRestDist(xyz,Amat)) 3956 else: 3957 print ' angle for atoms %s = %.2f'%(str(indx),G2mth.getRestAngle(xyz,Amat)) 3958 3959 3930 3960 def OnFourierMaps(event): 3931 3961 generalData = data['General'] … … 3992 4022 mapData = generalData['Map'] 3993 4023 if len(mapData['rho']): 3994 pgbar = wx.ProgressDialog('Map search','No. Peaks found =', 301.0,4024 pgbar = wx.ProgressDialog('Map search','No. Peaks found =',501.0, 3995 4025 style = wx.PD_ELAPSED_TIME|wx.PD_AUTO_HIDE|wx.PD_CAN_ABORT) 3996 4026 screenSize = wx.ClientDisplayRect() … … 4011 4041 G2frame.dataFrame.SetMenuBar(G2frame.dataFrame.MapPeaksMenu) 4012 4042 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksMove, id=G2gd.wxID_PEAKSMOVE) 4043 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDA, id=G2gd.wxID_PEAKSDA) 4013 4044 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2gd.wxID_PEAKSUNIQUE) 4014 4045 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDelete, id=G2gd.wxID_PEAKSDELETE) … … 4136 4167 G2frame.dataFrame.SetMenuBar(G2frame.dataFrame.MapPeaksMenu) 4137 4168 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksMove, id=G2gd.wxID_PEAKSMOVE) 4169 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDA, id=G2gd.wxID_PEAKSDA) 4138 4170 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksUnique, id=G2gd.wxID_PEAKSUNIQUE) 4139 4171 G2frame.dataFrame.Bind(wx.EVT_MENU, OnPeaksDelete, id=G2gd.wxID_PEAKSDELETE) -
TabularUnified trunk/GSASIIplot.py ¶
r720 r721 2336 2336 [uBox[2],uBox[3]],[uBox[1],uBox[5]],[uBox[2],uBox[6]],[uBox[3],uBox[7]], 2337 2337 [uBox[4],uBox[5]],[uBox[5],uBox[6]],[uBox[6],uBox[7]],[uBox[7],uBox[4]]]) 2338 mD = 0.1 2339 mV = np.array([[[-mD,0,0],[mD,0,0]],[[0,-mD,0],[0,mD,0]],[[0,0,-mD],[0,0,mD]]]) 2340 mapPeakVecs = np.inner(mV,Bmat) 2341 2338 2342 uColors = [Rd,Gr,Bl,Wt, Wt,Wt,Wt,Wt, Wt,Wt,Wt,Wt] 2339 2343 altDown = False … … 2409 2413 2410 2414 def OnMouseMove(event): 2415 if event.ShiftDown(): #don't want any inadvertant moves when picking 2416 return 2411 2417 newxy = event.GetPosition() 2412 2418 page = getSelection() … … 2781 2787 2782 2788 def RenderMapPeak(x,y,z,color): 2783 vecs = np.array([[[-.1/cell[0],0,0],[.1/cell[0],0,0]],2784 [[0,-.1/cell[1],0],[0,.1/cell[1],0]],2785 [[0,0,-.1/cell[2]],[0,0,.1/cell[2]]]])2786 2789 xyz = np.array([x,y,z]) 2787 2790 glEnable(GL_COLOR_MATERIAL) … … 2790 2793 glPushMatrix() 2791 2794 glBegin(GL_LINES) 2792 for vec in vecs:2795 for vec in mapPeakVecs: 2793 2796 glVertex3fv(vec[0]+xyz) 2794 2797 glVertex3fv(vec[1]+xyz)
Note: See TracChangeset
for help on using the changeset viewer.