Changeset 271 for trunk/GSASIIplot.py
- Timestamp:
- Apr 28, 2011 1:11:32 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/GSASIIplot.py
r268 r271 21 21 import GSASIIgrid as G2gd 22 22 import GSASIIimage as G2img 23 import GSASIIpwd as G2pwd 23 24 import GSASIIIO as G2IO 24 25 import GSASIIpwdGUI as G2pdG … … 96 97 self.status = parent.CreateStatusBar() 97 98 self.status.SetFieldsCount(2) 98 self.status.SetStatusWidths([1 25,-1])99 self.status.SetStatusWidths([150,-1]) 99 100 self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED, self.OnPageChanged) 100 101 … … 201 202 Page.figure.clf() 202 203 Plot = Page.figure.gca() #get a fresh plot after clf() 203 except ValueError ,error:204 except ValueError: 204 205 Plot = self.G2plotNB.addMpl('Structure Factors').gca() 205 206 plotNum = self.G2plotNB.plotList.index('Structure Factors') … … 337 338 self.Weight = True 338 339 print 'plot weighting:',self.Weight 339 elif event.key == ' l':340 elif event.key == 'n': 340 341 if self.Contour: 341 342 pass … … 344 345 self.logPlot = False 345 346 else: 346 self.Offset = 0347 self.Offset[0] = 0 347 348 self.logPlot = True 348 349 elif event.key == 'u': … … 351 352 elif self.logPlot: 352 353 pass 353 elif self.Offset < 100.:354 self.Offset += 1.354 elif self.Offset[0] < 100.: 355 self.Offset[0] += 1. 355 356 elif event.key == 'd': 356 357 if self.Contour: … … 358 359 elif self.logPlot: 359 360 pass 360 elif self.Offset > 0.: 361 self.Offset -= 1. 361 elif self.Offset[0] > 0.: 362 self.Offset[0] -= 1. 363 elif event.key == 'l': 364 self.Offset[1] -= 1. 365 elif event.key == 'r': 366 self.Offset[1] += 1. 362 367 elif event.key == 'c': 363 368 newPlot = True … … 367 372 self.Contour = True 368 373 self.SinglePlot = False 369 self.Offset = 0374 self.Offset = [0.,0.] 370 375 elif event.key == 'q': 371 376 newPlot = True … … 499 504 Page.figure.clf() 500 505 Plot = Page.figure.gca() #get a fresh plot after clf() 501 except ValueError ,error:506 except ValueError: 502 507 newPlot = True 503 508 self.Cmax = 1.0 … … 516 521 else: 517 522 if self.logPlot: 518 Choice = (' key press',' l: log(I) off',523 Choice = (' key press','n: log(I) off','l: offset left','r: offset right', 519 524 'c: contour on','q: toggle q plot','s: toggle single plot','+: no selection') 520 525 else: 521 Choice = (' key press','d: offset down','u: offset up','l: log(I) on', 522 'c: contour on','q: toggle q plot','s: toggle single plot','+: no selection') 526 Choice = (' key press','l: offset left','r: offset right','d: offset down', 527 'u: offset up','n: log(I) on','c: contour on','q: toggle q plot', 528 's: toggle single plot','+: no selection') 523 529 cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY, 524 530 choices=Choice) … … 555 561 xye = Pattern[1] 556 562 Ymax = max(Ymax,max(xye[1])) 557 offset = self.Offset *Ymax/100.0563 offset = self.Offset[0]*Ymax/100.0 558 564 Title = 'Powder Patterns: '+os.path.split(self.GSASprojectfile)[1] 559 565 if self.logPlot: … … 600 606 Plot.set_ylabel('Data sequence',fontsize=12) 601 607 else: 602 X += self.Offset *.01*N608 X += self.Offset[1]*.005*N 603 609 if ifpicked: 604 610 Z = xye[3]+offset*N … … 685 691 if self.Contour: 686 692 self.Cmax = min(1.0,self.Cmax*1.2) 687 elif self.Offset < 100.:688 self.Offset += 1.693 elif self.Offset[0] < 100.: 694 self.Offset[0] += 1. 689 695 elif event.key == 'd': 690 696 if self.Contour: 691 697 self.Cmax = max(0.0,self.Cmax*0.8) 692 elif self.Offset > 0.: 693 self.Offset -= 1. 698 elif self.Offset[0] > 0.: 699 self.Offset[0] -= 1. 700 elif event.key == 'l': 701 self.Offset[1] -= 1. 702 elif event.key == 'r': 703 self.Offset[1] += 1. 694 704 elif event.key == 'c': 695 705 newPlot = True … … 699 709 self.Contour = True 700 710 self.SinglePlot = False 701 self.Offset = 0711 self.Offset = [0.,0.] 702 712 elif event.key == 's': 703 713 if self.Contour: … … 763 773 Page.figure.clf() 764 774 Plot = Page.figure.gca() 765 except ValueError ,error:775 except ValueError: 766 776 newPlot = True 767 777 self.Cmax = 1.0 … … 778 788 'i: interpolation method','s: color scheme','c: contour off') 779 789 else: 780 Choice = (' key press',' d: offset down','u: offset up','t: toggle legend',781 ' c: contour on','s: toggle single plot')790 Choice = (' key press','l: offset left','r: offset right','d: offset down', 791 'u: offset up','t: toggle legend','c: contour on','s: toggle single plot') 782 792 cb = wx.ComboBox(self.G2plotNB.status,style=wx.CB_DROPDOWN|wx.CB_READONLY, 783 793 choices=Choice) … … 794 804 colors=['b','g','r','c','m','k'] 795 805 name = self.PatternTree.GetItemText(PatternId)[4:] 796 G2gd.GetPatternTreeItemId(self,PatternId, 'Instrument Parameters')797 806 Pattern = [] 798 807 if self.SinglePlot: … … 816 825 PlotList.append(Pattern) 817 826 item, cookie = self.PatternTree.GetNextChild(self.root, cookie) 827 PDFdata = self.PatternTree.GetItemPyData(G2gd.GetPatternTreeItemId(self,PatternId, 'PDF Controls')) 828 numbDen = G2pwd.GetNumDensity(PDFdata['ElList'],PDFdata['Form Vol']) 829 Xb = [0.,10.] 830 Yb = [0.,-40.*np.pi*numbDen] 818 831 Ymax = 1.0 819 832 lenX = 0 … … 821 834 xye = Pattern[1] 822 835 Ymax = max(Ymax,max(xye[1])) 823 offset = self.Offset *Ymax/100.0836 offset = self.Offset[0]*Ymax/100.0 824 837 if self.Contour: 825 838 ContourZ = [] … … 842 855 Plot.set_ylabel('Data sequence',fontsize=12) 843 856 else: 844 X = xye[0]+self.Offset *.1*N857 X = xye[0]+self.Offset[1]*.005*N 845 858 if ifpicked: 846 859 Plot.plot(X,Y,colors[N%6]+'+',picker=3.,clip_on=False) … … 852 865 Plot.plot(X,Y,colors[N%6],picker=False) 853 866 if type == 'G(R)': 854 Plot. axhline(0.,color=wx.BLACK)867 Plot.plot(Xb,Yb,color='k',dashes=(5,5)) 855 868 elif type == 'F(Q)': 856 869 Plot.axhline(0.,color=wx.BLACK) … … 895 908 Page.figure.clf() 896 909 Plot = Page.figure.gca() 897 except ValueError ,error:910 except ValueError: 898 911 newPlot = True 899 912 Plot = self.G2plotNB.addMpl(type).gca() … … 948 961 Page.figure.clf() 949 962 Plot = Page.figure.gca() 950 except ValueError ,error:963 except ValueError: 951 964 Plot = self.G2plotNB.addMpl('Powder Lines').gca() 952 965 plotNum = self.G2plotNB.plotList.index('Powder Lines') … … 998 1011 Page.figure.clf() 999 1012 Plot = Page.figure.gca() 1000 except ValueError ,error:1013 except ValueError: 1001 1014 Plot = self.G2plotNB.addMpl('Peak Widths').gca() 1002 1015 plotNum = self.G2plotNB.plotList.index('Peak Widths') … … 1080 1093 Page.figure.clf() 1081 1094 Plot = mp3d.Axes3D(Page.figure) 1082 except ValueError ,error:1095 except ValueError: 1083 1096 Plot = mp3d.Axes3D(self.G2plotNB.add3D('Microstrain')) 1084 1097 plotNum = self.G2plotNB.plotList.index('Microstrain') … … 1408 1421 Plot = Page.figure.gca() #get a fresh plot after clf() 1409 1422 1410 except ValueError ,error:1423 except ValueError: 1411 1424 Plot = self.G2plotNB.addMpl('2D Powder Image').gca() 1412 1425 plotNum = self.G2plotNB.plotList.index('2D Powder Image') … … 1596 1609 Plot = Page.figure.gca() #get a fresh plot after clf() 1597 1610 1598 except ValueError ,error:1611 except ValueError: 1599 1612 Plot = self.G2plotNB.addMpl('2D Integration').gca() 1600 1613 plotNum = self.G2plotNB.plotList.index('2D Integration') … … 1661 1674 Plot = Page.figure.gca() #get a fresh plot after clf() 1662 1675 1663 except ValueError ,error:1676 except ValueError: 1664 1677 Plot = self.G2plotNB.addMpl('2D Transformed Powder Image').gca() 1665 1678 plotNum = self.G2plotNB.plotList.index('2D Transformed Powder Image') … … 1808 1821 panel[names.index('cameraSlider')].SetValue(drawingData['cameraPos']) 1809 1822 Draw() 1823 1824 def getSelection(): 1825 if self.dataDisplay: 1826 return self.dataDisplay.GetSelection() 1827 else: 1828 return 0 1810 1829 1811 1830 def SetViewPointText(VP): 1812 page = self.dataDisplay.GetSelection()1831 page = getSelection() 1813 1832 if page: 1814 1833 if self.dataDisplay.GetPageText(page) == 'Draw Options': … … 1818 1837 1819 1838 def ClearSelectedAtoms(): 1820 page = self.dataDisplay.GetSelection()1839 page = getSelection() 1821 1840 if page: 1822 1841 if self.dataDisplay.GetPageText(page) == 'Draw Atoms': … … 1826 1845 1827 1846 def SetSelectedAtoms(ind): 1828 page = self.dataDisplay.GetSelection()1847 page = getSelection() 1829 1848 if page: 1830 1849 if self.dataDisplay.GetPageText(page) == 'Draw Atoms': … … 1837 1856 1838 1857 def GetSelectedAtoms(): 1839 page = self.dataDisplay.GetSelection()1858 page = getSelection() 1840 1859 Ind = [] 1841 1860 if page: … … 2257 2276 plotNum = self.G2plotNB.plotList.index(generalData['Name']) 2258 2277 Page = self.G2plotNB.nb.GetPage(plotNum) 2259 except (ValueError,error):2278 except ValueError: 2260 2279 Plot = self.G2plotNB.addOgl(generalData['Name']) 2261 2280 plotNum = self.G2plotNB.plotList.index(generalData['Name'])
Note: See TracChangeset
for help on using the changeset viewer.