- Timestamp:
- Jul 9, 2016 10:45:12 AM (9 years ago)
- Location:
- trunk
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/GSASIIddataGUI.py ¶
r2154 r2367 101 101 102 102 plotSizer = wx.BoxSizer(wx.VERTICAL) 103 choice = ['None','Mustrain','Size','Preferred orientation' ]103 choice = ['None','Mustrain','Size','Preferred orientation','Inv. pole figure'] 104 104 plotSel = wx.RadioBox(DData,wx.ID_ANY,'Select plot type:',choices=choice, 105 105 majorDimension=1,style=wx.RA_SPECIFY_COLS) … … 115 115 poAxis.Bind(wx.EVT_KILL_FOCUS,OnPOhkl) 116 116 POhklSizer.Add(poAxis,0,WACV) 117 plotSizer.Add(POhklSizer) 117 plotSizer.Add(POhklSizer) 118 elif generalData['Data plot type'] == 'Inv. pole figure': 119 pass #might need something here? 118 120 return plotSizer 119 121 -
TabularUnified trunk/GSASIIlattice.py ¶
r2233 r2367 371 371 return A,B 372 372 373 374 373 def cell2AB(cell): 375 374 """Computes orthogonalization matrix from unit cell constants … … 392 391 B = nl.inv(A) 393 392 return A,B 393 394 def HKL2SpAng(H,cell,SGData): 395 """Computes spherical coords for hkls; view along 001 396 397 :param array H: arrays of hkl 398 :param tuple cell: a,b,c, alpha, beta, gamma (degrees) 399 :param dict SGData: space group dictionary 400 :returns: arrays of r,phi,psi (radius,inclination,azimuth) about 001 401 """ 402 A,B = cell2AB(cell) 403 xH = np.inner(B,H) 404 r = np.sqrt(np.sum(xH**2,axis=0)) 405 phi = acosd(xH[2]/r) 406 psi = atan2d(xH[1],xH[0]) 407 phi = np.where(phi>90.,180.-phi,phi) 408 # GSASIIpath.IPyBreak() 409 return r,phi,psi 394 410 395 411 def U6toUij(U6): -
TabularUnified trunk/GSASIIplot.py ¶
r2366 r2367 3012 3012 ''' 3013 3013 3014 PatternId = G2frame.PatternId3014 import scipy.interpolate as si 3015 3015 generalData = data['General'] 3016 3016 SGData = generalData['SGData'] … … 3019 3019 ptx.pyqlmninit() 3020 3020 Start = False 3021 # MuStrKeys = G2spc.MustrainNames(SGData)3022 3021 cell = generalData['Cell'][1:] 3023 3022 A,B = G2lat.cell2AB(cell[:6]) … … 3026 3025 phase = generalData['Name'] 3027 3026 plotType = generalData['Data plot type'] 3028 plotDict = {'Mustrain':'Mustrain','Size':'Size','Preferred orientation':'Pref.Ori.' }3027 plotDict = {'Mustrain':'Mustrain','Size':'Size','Preferred orientation':'Pref.Ori.','Inv. pole figure':''} 3029 3028 for ptype in plotDict: 3030 3029 G2frame.G2plotNB.Delete(ptype) … … 3060 3059 Z = np.outer(np.ones(np.size(PHI)),npcosd(PSI)) 3061 3060 try: #temp patch instead of 'mustrain' for old files with 'microstrain' 3062 coeff = useList[hist][plotDict[plotType]] 3061 if plotDict[plotType]: 3062 coeff = useList[hist][plotDict[plotType]] 3063 3063 except KeyError: 3064 3064 return … … 3143 3143 Plot.set_ylabel(r'Y, $\mu$strain') 3144 3144 Plot.set_zlabel(r'Z, $\mu$strain') 3145 el se:3145 elif plotType in ['Preferred orientation',]: 3146 3146 h,k,l = generalData['POhkl'] 3147 3147 if coeff[0] == 'MD': … … 3163 3163 Plot.set_xlabel(r'$\psi$',fontsize=16) 3164 3164 Plot.set_ylabel('MRD',fontsize=14) 3165 elif plotType in ['Inv. pole figure',]: 3166 Id = G2gd.GetPatternTreeItemId(G2frame,G2frame.root,hist) 3167 rId = G2gd.GetPatternTreeItemId(G2frame,Id,'Reflection Lists') 3168 RefData = G2frame.PatternTree.GetItemPyData(rId)[phase] 3169 Type = RefData['Type'] 3170 Refs = RefData['RefList'].T 3171 ns = 0 3172 if RefData['Super']: 3173 ns = 1 3174 if 'C' in Type: 3175 obsRMD = Refs[12+ns] 3176 else: 3177 obsRMD = Refs[15+ns] 3178 ObsIVP = [] 3179 Phi = [] 3180 Beta = [] 3181 Rmd = [] 3182 refSets = [G2spc.GenHKLf(hkl,SGData)[2] for hkl in Refs[:3].T] 3183 refSets = [[np.fromstring(item.strip('[]').replace('-0','0'),sep=' ') \ 3184 for item in list(set([str(ref) for ref in refSet]))] for refSet in refSets] 3185 for ir,refSet in enumerate(refSets): 3186 refSet = [np.where(ref[2]<0,-1*ref,ref) for ref in refSet] 3187 refSets[ir] = refSet 3188 r,beta,phi = G2lat.HKL2SpAng(refSet,cell[:6],SGData) #radius, inclination, azimuth 3189 # beta,phi = G2lat.CrsAng(np.array(refSet),cell[:6],SGData) 3190 phi *= np.pi/180. 3191 beta *= np.pi/180. 3192 Phi += list(phi) 3193 Beta += list(beta) 3194 Rmd += len(phi)*[obsRMD[ir],] 3195 Beta = np.abs(np.array(Beta)) 3196 Phi = np.array(Phi) 3197 Phi=np.where(Phi<0.,Phi+2.*np.pi,Phi) 3198 Rmd = np.array(Rmd) 3199 Rmd = np.where(Rmd<0.,0.,Rmd) 3200 y,x = np.sin(Beta)*np.cos(Phi),np.sin(Beta)*np.sin(Phi) 3201 sq2 = 1.0/math.sqrt(2.0) 3202 npts = 201 3203 X,Y = np.meshgrid(np.linspace(1.,-1.,npts),np.linspace(-1.,1.,npts)) 3204 R,P = np.sqrt(X**2+Y**2).flatten(),npatan2d(X,Y).flatten() 3205 P=np.where(P<0.,P+360.,P) 3206 R = np.where(R <= 1.,2.*npatand(R),0.0) 3207 Z = np.zeros_like(R) 3208 # GSASIIpath.IPyBreak() 3209 try: 3210 lut = si.SmoothSphereBivariateSpline(Beta,Phi,Rmd,s=len(Beta)) 3211 Z = [lut(r*np.pi/180.,p*np.pi/180.) for r,p in zip(list(R),list(P))] 3212 except AttributeError: 3213 print 'scipy needs to be 0.11.0 or newer' 3214 return 3215 Z = np.reshape(Z,(npts,npts)) 3216 try: 3217 CS = Plot.contour(Y,X,Z,aspect='equal') 3218 Plot.clabel(CS,fontsize=9,inline=1) 3219 except ValueError: 3220 pass 3221 Img = Plot.imshow(Z.T,aspect='equal',cmap=G2frame.ContourColor,extent=[-1,1,-1,1]) 3222 Plot.plot(x,y,'+') 3223 Page.figure.colorbar(Img) 3224 Plot.axis('off') 3225 Plot.set_title('0 0 1 Inverse pole figure for %s'%(phase)) 3226 Plot.set_xlabel(G2frame.Projection.capitalize()+' projection') 3227 3165 3228 Page.canvas.draw() 3166 3229 -
TabularUnified trunk/GSASIIspc.py ¶
r2289 r2367 1153 1153 else: 1154 1154 return zip(XYZEquiv,Idup,Cell) 1155 1156 def GenHKL(HKL,SGData): 1157 ''' Generates all equivlent reflections including Friedel pairs 1158 :param HKL: [h,k,l] must be integral values 1159 :param SGData: space group data obtained from SpcGroup 1160 :returns: array Uniq: equivalent reflections 1161 ''' 1162 1163 Ops = SGData['SGOps'] 1164 OpM = np.array([op[0] for op in Ops]) 1165 Uniq = np.inner(OpM,HKL) 1166 Uniq = list(Uniq)+list(-1*Uniq) 1167 return np.array(Uniq) 1155 1168 1156 1169 def GenHKLf(HKL,SGData):
Note: See TracChangeset
for help on using the changeset viewer.