Changeset 1947
- Timestamp:
- Jul 24, 2015 2:55:09 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIlattice.py
r1945 r1947 1129 1129 import pytexture as ptx 1130 1130 if SGLaue in ['m3','m3m']: 1131 if ' float' in str(type(phi)):1131 if 'array' in str(type(phi)) and np.any(phi.shape): 1132 1132 Kcl = np.zeros_like(phi) 1133 1133 else: … … 1135 1135 for j in range(0,L+1,4): 1136 1136 im = j/4 1137 if ' float' in str(type(phi)):1137 if 'array' in str(type(phi)) and np.any(phi.shape): 1138 1138 pcrs = ptx.pyplmpsi(L,j,len(phi),phi)[0] 1139 1139 else: 1140 pcrs ,dum = ptx.pyplmpsi(L,j,1,phi)1141 Kcl += BOH['L= '+str(L)][N-1][im]*pcrs*cosd(j*beta)1140 pcrs = ptx.pyplmpsi(L,j,1,phi)[0] 1141 Kcl += BOH['L=%d'%(L)][N-1][im]*pcrs*cosd(j*beta) 1142 1142 else: 1143 if ' float' in str(type(phi)):1143 if 'array' in str(type(phi)) and np.any(phi.shape): 1144 1144 pcrs = ptx.pyplmpsi(L,N,len(phi),phi)[0] 1145 1145 else: 1146 pcrs ,dum = ptx.pyplmpsi(L,N,1,phi)1146 pcrs = ptx.pyplmpsi(L,N,1,phi)[0] 1147 1147 pcrs *= RSQ2PI 1148 1148 if N: … … 1163 1163 'needs doc string' 1164 1164 import pytexture as ptx 1165 if 'float' in str(type(psi)): 1165 if 'array' in str(type(psi)) and np.any(psi.shape): 1166 psrs,dpdps = ptx.pyplmpsi(L,M,len(psi),psi) 1167 else: 1166 1168 psrs,dpdps = ptx.pyplmpsi(L,M,1,psi) 1167 else:1168 psrs,dpdps = ptx.pyplmpsi(L,M,len(psi),psi)1169 1169 psrs *= RSQ2PI 1170 1170 dpdps *= RSQ2PI … … 1195 1195 Kcl = 0.0 1196 1196 for j in range(0,L+1,4): 1197 im = j/4 +11197 im = j/4 1198 1198 pcrs,dum = ptx.pyplmpsi(L,j,1,phi) 1199 Kcl += BOH['L= '+str(L)][N-1][im-1]*pcrs*cosd(j*beta)1199 Kcl += BOH['L=%d'%(L)][N-1][im]*pcrs*cosd(j*beta) 1200 1200 else: 1201 1201 pcrs,dum = ptx.pyplmpsi(L,N,1,phi) … … 1250 1250 Kcl = 0.0 1251 1251 for j in range(0,l+1,4): 1252 im = j/4 +11252 im = j/4 1253 1253 pcrs,dum = ptx.pyplmpsi(l,j,1,phi) 1254 Kcl += BOH['L='+str(l)][n-1][im -1]*pcrs*cosd(j*beta)1254 Kcl += BOH['L='+str(l)][n-1][im]*pcrs*cosd(j*beta) 1255 1255 else: #all but cubic 1256 1256 pcrs,dum = ptx.pyplmpsi(l,n,1,phi) … … 1307 1307 Kcl = 0.0 1308 1308 for j in range(0,l+1,4): 1309 im = j/4 +11309 im = j/4 1310 1310 pcrs,dum = ptx.pyplmpsi(l,j,len(beta),phi) 1311 Kcl += BOH['L= '+str(l)][n-1][im-1]*pcrs*cosd(j*beta)1311 Kcl += BOH['L=%d'%(l)][n-1][im]*pcrs*cosd(j*beta) 1312 1312 else: #all but cubic 1313 1313 pcrs,dum = ptx.pyplmpsi(l,n,len(beta),phi) -
trunk/GSASIIphsGUI.py
r1945 r1947 66 66 asind = lambda x: 180.*np.arcsin(x)/np.pi 67 67 acosd = lambda x: 180.*np.arccos(x)/np.pi 68 atan2d = lambda x,y: 180.*np.arctan2(y,x)/np.pi 68 69 69 70 def SetPhaseWindow(mainFrame,phasePage,mainSizer): … … 3789 3790 print ' popLA %d %d %d pole figure saved to %s'%(PH[0],PH[1],PH[2],pfFile) 3790 3791 3792 def OnCSV(event): 3793 pfName = PhaseName 3794 pfFile = '' 3795 cell = generalData['Cell'][1:7] 3796 if 'Inverse' in textureData['PlotType']: 3797 SHCoef = textureData['SH Coeff'][1] 3798 PX = np.array(textureData['PFxyz']) 3799 gam = atan2d(PX[0],PX[1]) 3800 xy = np.sqrt(PX[0]**2+PX[1]**2) 3801 xyz = np.sqrt(PX[0]**2+PX[1]**2+PX[2]**2) 3802 psi = asind(xy/xyz) 3803 IODFln = G2lat.Glnh(True,SHCoef,psi,gam,SamSym[textureData['Model']]) 3804 pfName = PhaseName+'%d%d%dIPF.csv'%(int(PX[0]),int(PX[1]),int(PX[2])) 3805 dlg = wx.FileDialog(G2frame, 'Choose CSV inverse pole figure file name', '.', pfName, 3806 'CSV file (*.csv)|*.csv',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT|wx.CHANGE_DIR) 3807 else: 3808 PH = np.array(textureData['PFhkl']) 3809 phi,beta = G2lat.CrsAng(PH,cell,SGData) 3810 SHCoef = textureData['SH Coeff'][1] 3811 ODFln = G2lat.Flnh(True,SHCoef,phi,beta,SGData) 3812 pfName = PhaseName+'%d%d%dPF.csv'%(PH[0],PH[1],PH[2]) 3813 dlg = wx.FileDialog(G2frame, 'Choose CSV pole figure file name', '.', pfName, 3814 'CSV file (*.csv)|*.csv',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT|wx.CHANGE_DIR) 3815 try: 3816 if dlg.ShowModal() == wx.ID_OK: 3817 pfFile = dlg.GetPath() 3818 print 'CSV save '+pfFile 3819 finally: 3820 dlg.Destroy() 3821 if pfFile: 3822 pf = open(pfFile,'w') 3823 pf.write('"%s"\n'%(PhaseName)) 3824 if 'Inverse' in textureData['PlotType']: 3825 pf.write('" %s %d %d %d inverse pole figure"\n'%(PhaseName,int(PX[0]),int(PX[1]),int(PX[2]))) 3826 P,R = np.mgrid[0:19,0:72] 3827 pf.write('"phi/beta",') 3828 np.savetxt(pf,np.linspace(0.,90.,19,True),fmt='%10.4f,',newline='') 3829 pf.write('\n') 3830 P = P.flatten()*5. 3831 R = R.flatten()*5. 3832 Z = G2lat.invpolfcal(IODFln,SGData,P,R) 3833 Z = np.reshape(Z,(19,72)).T 3834 for i,row in enumerate(Z): 3835 pf.write('%8d, '%(i*5)) 3836 np.savetxt(pf,row,fmt='%10.4f,',newline='') 3837 pf.write('\n') 3838 pf.close() 3839 print ' %s %d %d %d inverse pole figure saved to %s'%(PhaseName,int(PX[0]),int(PX[1]),int(PX[2]),pfFile) 3840 else: 3841 pf.write('" %s %d %d %d pole figure"\n'%(PhaseName,PH[0],PH[1],PH[2])) 3842 Psi,Gam = np.mgrid[0:19,0:72] 3843 pf.write('"psi/gam",') 3844 np.savetxt(pf,np.linspace(0.,90.,19,True),fmt='%10.4f,',newline='') 3845 pf.write('\n') 3846 Psi = Psi.flatten()*5. 3847 Gam = Gam.flatten()*5. 3848 Z = np.array(G2lat.polfcal(ODFln,SamSym[textureData['Model']],Psi,Gam)) 3849 Z = np.reshape(Z,(19,72)).T 3850 for i,row in enumerate(Z): 3851 pf.write('%8d, '%(i*5)) 3852 np.savetxt(pf,row,fmt='%10.4f,',newline='') 3853 pf.write('\n') 3854 pf.close() 3855 print ' %s %d %d %d pole figure saved to %s'%(PhaseName,PH[0],PH[1],PH[2],pfFile) 3856 3791 3857 def SHPenalty(Penalty): 3792 3858 … … 3918 3984 colorSel.Bind(wx.EVT_COMBOBOX,OnColorSel) 3919 3985 PTSizer.Add(colorSel,0,WACV) 3920 if ' Inverse' notin textureData['PlotType']:3921 popLA = wx.Button(Texture,-1,"Make popLAfile")3922 popLA.Bind(wx.EVT_BUTTON, On popLA)3986 if 'figure' in textureData['PlotType']: 3987 popLA = wx.Button(Texture,-1,"Make CSV file") 3988 popLA.Bind(wx.EVT_BUTTON, OnCSV) 3923 3989 PTSizer.Add(popLA,0,WACV) 3924 3990 mainSizer.Add(PTSizer,0,WACV)
Note: See TracChangeset
for help on using the changeset viewer.