Changeset 1947 for trunk/GSASIIphsGUI.py
- Timestamp:
- Jul 24, 2015 2:55:09 PM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.