Changeset 55
- Timestamp:
- Apr 29, 2010 12:27:45 PM (13 years ago)
- Location:
- trunk
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASII.py
r53 r55 936 936 def OnExportPattern(self,event): 937 937 dlg = wx.FileDialog(self, 'Choose output powder file name', '.', '', 938 'xye file (*.xye)|*.xye',wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) 938 'GSAS fxye file (*.fxye)|*.fxye|xye file (*.xye)|*.xye', 939 wx.FD_SAVE|wx.FD_OVERWRITE_PROMPT) 939 940 if self.dirname: 940 941 dlg.SetDirectory(self.dirname) 941 942 try: 942 943 if dlg.ShowModal() == wx.ID_OK: 943 self.powderfile = dlg.GetPath() 944 G2IO.PowderxyeSave(self) 944 powderfile = dlg.GetPath() 945 if 'fxye' in powderfile: 946 G2IO.powderFxyeSave(self,powderfile) 947 else: #just xye 948 G2IO.powderXyeSave(self,powderfile) 945 949 self.dirname = dlg.GetDirectory() 946 950 finally: -
trunk/GSASIIIO.py
r53 r55 620 620 wx.EndBusyCursor() 621 621 print 'project save successful' 622 623 def PowderxyeSave(self):624 file = open( self.powderfile,'wa')625 print 'save powder pattern to file: ', self.powderfile622 623 def powderFxyeSave(self,powderfile): 624 file = open(powderfile,'w') 625 print 'save powder pattern to file: ',powderfile 626 626 wx.BeginBusyCursor() 627 627 try: 628 628 x,y,w,yc,yb,yd = self.PatternTree.GetItemPyData(self.PickId)[1] 629 for i,X in enumerate(x): 630 file.write("%15.6g %15.6g %15.6g\n" % (X,y[i],1.0/math.sqrt(w[i]))) 629 x = x*100. 630 XYW = zip(x,y,w) 631 for X,Y,W in XYW: 632 file.write("%15.6g %15.6g %15.6g\n" % (X,Y,W)) 633 file.close() 634 finally: 635 wx.EndBusyCursor() 636 print 'powder pattern file written' 637 638 def powderXyeSave(self,powderfile): 639 file = open(powderfile,'w') 640 print 'save powder pattern to file: ',powderfile 641 wx.BeginBusyCursor() 642 try: 643 x,y,w,yc,yb,yd = self.PatternTree.GetItemPyData(self.PickId)[1] 644 XYW = zip(x,y,w) 645 for X,Y,W in XYW: 646 file.write("%15.6g %15.6g %15.6g\n" % (X,Y,W)) 631 647 file.close() 632 648 finally: -
trunk/GSASIIcomp.py
r54 r55 1341 1341 sphi = sind(phi) 1342 1342 ring = [] 1343 for a in range( 0,360,2):1343 for a in range(-180,180,2): 1344 1344 x = radii[0]*cosd(a) 1345 1345 y = radii[1]*sind(a) … … 1436 1436 return xy 1437 1437 1438 def GetTth DspAzm(x,y,data):1438 def GetTthAzmDsp(x,y,data): 1439 1439 wave = data['wavelength'] 1440 1440 dist = data['distance'] … … 1453 1453 1454 1454 def GetTth(x,y,data): 1455 return GetTth DspAzm(x,y,data)[0]1455 return GetTthAzmDsp(x,y,data)[0] 1456 1456 1457 1457 def GetTthAzm(x,y,data): 1458 return GetTth DspAzm(x,y,data)[0:2]1458 return GetTthAzmDsp(x,y,data)[0:2] 1459 1459 1460 1460 def GetDsp(x,y,data): 1461 return GetTth DspAzm(x,y,data)[2]1461 return GetTthAzmDsp(x,y,data)[2] 1462 1462 1463 1463 def ImageCompress(image,scale): … … 1662 1662 self.TA = GetTthAzm(tay,tax,data) #2-theta & azimuth arrays 1663 1663 self.TA = np.reshape(self.TA,(2,imageN,imageN)) 1664 self.TA = np.dstack((self.TA[1],self.TA[0] ,self.ImageZ)) #azimuth, 2-theta, intensity order1664 self.TA = np.dstack((self.TA[1],self.TA[0])) #azimuth, 2-theta 1665 1665 t2 = time.time() 1666 1666 print "Elapsed time:","%8.3f"%(t2-t1), "s" … … 1668 1668 print 'Form 1-D histograms for ',numAzms,' azimuthal angles' 1669 1669 print 'Integration limits:',LUtth,LRazm 1670 tax,tay ,taz = np.dsplit(self.TA,3) #azimuth, 2-theta, intensity1670 tax,tay = np.dsplit(self.TA,2) #azimuth, 2-theta, intensity 1671 1671 NST = np.histogram2d(tax.flatten(),tay.flatten(),normed=False, \ 1672 1672 bins=(numAzms,numChans),range=[LRazm,LUtth]) 1673 1673 HST = np.histogram2d(tax.flatten(),tay.flatten(),normed=False, \ 1674 bins=(numAzms,numChans),weights= taz.flatten(),range=[LRazm,LUtth])1674 bins=(numAzms,numChans),weights=self.ImageZ.flatten(),range=[LRazm,LUtth]) 1675 1675 t3 = time.time() 1676 1676 print "Elapsed time:","%8.3f"%(t3-t2), "s" -
trunk/GSASIIgrid.py
r53 r55 1136 1136 imax = int(maxSel.GetValue()) 1137 1137 delt = data['range'][0][1]-data['range'][0][0] 1138 data['range'][1][1] = int((imax/100.)*delt)+data['range'][0][0]1138 data['range'][1][1] = max(data['range'][1][0]+1,int((imax/100.)*delt)+data['range'][0][0]) 1139 1139 G2plt.PlotExposedImage(self) 1140 1140 … … 1142 1142 imin = int(minSel.GetValue()) 1143 1143 delt = data['range'][1][1]-data['range'][0][0] 1144 data['range'][1][0] = int((imin/100.)*delt)+data['range'][0][0]1144 data['range'][1][0] = min(data['range'][1][1]-1,int((imin/100.)*delt)+data['range'][0][0]) 1145 1145 G2plt.PlotExposedImage(self) 1146 1146 -
trunk/GSASIIplot.py
r54 r55 550 550 if (0 <= xpix <= size) and (0 <= ypix <= size): 551 551 Page.canvas.SetToolTipString('%6d'%(self.ImageZ[ypix][xpix])) 552 tth,azm,dsp = G2cmp.GetTth DspAzm(xpos,ypos,Data)552 tth,azm,dsp = G2cmp.GetTthAzmDsp(xpos,ypos,Data) 553 553 Q = 2.*math.pi/dsp 554 554 self.G2plotNB.status.SetFields(\ … … 609 609 rings.remove(ring) 610 610 else: 611 tth,azm,dsp = G2cmp.GetTth DspAzm(xpos,ypos,Data)611 tth,azm,dsp = G2cmp.GetTthAzmDsp(xpos,ypos,Data) 612 612 if 'Line2D' in str(self.itemPicked): 613 613 if 'line1' in str(self.itemPicked): … … 738 738 if azm and tth: 739 739 self.G2plotNB.status.SetFields(\ 740 ['Detector 2-th =%9. 2fdeg, azm = %7.2fdeg'%(tth,azm),])740 ['Detector 2-th =%9.3fdeg, azm = %7.2fdeg'%(tth,azm),]) 741 741 742 742 def OnPick(event): … … 809 809 Plot.set_xlabel('azimuth',fontsize=12) 810 810 Plot.set_ylabel('2-theta',fontsize=12) 811 Plot.contour(self.TA[:,:,0],self.TA[:,:,1], self.TA[:,:,2],V,cmap=acolor)811 Plot.contour(self.TA[:,:,0],self.TA[:,:,1],image,V,cmap=acolor) 812 812 if Data['showLines']: 813 813 IOtth = Data['IOtth'] … … 826 826 x,y = G2cmp.GetTthAzm(xring,yring,Data) 827 827 Plot.plot(y,x,'r+') 828 for ellipse in Data['ellipses']:829 ring = np.array(G2cmp.makeIdealRing(ellipse[:3])) #skip color830 x,y = np.hsplit(ring,2)831 tth,azm = G2cmp.GetTthAzm(x,y,Data)832 Plot.plot(azm,tth,'b')828 for ellipse in Data['ellipses']: 829 ring = np.array(G2cmp.makeIdealRing(ellipse[:3])) #skip color 830 x,y = np.hsplit(ring,2) 831 tth,azm = G2cmp.GetTthAzm(x,y,Data) 832 Plot.plot(azm,tth,'b,') 833 833 if not newPlot: 834 834 Page.toolbar.push_current() … … 859 859 if azm and tth: 860 860 self.G2plotNB.status.SetFields(\ 861 ['Detector 2-th =%9. 2fdeg, azm = %7.2fdeg'%(tth,azm),])861 ['Detector 2-th =%9.3fdeg, azm = %7.2fdeg'%(tth,azm),]) 862 862 863 863 try: … … 889 889 Plot.set_xlabel('2-theta',fontsize=12) 890 890 Plot.imshow(image,cmap=acolor,vmin=Imin,vmax=Imax,interpolation='nearest', \ 891 extent=[ysc[0],ysc[-1],xsc[ 0],xsc[-1]],aspect='auto')891 extent=[ysc[0],ysc[-1],xsc[-1],xsc[0]],aspect='auto') 892 892 if Data['setRings']: 893 893 rings = np.concatenate((Data['rings']),axis=0) … … 895 895 x,y = G2cmp.GetTthAzm(xring,yring,Data) 896 896 Plot.plot(x,y,'r+') 897 for ellipse in Data['ellipses']:898 ring = np.array(G2cmp.makeIdealRing(ellipse[:3])) #skip color899 x,y = np.hsplit(ring,2)900 tth,azm = G2cmp.GetTthAzm(x,y,Data)901 Plot.plot(tth,azm,'b')897 for ellipse in Data['ellipses']: 898 ring = np.array(G2cmp.makeIdealRing(ellipse[:3])) #skip color 899 x,y = np.hsplit(ring,2) 900 tth,azm = G2cmp.GetTthAzm(x,y,Data) 901 Plot.plot(tth,azm,'b,') 902 902 if not newPlot: 903 903 Page.toolbar.push_current()
Note: See TracChangeset
for help on using the changeset viewer.