Changeset 738
- Timestamp:
- Aug 26, 2012 12:54:17 PM (11 years ago)
- Location:
- trunk
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIImath.py
r736 r738 938 938 rho[rMM[0]:rMP[0],rMM[1]:rMP[1],rMM[2]:rMP[2]] = peakFunc(x1,rX,rY,rZ,rhoPeak,res,SGData['SGLaue']) 939 939 rho = np.roll(np.roll(np.roll(rho,-rMI[2],axis=2),-rMI[1],axis=1),-rMI[0],axis=0) 940 if SGData['SGInv']: #check origin location & fix it if needed - centrosymmetric only941 Ocheck = np.zeros_like(rho)942 for ipeak in peaks:943 for opeak in peaks:944 dx = ((opeak-ipeak)*incre)%incre945 if np.any(dx): #avoid self vector946 Ocheck[dx[0],dx[1],dx[2]] += 1947 dxMax = np.unravel_index(np.argmax(Ocheck),rho.shape)948 print 'Inversion at:',dxMax,' shift by ;',dxMax-mapHalf,' map size:',rho.shape949 rho = np.roll(np.roll(np.roll(rho,dxMax[2],axis=2),dxMax[1],axis=1),dxMax[0],axis=0)950 for peak in peaks:951 peak = (peak-(dxMax+mapHalf)/incre)%1.0940 # if SGData['SGInv']: #check origin location & fix it if needed - centrosymmetric only 941 # Ocheck = np.zeros_like(rho) 942 # for ipeak in peaks: 943 # for opeak in peaks: 944 # dx = ((opeak-ipeak)*incre)%incre 945 # if np.any(dx): #avoid self vector 946 # Ocheck[dx[0],dx[1],dx[2]] += 1 947 # dxMax = np.unravel_index(np.argmax(Ocheck),rho.shape) 948 # print 'Inversion at:',dxMax,' shift by ;',dxMax-mapHalf,' map size:',rho.shape 949 # rho = np.roll(np.roll(np.roll(rho,dxMax[2],axis=2),dxMax[1],axis=1),dxMax[0],axis=0) 950 # for peak in peaks: 951 # peak = (peak-(dxMax+mapHalf)/incre)%1.0 952 952 953 953 return np.array(peaks),np.array([mags,]).T,np.array([dzeros,]).T -
trunk/GSASIIphsGUI.py
r736 r738 2075 2075 SGData = generalData['SGData'] 2076 2076 cellArray = G2lat.CellBlock(1) 2077 for ind in indx: 2078 atomA = atomData[ind] 2079 xyzA = np.array(atomA[cx:cx+3]) 2080 indA = atomTypes.index(atomA[ct]) 2081 for atomB in atomData[:numAtoms]: 2082 indB = atomTypes.index(atomB[ct]) 2083 sumR = radii[indA]+radii[indB] 2084 xyzB = np.array(atomB[cx:cx+3]) 2085 for xyz in cellArray+xyzB: 2086 dist = np.sqrt(np.sum(np.inner(Amat,xyz-xyzA)**2)) 2087 if 0 < dist <= data['Drawing']['radiusFactor']*sumR: 2088 if noDuplicate(xyz,atomData): 2089 oprB = atomB[cx+3] 2090 C = xyz-xyzB 2091 newOp = '1+'+str(int(round(C[0])))+','+str(int(round(C[1])))+','+str(int(round(C[2]))) 2092 newAtom = atomB[:] 2093 newAtom[cx:cx+3] = xyz 2094 newAtom[cx+3] = G2spc.StringOpsProd(oprB,newOp,SGData) 2095 atomData.append(newAtom) 2077 wx.BeginBusyCursor() 2078 try: 2079 for ind in indx: 2080 atomA = atomData[ind] 2081 xyzA = np.array(atomA[cx:cx+3]) 2082 indA = atomTypes.index(atomA[ct]) 2083 for atomB in atomData[:numAtoms]: 2084 indB = atomTypes.index(atomB[ct]) 2085 sumR = radii[indA]+radii[indB] 2086 xyzB = np.array(atomB[cx:cx+3]) 2087 for xyz in cellArray+xyzB: 2088 dist = np.sqrt(np.sum(np.inner(Amat,xyz-xyzA)**2)) 2089 if 0 < dist <= data['Drawing']['radiusFactor']*sumR: 2090 if noDuplicate(xyz,atomData): 2091 oprB = atomB[cx+3] 2092 C = xyz-xyzB 2093 newOp = '1+'+str(int(round(C[0])))+','+str(int(round(C[1])))+','+str(int(round(C[2]))) 2094 newAtom = atomB[:] 2095 newAtom[cx:cx+3] = xyz 2096 newAtom[cx+3] = G2spc.StringOpsProd(oprB,newOp,SGData) 2097 atomData.append(newAtom) 2098 finally: 2099 wx.EndBusyCursor() 2096 2100 data['Drawing']['Atoms'] = atomData 2097 2101 UpdateDrawAtoms() … … 2110 2114 generalData = data['General'] 2111 2115 SGData = generalData['SGData'] 2112 for ind in indx: 2113 atom = atomData[ind] 2114 XYZ = np.array(atom[cx:cx+3]) 2115 if atom[cuia] == 'A': 2116 Uij = atom[cuij:cuij+6] 2117 result = G2spc.GenAtom(XYZ,SGData,False,Uij,False) 2118 for item in result: 2119 atom = copy.copy(atomData[ind]) 2120 atom[cx:cx+3] = item[0] 2121 atom[cx+3] = str(item[2])+'+' \ 2122 +str(item[3][0])+','+str(item[3][1])+','+str(item[3][2]) 2123 atom[cuij:cuij+6] = item[1] 2124 Opp = G2spc.Opposite(item[0]) 2125 for xyz in Opp: 2126 if noDuplicate(xyz,atomData): 2127 cell = np.asarray(np.rint(xyz-atom[cx:cx+3]),dtype=np.int32) 2128 cell = '1'+'+'+ \ 2129 str(cell[0])+','+str(cell[1])+','+str(cell[2]) 2130 atom[cx:cx+3] = xyz 2131 atom[cx+3] = G2spc.StringOpsProd(cell,atom[cx+3],SGData) 2132 atomData.append(atom[:]) 2133 else: 2134 result = G2spc.GenAtom(XYZ,SGData,False,Move=False) 2135 for item in result: 2136 atom = copy.copy(atomData[ind]) 2137 atom[cx:cx+3] = item[0] 2138 atom[cx+3] = str(item[1])+'+' \ 2139 +str(item[2][0])+','+str(item[2][1])+','+str(item[2][2]) 2140 Opp = G2spc.Opposite(item[0]) 2141 for xyz in Opp: 2142 if noDuplicate(xyz,atomData): 2143 cell = np.asarray(np.rint(xyz-atom[cx:cx+3]),dtype=np.int32) 2144 cell = '1'+'+'+ \ 2145 str(cell[0])+','+str(cell[1])+','+str(cell[2]) 2146 atom[cx:cx+3] = xyz 2147 atom[cx+3] = G2spc.StringOpsProd(cell,atom[cx+3],SGData) 2148 atomData.append(atom[:]) 2149 data['Drawing']['Atoms'] = atomData 2116 wx.BeginBusyCursor() 2117 try: 2118 for ind in indx: 2119 atom = atomData[ind] 2120 XYZ = np.array(atom[cx:cx+3]) 2121 if atom[cuia] == 'A': 2122 Uij = atom[cuij:cuij+6] 2123 result = G2spc.GenAtom(XYZ,SGData,False,Uij,False) 2124 for item in result: 2125 atom = copy.copy(atomData[ind]) 2126 atom[cx:cx+3] = item[0] 2127 atom[cx+3] = str(item[2])+'+' \ 2128 +str(item[3][0])+','+str(item[3][1])+','+str(item[3][2]) 2129 atom[cuij:cuij+6] = item[1] 2130 Opp = G2spc.Opposite(item[0]) 2131 for xyz in Opp: 2132 if noDuplicate(xyz,atomData): 2133 cell = np.asarray(np.rint(xyz-atom[cx:cx+3]),dtype=np.int32) 2134 cell = '1'+'+'+ \ 2135 str(cell[0])+','+str(cell[1])+','+str(cell[2]) 2136 atom[cx:cx+3] = xyz 2137 atom[cx+3] = G2spc.StringOpsProd(cell,atom[cx+3],SGData) 2138 atomData.append(atom[:]) 2139 else: 2140 result = G2spc.GenAtom(XYZ,SGData,False,Move=False) 2141 for item in result: 2142 atom = copy.copy(atomData[ind]) 2143 atom[cx:cx+3] = item[0] 2144 atom[cx+3] = str(item[1])+'+' \ 2145 +str(item[2][0])+','+str(item[2][1])+','+str(item[2][2]) 2146 Opp = G2spc.Opposite(item[0]) 2147 for xyz in Opp: 2148 if noDuplicate(xyz,atomData): 2149 cell = np.asarray(np.rint(xyz-atom[cx:cx+3]),dtype=np.int32) 2150 cell = '1'+'+'+ \ 2151 str(cell[0])+','+str(cell[1])+','+str(cell[2]) 2152 atom[cx:cx+3] = xyz 2153 atom[cx+3] = G2spc.StringOpsProd(cell,atom[cx+3],SGData) 2154 atomData.append(atom[:]) 2155 data['Drawing']['Atoms'] = atomData 2156 finally: 2157 wx.EndBusyCursor() 2150 2158 UpdateDrawAtoms() 2151 2159 drawAtoms.ClearSelection() … … 3822 3830 const = 9.e-2/(np.pi*Sample['Gonio. radius']) #shifts in microns 3823 3831 3824 for ref in Refs: 3825 pos = 2.0*asind(wave/(2.0*ref[4])) 3826 if 'Bragg' in Sample['Type']: 3827 pos -= const*(4.*Sample['Shift'][0]*cosd(pos/2.0)+ \ 3828 Sample['Transparency'][0]*sind(pos)*100.0) #trans(=1/mueff) in cm 3829 else: #Debye-Scherrer - simple but maybe not right 3830 pos -= const*(Sample['DisplaceX'][0]*cosd(pos)+Sample['DisplaceY'][0]*sind(pos)) 3831 indx = np.searchsorted(xdata[0],pos) 3832 try: 3833 FWHM = max(0.001,G2pwd.getFWHM(pos,Inst))/2. 3834 dx = xdata[0][indx+1]-xdata[0][indx] 3835 ref[6] = FWHM*xdata[1][indx]/dx 3836 Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.)) #Lorentz correction 3837 pola,dIdPola = G2pwd.Polarization(Inst['Polariz.'],xdata[0][indx],Inst['Azimuth']) 3838 ref[6] /= (Lorenz*pola*ref[3]) 3839 except IndexError: 3840 pass 3832 wx.BeginBusyCursor() 3833 try: 3834 for ref in Refs: 3835 pos = 2.0*asind(wave/(2.0*ref[4])) 3836 if 'Bragg' in Sample['Type']: 3837 pos -= const*(4.*Sample['Shift'][0]*cosd(pos/2.0)+ \ 3838 Sample['Transparency'][0]*sind(pos)*100.0) #trans(=1/mueff) in cm 3839 else: #Debye-Scherrer - simple but maybe not right 3840 pos -= const*(Sample['DisplaceX'][0]*cosd(pos)+Sample['DisplaceY'][0]*sind(pos)) 3841 indx = np.searchsorted(xdata[0],pos) 3842 try: 3843 FWHM = max(0.001,G2pwd.getFWHM(pos,Inst))/2. 3844 dx = xdata[0][indx+1]-xdata[0][indx] 3845 ref[6] = FWHM*xdata[1][indx]/dx 3846 Lorenz = 1./(2.*sind(xdata[0][indx]/2.)**2*cosd(xdata[0][indx]/2.)) #Lorentz correction 3847 pola,dIdPola = G2pwd.Polarization(Inst['Polariz.'],xdata[0][indx],Inst['Azimuth']) 3848 ref[6] /= (Lorenz*pola*ref[3]) 3849 except IndexError: 3850 pass 3851 finally: 3852 wx.EndBusyCursor() 3841 3853 FillPawleyReflectionsGrid() 3842 3854 … … 3851 3863 PatternId = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,HistoNames[0]) 3852 3864 refData = G2frame.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId,'Reflection Lists'))[PhaseName] 3853 for iref,ref in enumerate(Refs): 3854 try: 3855 ref[6] = abs(refData[iref][9]) 3856 ref[7] = 1.0 3857 except IndexError: 3858 pass 3865 wx.BeginBusyCursor() 3866 try: 3867 for iref,ref in enumerate(Refs): 3868 try: 3869 ref[6] = abs(refData[iref][9]) 3870 ref[7] = 1.0 3871 except IndexError: 3872 pass 3873 finally: 3874 wx.EndBusyCursor() 3859 3875 FillPawleyReflectionsGrid() 3860 3876 … … 3958 3974 Ind = MapPeaks.GetSelectedRows() 3959 3975 if Ind: 3960 Ind = G2mth.PeaksUnique(data,Ind) 3961 for r in range(MapPeaks.GetNumberRows()): 3962 if r in Ind: 3963 MapPeaks.SelectRow(r,addToSelected=True) 3964 else: 3965 MapPeaks.DeselectRow(r) 3976 wx.BeginBusyCursor() 3977 try: 3978 Ind = G2mth.PeaksUnique(data,Ind) 3979 for r in range(MapPeaks.GetNumberRows()): 3980 if r in Ind: 3981 MapPeaks.SelectRow(r,addToSelected=True) 3982 else: 3983 MapPeaks.DeselectRow(r) 3984 finally: 3985 wx.EndBusyCursor() 3966 3986 G2plt.PlotStructure(G2frame,data) 3967 3987 -
trunk/GSASIIpwdGUI.py
r736 r738 1036 1036 S = File.readline() 1037 1037 File.close() 1038 print newItems1039 1038 data.update(newItems) 1040 1039 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,G2frame.PatternId,'Sample Parameters'),data) … … 1595 1594 data = [controls,bravais,cells,dmin] 1596 1595 G2frame.PatternTree.SetItemPyData(G2gd.GetPatternTreeItemId(G2frame,PatternId, 'Unit Cells List'),data) 1597 UpdateUnitCellsGrid(G2frame,data)1596 # UpdateUnitCellsGrid(G2frame,data) 1598 1597 bestCell = cells[0] 1599 1598 if bestCell[0] > 10.: … … 1608 1607 G2frame.dataFrame.IndexPeaks.Enable(True) 1609 1608 G2frame.dataFrame.MakeNewPhase.Enable(True) 1610 UpdateUnitCellsGrid(G2frame,data)1609 wx.CallAfter(UpdateUnitCellsGrid,G2frame,data) 1611 1610 1612 1611 def RefreshUnitCellsGrid(event):
Note: See TracChangeset
for help on using the changeset viewer.