Changeset 3364
 Timestamp:
 Apr 28, 2018 10:57:55 AM (5 years ago)
 Location:
 trunk
 Files:

 2 edited
Legend:
 Unmodified
 Added
 Removed

trunk/GSASIIdataGUI.py
r3363 r3364 2668 2668 self.undofile = '' 2669 2669 self.TreeItemDelete = False 2670 self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False}2671 2670 self.Weight = False 2672 2671 self.IfPlot = False 
trunk/GSASIIplot.py
r3362 r3364 391 391 self.toolbar = GSASIItoolbar(self.canvas,publish=publish) 392 392 self.toolbar.Realize() 393 self.plotStyle = {'qPlot':False,'dPlot':False,'sqrtPlot':False,'sqPlot':False,'logPlot':False} 394 self.logPlot = False 395 self.sqrtPlot = False 393 396 394 397 sizer=wx.BoxSizer(wx.VERTICAL) … … 1593 1596 G2frame.HKL (used for tool tip display of hkl for selected phase reflection list) 1594 1597 ''' 1595 global exclLines 1598 global exclLines,Page 1596 1599 global DifLine # BHT: probably does not need to be global 1597 1600 global Ymax … … 1620 1623 return 1621 1624 newPlot = False 1622 if event.key == 'w' and not G2frame.plotStyle['qPlot'] and not G2frame.plotStyle['dPlot']: #can't do weight plots when xaxis is different1625 if event.key == 'w' and not Page.plotStyle['qPlot'] and not Page.plotStyle['dPlot']: #can't do weight plots when xaxis is different 1623 1626 G2frame.Weight = not G2frame.Weight 1624 1627 if not G2frame.Weight and 'PWDR' in plottype: … … 1635 1638 pass 1636 1639 else: 1637 G2frame.logPlot = not G2frame.logPlot1638 if not G2frame.logPlot:1640 Page.plotStyle['logPlot'] = not Page.plotStyle['logPlot'] 1641 if not Page.plotStyle['logPlot']: 1639 1642 Pattern[0]['Offset'][0] = 0 1640 1643 newPlot = True 1641 1644 elif event.key == 's' and 'PWDR' in plottype: 1642 1645 if G2frame.SinglePlot: #toggle sqrt plot 1643 G2frame.plotStyle['sqrtPlot'] = not G2frame.plotStyle['sqrtPlot']1646 Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot'] 1644 1647 Ymax = max(Pattern[1][1]) 1645 if G2frame.plotStyle['sqrtPlot']:1648 if Page.plotStyle['sqrtPlot']: 1646 1649 Pattern[0]['delOffset'] = .002*np.sqrt(Ymax) 1647 1650 Pattern[0]['refOffset'] = 0.1*np.sqrt(Ymax) … … 1698 1701 G2frame.Contour = not G2frame.Contour 1699 1702 if G2frame.Contour: 1700 G2frame.plotStyle['qPlot'] = False1701 G2frame.plotStyle['dPlot'] = False1703 Page.plotStyle['qPlot'] = False 1704 Page.plotStyle['dPlot'] = False 1702 1705 elif event.key == 'a' and 'PWDR' in plottype and G2frame.SinglePlot and not ( 1703 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):1706 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 1704 1707 # add a magnification region 1705 1708 try: … … 1709 1712 Pattern[0]['Magnification'] = [] 1710 1713 try: 1711 if G2frame.plotStyle['qPlot']:1714 if Page.plotStyle['qPlot']: 1712 1715 xpos = G2lat.Dsp2pos(Parms,2.0*np.pi/xpos) 1713 elif G2frame.plotStyle['dPlot']:1716 elif Page.plotStyle['dPlot']: 1714 1717 xpos = G2lat.Dsp2pos(Parms,xpos) 1715 1718 except ValueError: … … 1725 1728 newPlot = True 1726 1729 if 'PWDR' in plottype: 1727 G2frame.plotStyle['qPlot'] = not G2frame.plotStyle['qPlot']1728 if G2frame.plotStyle['qPlot']:1730 Page.plotStyle['qPlot'] = not Page.plotStyle['qPlot'] 1731 if Page.plotStyle['qPlot']: 1729 1732 G2frame.Weight = False 1730 1733 G2frame.Contour = False 1731 G2frame.plotStyle['dPlot'] = False1734 Page.plotStyle['dPlot'] = False 1732 1735 elif plottype in ['SASD','REFD']: 1733 G2frame.plotStyle['sqPlot'] = not G2frame.plotStyle['sqPlot']1736 Page.plotStyle['sqPlot'] = not Page.plotStyle['sqPlot'] 1734 1737 elif event.key == 't' and 'PWDR' in plottype: 1735 G2frame.plotStyle['dPlot'] = not G2frame.plotStyle['dPlot']1736 if G2frame.plotStyle['dPlot']:1738 Page.plotStyle['dPlot'] = not Page.plotStyle['dPlot'] 1739 if Page.plotStyle['dPlot']: 1737 1740 G2frame.Contour = False 1738 1741 G2frame.Weight = False 1739 G2frame.plotStyle['qPlot'] = False1742 Page.plotStyle['qPlot'] = False 1740 1743 newPlot = True 1741 1744 elif event.key == 'm': 1742 G2frame.plotStyle['sqrtPlot'] = False1745 Page.plotStyle['sqrtPlot'] = False 1743 1746 G2frame.SinglePlot = not G2frame.SinglePlot 1744 1747 newPlot = True … … 1787 1790 limx = Plot.get_xlim() 1788 1791 dT = tolerance = np.fabs(limx[1]limx[0])/100. 1789 if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:1792 if Page.plotStyle['qPlot'] and 'PWDR' in plottype: 1790 1793 q = xpos 1791 1794 if q <= 0: … … 1809 1812 return 1810 1813 dsp = 2.*np.pi/q 1811 elif G2frame.plotStyle['dPlot']:1814 elif Page.plotStyle['dPlot']: 1812 1815 dsp = xpos 1813 1816 if dsp <= 0: … … 1836 1839 if 'C' in Parms['Type'][0]: 1837 1840 if 'PWDR' in plottype: 1838 if G2frame.plotStyle['sqrtPlot']:1841 if Page.plotStyle['sqrtPlot']: 1839 1842 G2frame.G2plotNB.status.SetStatusText('2theta =%9.3f d =%9.5f q = %9.5f sqrt(Intensity) =%9.2f'%(xpos,dsp,q,ypos),1) 1840 1843 else: … … 1845 1848 G2frame.G2plotNB.status.SetStatusText('q =%12.5g Reflectivity =%12.5g d =%9.1f'%(q,ypos,dsp),1) 1846 1849 else: 1847 if G2frame.plotStyle['sqrtPlot']:1850 if Page.plotStyle['sqrtPlot']: 1848 1851 G2frame.G2plotNB.status.SetStatusText('TOF =%9.3f d =%9.5f q =%9.5f sqrt(Intensity) =%9.2f'%(xpos,dsp,q,ypos),1) 1849 1852 else: … … 1982 1985 Page.canvas.blit(Page.figure.gca().bbox) 1983 1986 1987 global Page 1984 1988 try: 1985 1989 Parms,Parms2 = G2frame.GPXtree.GetItemPyData(G2gd.GetGPXtreeItemId(G2frame,G2frame.PatternId, 'Instrument Parameters')) … … 1999 2003 xy = list(list(zip(np.take(xpos,ind),np.take(ypos,ind)))[0]) 2000 2004 # convert from plot units 2001 if G2frame.plotStyle['qPlot']: #qplot  convert back to 2theta2005 if Page.plotStyle['qPlot']: #qplot  convert back to 2theta 2002 2006 xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0]) 2003 elif G2frame.plotStyle['dPlot']: #dplot  convert back to 2theta2007 elif Page.plotStyle['dPlot']: #dplot  convert back to 2theta 2004 2008 xy[0] = G2lat.Dsp2pos(Parms,xy[0]) 2005 if G2frame.plotStyle['sqrtPlot']:2006 xy[1] = xy[1]**22009 # if Page.plotStyle['sqrtPlot']: 2010 # xy[1] = xy[1]**2 2007 2011 PatternId = G2frame.PatternId 2008 2012 PickId = G2frame.PickId … … 2029 2033 LimitId = G2gd.GetGPXtreeItemId(G2frame,PatternId, 'Limits') 2030 2034 data = G2frame.GPXtree.GetItemPyData(LimitId) 2031 if G2frame.plotStyle['qPlot']: #qplot  convert back to 2theta2035 if Page.plotStyle['qPlot']: #qplot  convert back to 2theta 2032 2036 xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0]) 2033 elif G2frame.plotStyle['dPlot']: #dplot  convert back to 2theta2037 elif Page.plotStyle['dPlot']: #dplot  convert back to 2theta 2034 2038 xy[0] = G2lat.Dsp2pos(Parms,xy[0]) 2035 2039 if G2frame.ifGetExclude: … … 2169 2173 xy = [event.xdata,event.ydata] 2170 2174 try: 2171 if G2frame.plotStyle['qPlot']: #qplot  convert back to 2theta2175 if Page.plotStyle['qPlot']: #qplot  convert back to 2theta 2172 2176 xy[0] = G2lat.Dsp2pos(Parms,2*np.pi/xy[0]) 2173 elif G2frame.plotStyle['dPlot']: #dplot  convert back to 2theta2177 elif Page.plotStyle['dPlot']: #dplot  convert back to 2theta 2174 2178 xy[0] = G2lat.Dsp2pos(Parms,xy[0]) 2175 2179 except: 2176 2180 return 2177 if G2frame.plotStyle['sqrtPlot']:2181 if Page.plotStyle['sqrtPlot']: 2178 2182 xy[1] = xy[1]**2 2179 2183 backPts = G2frame.dataWindow.wxID_BackPts … … 2207 2211 xpos = event.xdata 2208 2212 try: 2209 if G2frame.plotStyle['qPlot']: #qplot  convert back to 2theta2213 if Page.plotStyle['qPlot']: #qplot  convert back to 2theta 2210 2214 xpos = G2lat.Dsp2pos(Parms,2*np.pi/xpos) 2211 elif G2frame.plotStyle['dPlot']: #dplot  convert back to 2theta2215 elif Page.plotStyle['dPlot']: #dplot  convert back to 2theta 2212 2216 xpos = G2lat.Dsp2pos(Parms,xpos) 2213 2217 except: … … 2234 2238 id = lineNo//2+1 2235 2239 id2 = lineNo%2 2236 if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:2240 if Page.plotStyle['qPlot'] and 'PWDR' in plottype: 2237 2241 limits[id][id2] = G2lat.Dsp2pos(Parms,2.*np.pi/xpos) 2238 elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:2242 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype: 2239 2243 limits[id][id2] = G2lat.Dsp2pos(Parms,xpos) 2240 2244 else: … … 2252 2256 del peaks['peaks'][lineNo2nxcl] 2253 2257 else: 2254 if G2frame.plotStyle['qPlot']:2258 if Page.plotStyle['qPlot']: 2255 2259 peaks['peaks'][lineNo2nxcl][0] = G2lat.Dsp2pos(Parms,2.*np.pi/xpos) 2256 elif G2frame.plotStyle['dPlot']:2260 elif Page.plotStyle['dPlot']: 2257 2261 peaks['peaks'][lineNo2nxcl][0] = G2lat.Dsp2pos(Parms,xpos) 2258 2262 else: … … 2299 2303 if msg: msg += '\n' 2300 2304 msg += " * only when a single histogram is plotted" 2301 if G2frame.logPlot or G2frame.plotStyle['sqrtPlot']:2305 if Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot']: 2302 2306 if msg: msg += '\n' 2303 2307 msg += " * only when the intensity scale is linear (not log or sqrt)" … … 2323 2327 else: 2324 2328 if plottype in ['SASD','REFD']: 2325 G2frame.logPlot= True2329 Page.plotStyle['logPlot'] = True 2326 2330 G2frame.ErrorBars = True 2327 2331 newPlot = True … … 2361 2365 'i: interpolation method','s: color scheme','c: contour off') 2362 2366 else: 2363 if G2frame.logPlot:2367 if Page.plotStyle['logPlot']: 2364 2368 if 'PWDR' in plottype: 2365 2369 if G2frame.SinglePlot: … … 2400 2404 'q: toggle S(q) plot','m: toggle multidata plot','w: toggle (IoIc)/sig plot','+: no selection') 2401 2405 if 'PWDR' in plottype and G2frame.SinglePlot and not ( 2402 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):2406 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 2403 2407 Page.Choice = Page.Choice + ('a: add magnification region',) 2404 2408 magLineList = [] # null value indicates no magnification … … 2468 2472 offsetX = Pattern[0]['Offset'][1] 2469 2473 offsetY = Pattern[0]['Offset'][0] 2470 if G2frame.logPlot:2474 if Page.plotStyle['logPlot']: 2471 2475 Title = 'log('+Title+')' 2472 if G2frame.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour:2476 if Page.plotStyle['qPlot'] or plottype in ['SASD','REFD'] and not G2frame.Contour: 2473 2477 xLabel = r'$Q, \AA^{1}$' 2474 elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour:2478 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype and not G2frame.Contour: 2475 2479 xLabel = r'$d, \AA$' 2476 2480 else: … … 2497 2501 if 'C' in ParmList[0]['Type'][0]: 2498 2502 if 'PWDR' in plottype: 2499 if G2frame.plotStyle['sqrtPlot']:2503 if Page.plotStyle['sqrtPlot']: 2500 2504 Plot.set_ylabel(r'$\sqrt{Intensity}$',fontsize=16) 2501 2505 else: 2502 2506 Plot.set_ylabel(r'$Intensity$',fontsize=16) 2503 2507 elif plottype == 'SASD': 2504 if G2frame.plotStyle['sqPlot']:2508 if Page.plotStyle['sqPlot']: 2505 2509 Plot.set_ylabel(r'$S(Q)=I*Q^{4}$',fontsize=16) 2506 2510 else: 2507 2511 Plot.set_ylabel(r'$Intensity,\ cm^{1}$',fontsize=16) 2508 2512 elif plottype == 'REFD': 2509 if G2frame.plotStyle['sqPlot']:2513 if Page.plotStyle['sqPlot']: 2510 2514 Plot.set_ylabel(r'$S(Q)=R*Q^{4}$',fontsize=16) 2511 2515 else: 2512 2516 Plot.set_ylabel(r'$Reflectivity$',fontsize=16) 2513 2517 else: #neutron TOF 2514 if G2frame.plotStyle['sqrtPlot']:2518 if Page.plotStyle['sqrtPlot']: 2515 2519 Plot.set_ylabel(r'$\sqrt{Normalized\ intensity}$',fontsize=16) 2516 2520 else: … … 2545 2549 Pattern[1][0] = ma.array(Pattern[1][0],mask=ma.getmask(xye0)) 2546 2550 # Pattern[1][0].mask = xye0.mask # transfer the mask 2547 if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:2551 if Page.plotStyle['qPlot'] and 'PWDR' in plottype: 2548 2552 X = 2.*np.pi/G2lat.Pos2dsp(Parms,xye0) 2549 elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:2553 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype: 2550 2554 X = G2lat.Pos2dsp(Parms,xye0) 2551 2555 else: … … 2558 2562 multArray = np.ones_like(Pattern[1][0]) 2559 2563 if 'PWDR' in plottype and G2frame.SinglePlot and not ( 2560 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):2564 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 2561 2565 magLineList = data[0].get('Magnification',[]) 2562 if ('C' in ParmList[0]['Type'][0] and G2frame.plotStyle['dPlot']2563 ) or ('T' in ParmList[0]['Type'][0] and G2frame.plotStyle['qPlot']2566 if ('C' in ParmList[0]['Type'][0] and Page.plotStyle['dPlot'] 2567 ) or ('T' in ParmList[0]['Type'][0] and Page.plotStyle['qPlot'] 2564 2568 ): # reversed regions relative to data order 2565 2569 tcorner = 1 … … 2581 2585 continue 2582 2586 multArray[Pattern[1][0]>x] = m 2583 if G2frame.plotStyle['qPlot']:2587 if Page.plotStyle['qPlot']: 2584 2588 x = 2.*np.pi/G2lat.Pos2dsp(Parms,x) 2585 elif G2frame.plotStyle['dPlot']:2589 elif Page.plotStyle['dPlot']: 2586 2590 x = G2lat.Pos2dsp(Parms,x) 2587 2591 # is range in displayed range (defined after newplot)? … … 2604 2608 multArray = ma.getdata(multArray) 2605 2609 if 'PWDR' in plottype: 2606 if G2frame.plotStyle['sqrtPlot']:2610 if Page.plotStyle['sqrtPlot']: 2607 2611 olderr = np.seterr(invalid='ignore') #get around sqrt(ve) error 2608 2612 Y = np.where(xye[1]+bxye>=0.,np.sqrt(xye[1]+bxye),np.sqrt(xye[1]bxye)) 2609 2613 np.seterr(invalid=olderr['invalid']) 2610 2614 elif 'PWDR' in plottype and G2frame.SinglePlot and not ( 2611 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):2615 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 2612 2616 Y = xye[1]*multArray+bxye+NoffY*Ymax/100.0 2613 2617 else: … … 2618 2622 else: 2619 2623 B = np.zeros_like(xye[5]) 2620 if G2frame.plotStyle['sqPlot']:2624 if Page.plotStyle['sqPlot']: 2621 2625 Y = xye[1]*Sample['Scale'][0]*(1.05)**NoffY*X**4 2622 2626 else: … … 2625 2629 limits = np.array(G2frame.GPXtree.GetItemPyData(LimitId)) 2626 2630 lims = limits[1] 2627 if G2frame.plotStyle['qPlot'] and 'PWDR' in plottype:2631 if Page.plotStyle['qPlot'] and 'PWDR' in plottype: 2628 2632 lims = 2.*np.pi/G2lat.Pos2dsp(Parms,lims) 2629 elif G2frame.plotStyle['dPlot'] and 'PWDR' in plottype:2633 elif Page.plotStyle['dPlot'] and 'PWDR' in plottype: 2630 2634 lims = G2lat.Pos2dsp(Parms,lims) 2631 2635 Lines.append(Plot.axvline(lims[0],color='g',dashes=(5,5),picker=3.)) … … 2650 2654 else: 2651 2655 pP = '' 2652 if plottype in ['SASD','REFD'] and G2frame.logPlot:2656 if plottype in ['SASD','REFD'] and Page.plotStyle['logPlot']: 2653 2657 X *= (1.01)**(offsetX*N) 2654 2658 else: … … 2658 2662 Xum = ma.getdata(X) # unmasked version of X, use to plot data (only) 2659 2663 if ifpicked: 2660 if G2frame.plotStyle['sqrtPlot']:2664 if Page.plotStyle['sqrtPlot']: 2661 2665 olderr = np.seterr(invalid='ignore') #get around sqrt(ve) error 2662 2666 Z = np.where(xye[3]>=0.,np.sqrt(xye[3]),np.sqrt(xye[3])) … … 2664 2668 else: 2665 2669 if 'PWDR' in plottype and G2frame.SinglePlot and not ( 2666 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):2670 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 2667 2671 Z = xye[3]*multArray+NoffY*Ymax/100.0 2668 2672 else: 2669 2673 Z = xye[3]+NoffY*Ymax/100.0 2670 2674 if 'PWDR' in plottype: 2671 if G2frame.plotStyle['sqrtPlot']:2675 if Page.plotStyle['sqrtPlot']: 2672 2676 olderr = np.seterr(invalid='ignore') #get around sqrt(ve) error 2673 2677 W = np.where(xye[4]>=0.,np.sqrt(xye[4]),np.sqrt(xye[4])) … … 2675 2679 D = np.where(xye[5],(YZ),0.)Pattern[0]['delOffset'] 2676 2680 elif 'PWDR' in plottype and G2frame.SinglePlot and not ( 2677 G2frame.logPlot or G2frame.plotStyle['sqrtPlot'] or G2frame.Contour):2681 Page.plotStyle['logPlot'] or Page.plotStyle['sqrtPlot'] or G2frame.Contour): 2678 2682 W = xye[4]*multArray+NoffY*Ymax/100.0 2679 2683 D = multArray*xye[5]Pattern[0]['delOffset'] #powder background … … 2682 2686 D = xye[5]Pattern[0]['delOffset'] #powder background 2683 2687 elif plottype in ['SASD','REFD']: 2684 if G2frame.plotStyle['sqPlot']:2688 if Page.plotStyle['sqPlot']: 2685 2689 W = xye[4]*X**4 2686 2690 Z = xye[3]*X**4 … … 2708 2712 Plot1.axhline(0.,color='k') 2709 2713 Plot1.set_ylim(bottom=np.min(DZ[Ibeg:Ifin])*1.2,top=np.max(DZ[Ibeg:Ifin])*1.2) 2710 if G2frame.logPlot:2714 if Page.plotStyle['logPlot']: 2711 2715 if 'PWDR' in plottype: 2712 2716 Plot.set_yscale("log",nonposy='mask') … … 2720 2724 Plot.set_yscale("log",nonposy='mask') 2721 2725 if G2frame.ErrorBars: 2722 if G2frame.plotStyle['sqPlot']:2726 if Page.plotStyle['sqPlot']: 2723 2727 Plot.errorbar(X,YB,yerr=X**4*Sample['Scale'][0]*np.sqrt(1./(Pattern[0]['wtFactor']*xye[2])), 2724 2728 ecolor=colors[0],picker=3.,clip_on=Clip_on) … … 2764 2768 else: 2765 2769 Ni = N 2766 if G2frame.plotStyle['qPlot']:2770 if Page.plotStyle['qPlot']: 2767 2771 Lines.append(Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,item[0]),color=colors[Ni%6],picker=2.)) 2768 elif G2frame.plotStyle['dPlot']:2772 elif Page.plotStyle['dPlot']: 2769 2773 Lines.append(Plot.axvline(G2lat.Pos2dsp(Parms,item[0]),color=colors[Ni%6],picker=2.)) 2770 2774 else: … … 2779 2783 else: #not picked 2780 2784 icolor = 256*N//len(PlotList) 2781 if G2frame.logPlot:2785 if Page.plotStyle['logPlot']: 2782 2786 if 'PWDR' in plottype: 2783 2787 Plot.semilogy(X,Y,color=mcolors.cmap(icolor),picker=False,nonposy='mask') … … 2791 2795 Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.) 2792 2796 2793 if G2frame.logPlotand 'PWDR' in plottype:2797 if Page.plotStyle['logPlot'] and 'PWDR' in plottype: 2794 2798 Plot.set_ylim(bottom=np.min(np.trim_zeros(Y))/2.,top=np.max(Y)*2.) 2795 2799 # if not G2frame.SinglePlot and not G2frame.Contour: … … 2806 2810 for peak in peaks[0]: 2807 2811 if peak[2]: 2808 if G2frame.plotStyle['qPlot']:2812 if Page.plotStyle['qPlot']: 2809 2813 Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,peak[0]),color='b') 2810 if G2frame.plotStyle['dPlot']:2814 if Page.plotStyle['dPlot']: 2811 2815 Plot.axvline(G2lat.Pos2dsp(Parms,peak[0]),color='b') 2812 2816 else: … … 2816 2820 if len(hkl) > 6 and hkl[3]: 2817 2821 clr = 'g' 2818 if G2frame.plotStyle['qPlot']:2822 if Page.plotStyle['qPlot']: 2819 2823 Plot.axvline(2.*np.pi/G2lat.Pos2dsp(Parms,hkl[2]),color=clr,dashes=(5,5)) 2820 if G2frame.plotStyle['dPlot']:2824 if Page.plotStyle['dPlot']: 2821 2825 Plot.axvline(G2lat.Pos2dsp(Parms,hkl[2]),color=clr,dashes=(5,5)) 2822 2826 else: … … 2840 2844 pos = Pattern[0]['refOffset']pId*Pattern[0]['refDelt']*np.ones_like(peak) 2841 2845 plsym = Page.phaseColors.get(phase,'y')+'' # yellow should never happen! 2842 if G2frame.plotStyle['qPlot']:2846 if Page.plotStyle['qPlot']: 2843 2847 Page.tickDict[phase],j = Plot.plot(2*np.pi/peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2844 elif G2frame.plotStyle['dPlot']:2848 elif Page.plotStyle['dPlot']: 2845 2849 Page.tickDict[phase],j = Plot.plot(peak.T[0],pos,plsym,mew=w,ms=l,picker=3.,label=phase) 2846 2850 else: … … 2870 2874 if G2frame.SubBack or G2frame.Weight or G2frame.Contour or not G2frame.SinglePlot: 2871 2875 break 2872 if y < 0 and ( G2frame.plotStyle['sqrtPlot'] or G2frame.logPlot):2876 if y < 0 and (Page.plotStyle['sqrtPlot'] or Page.plotStyle['logPlot']): 2873 2877 y = Page.figure.gca().get_ylim()[0] # put out of range point at bottom of plot 2874 elif G2frame.plotStyle['sqrtPlot']:2878 elif Page.plotStyle['sqrtPlot']: 2875 2879 y = math.sqrt(y) 2876 if G2frame.plotStyle['qPlot']: #Q  convert from 2theta2880 if Page.plotStyle['qPlot']: #Q  convert from 2theta 2877 2881 if Parms: 2878 2882 x = 2*np.pi/G2lat.Pos2dsp(Parms,x) 2879 2883 else: 2880 2884 break 2881 elif G2frame.plotStyle['dPlot']: #d  convert from 2theta2885 elif Page.plotStyle['dPlot']: #d  convert from 2theta 2882 2886 if Parms: 2883 2887 x = G2lat.Dsp2pos(Parms,x) … … 2892 2896 Plot.set_xlim(G2frame.xylim[0]) 2893 2897 Plot.set_ylim(G2frame.xylim[1]) 2894 # xylim = []2895 2898 Page.toolbar.push_current() 2896 2899 Page.toolbar.draw() … … 2900 2903 olderr = np.seterr(invalid='ignore') #ugh  this removes a matplotlib error for mouse clicks in log plots 2901 2904 # and sqrt(ve) in np.where usage 2902 # G2frame.Pwdr = True2903 2905 if 'PWDR' in G2frame.GPXtree.GetItemText(G2frame.PickId): 2904 2906 if len(Page.tickDict.keys()) == 1: … … 5756 5758 Data['invert_y'] = not Data['invert_y'] 5757 5759 elif event.key in ['s',] and Data['linescan'][0]: 5758 G2frame.logPlot= False5759 G2frame.plotStyle['sqrtPlot'] = not G2frame.plotStyle['sqrtPlot']5760 Page.plotStyle['logPlot'] = False 5761 Page.plotStyle['sqrtPlot'] = not Page.plotStyle['sqrtPlot'] 5760 5762 elif event.key in ['n',] and Data['linescan'][0]: 5761 G2frame.plotStyle['sqrtPlot'] = False5762 G2frame.logPlot = not G2frame.logPlot5763 Page.plotStyle['sqrtPlot'] = False 5764 Page.plotStyle['logPlot'] = not Page.plotStyle['logPlot'] 5763 5765 else: 5764 5766 return … … 5841 5843 xy = G2img.GetLineScan(G2frame.ImageZ,Data) 5842 5844 Plot1.cla() 5843 if G2frame.logPlot: 5845 olderr = np.seterr(invalid='ignore') #get around sqrt/log(ve) error 5846 if Page.plotStyle['logPlot']: 5844 5847 xy[1] = np.log(xy[1]) 5845 elif G2frame.plotStyle['sqrtPlot']:5848 elif Page.plotStyle['sqrtPlot']: 5846 5849 xy[1] = np.sqrt(xy[1]) 5850 np.seterr(invalid=olderr['invalid']) 5847 5851 Plot1.plot(xy[0],xy[1]) 5848 5852 Plot1.set_xlim(Data['IOtth']) … … 6287 6291 Plot1.set_ylabel('Intensity',fontsize=12) 6288 6292 xy = G2img.GetLineScan(G2frame.ImageZ,Data) 6289 if G2frame.logPlot: 6293 olderr = np.seterr(invalid='ignore') #get around sqrt(ve) error 6294 if Page.plotStyle['logPlot']: 6290 6295 xy[1] = np.log(xy[1]) 6291 6296 Plot1.set_ylabel('log(Intensity)',fontsize=12) 6292 elif G2frame.plotStyle['sqrtPlot']:6297 elif Page.plotStyle['sqrtPlot']: 6293 6298 Plot1.set_ylabel(r'$\sqrt{Intensity}$',fontsize=12) 6294 6299 xy[1] = np.sqrt(xy[1]) 6300 np.seterr(invalid=olderr['invalid']) 6295 6301 Plot1.plot(xy[0],xy[1]) 6296 6302 Plot1.set_xlim(Data['IOtth'])
Note: See TracChangeset
for help on using the changeset viewer.