Changeset 2150 for trunk/python
- Timestamp:
- 04/22/11 18:21:29 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapfitter.py
r2047 r2150 538 538 return 539 539 if not self._p or self._p.is_dead: 540 if rcParams['plotter.gui']: 541 from asap.asaplotgui import asaplotgui as asaplot 542 else: 543 from asap.asaplot import asaplot 544 self._p = asaplot() 540 #if rcParams['plotter.gui']: 541 # from asap.asaplotgui import asaplotgui as asaplot 542 #else: 543 # from asap.asaplot import asaplot 544 #self._p = asaplot() 545 from asap.asapplotter import new_asaplot 546 self._p = new_asaplot(rcParams['plotter.gui']) 545 547 self._p.hold() 546 548 self._p.clear() -
trunk/python/asapmath.py
r2139 r2150 3 3 from asap.logging import asaplog, asaplog_post_dec 4 4 from asap.selector import selector 5 from asap import asaplotgui 5 #from asap import asaplotgui 6 from asap.asapplotter import new_asaplot 6 7 7 8 @asaplog_post_dec … … 311 312 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 312 313 asaplog.post('WARN') 313 p=asaplotgui.asaplotgui() 314 #p=asaplotgui.asaplotgui() 315 p=new_asaplot() 314 316 #nr=min(6,len(ifnos)*len(polnos)) 315 317 nr=len(ifnos)*len(polnos) … … 388 390 x=raw_input('Accept calibration ([y]/n): ' ) 389 391 if x.upper() == 'N': 390 p. unmap()392 p.quit() 391 393 del p 392 394 return scabtab 393 p. unmap()395 p.quit() 394 396 del p 395 397 ### … … 530 532 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 531 533 asaplog.post('WARN') 532 p=asaplotgui.asaplotgui() 534 #p=asaplotgui.asaplotgui() 535 p=new_asaplot() 533 536 #nr=min(6,len(ifnos)*len(polnos)) 534 537 nr=len(ifnos)*len(polnos) … … 607 610 x=raw_input('Accept calibration ([y]/n): ' ) 608 611 if x.upper() == 'N': 609 p. unmap()612 p.quit() 610 613 del p 611 614 return scabtab 612 p. unmap()615 p.quit() 613 616 del p 614 617 ### … … 742 745 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 743 746 asaplog.post('WARN') 744 p=asaplotgui.asaplotgui() 747 #p=asaplotgui.asaplotgui() 748 p=new_asaplot() 745 749 #nr=min(6,len(ifnos)*len(polnos)) 746 750 nr=len(ifnos)/2*len(polnos) … … 811 815 x=raw_input('Accept calibration ([y]/n): ' ) 812 816 if x.upper() == 'N': 813 p. unmap()817 p.quit() 814 818 del p 815 819 return scabtab 816 p. unmap()820 p.quit() 817 821 del p 818 822 ### -
trunk/python/asapplotter.py
r2147 r2150 8 8 9 9 import re 10 11 def new_asaplot(visible=None,**kwargs): 12 """ 13 Returns a new asaplot instance based on the backend settings. 14 """ 15 if visible == None: 16 visible = rcParams['plotter.gui'] 17 18 backend=matplotlib.get_backend() 19 if not visible: 20 from asap.asaplot import asaplot 21 elif backend == 'TkAgg': 22 from asap.asaplotgui import asaplotgui as asaplot 23 elif backend == 'Qt4Agg': 24 from asap.asaplotgui_qt4 import asaplotgui as asaplot 25 elif backend == 'GTkAgg': 26 from asap.asaplotgui_gtk import asaplotgui as asaplot 27 else: 28 from asap.asaplot import asaplot 29 return asaplot(**kwargs) 10 30 11 31 class asapplotter: … … 66 86 67 87 def _newplotter(self, **kwargs): 68 backend=matplotlib.get_backend() 69 if not self._visible: 70 from asap.asaplot import asaplot 71 elif backend == 'TkAgg': 72 from asap.asaplotgui import asaplotgui as asaplot 73 elif backend == 'Qt4Agg': 74 from asap.asaplotgui_qt4 import asaplotgui as asaplot 75 elif backend == 'GTkAgg': 76 from asap.asaplotgui_gtk import asaplotgui as asaplot 77 else: 78 from asap.asaplot import asaplot 79 return asaplot(**kwargs) 88 return new_asaplot(self._visible,**kwargs) 80 89 81 90 def _newcasabar(self): -
trunk/python/scantable.py
r2144 r2150 2030 2030 2031 2031 if plot: 2032 if rcParams['plotter.gui']: 2033 from asap.asaplotgui import asaplotgui as asaplot 2034 else: 2035 from asap.asaplot import asaplot 2036 self._p=asaplot() 2037 self._p.set_panels() 2032 from asap.asapplotter import new_asaplot 2033 theplot = new_asaplot(rcParams['plotter.gui']) 2034 theplot.set_panels() 2038 2035 ylab=s._get_ordinate_label() 2039 # self._p.palette(0,["#777777","red"])2036 #theplot.palette(0,["#777777","red"]) 2040 2037 for r in xrange(s.nrow()): 2041 2038 xsm=s._getabcissa(r) … … 2043 2040 xorg=orgscan._getabcissa(r) 2044 2041 yorg=orgscan._getspectrum(r) 2045 self._p.clear()2046 self._p.hold()2047 self._p.set_axes('ylabel',ylab)2048 self._p.set_axes('xlabel',s._getabcissalabel(r))2049 self._p.set_axes('title',s._getsourcename(r))2050 self._p.set_line(label='Original',color="#777777")2051 self._p.plot(xorg,yorg)2052 self._p.set_line(label='Smoothed',color="red")2053 self._p.plot(xsm,ysm)2042 theplot.clear() 2043 theplot.hold() 2044 theplot.set_axes('ylabel',ylab) 2045 theplot.set_axes('xlabel',s._getabcissalabel(r)) 2046 theplot.set_axes('title',s._getsourcename(r)) 2047 theplot.set_line(label='Original',color="#777777") 2048 theplot.plot(xorg,yorg) 2049 theplot.set_line(label='Smoothed',color="red") 2050 theplot.plot(xsm,ysm) 2054 2051 ### Ugly part for legend 2055 2052 for i in [0,1]: 2056 self._p.subplots[0]['lines'].append([self._p.subplots[0]['axes'].lines[i]])2057 self._p.release()2053 theplot.subplots[0]['lines'].append([theplot.subplots[0]['axes'].lines[i]]) 2054 theplot.release() 2058 2055 ### Ugly part for legend 2059 self._p.subplots[0]['lines']=[]2056 theplot.subplots[0]['lines']=[] 2060 2057 res = raw_input("Accept smoothing ([y]/n): ") 2061 2058 if res.upper() == 'N': 2062 2059 s._setspectrum(yorg, r) 2063 self._p.unmap()2064 self._p = None2060 theplot.quit() 2061 del theplot 2065 2062 del orgscan 2066 2063
Note:
See TracChangeset
for help on using the changeset viewer.