Ignore:
Timestamp:
12/14/12 13:48:22 (11 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: iterate pages

Put in Release Notes: No

Module(s): asapplotter and sdplot

Description: An attempt to speed-up page iterations in ASAP plotter.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r2694 r2697  
    193193            msg = "Input is not a scantable"
    194194            raise TypeError(msg)
    195         self._startrow = 0
    196         self._ipanel = -1
    197         self._reset_header()
    198         self._panelrows = []
    199195
    200196        self._assert_plotter(action="reload")
    201         if self.casabar_exists():
    202             self._plotter.figmgr.casabar.set_pagecounter(1)
    203 
    204197        self._plotter.hold()
     198        self._reset_counter()
    205199        #self._plotter.clear()
    206200        if scan:
     
    969963        self._headtext={'string': None, 'textobj': None}
    970964
     965    def _reset_counter(self):
     966        self._startrow = 0
     967        self._ipanel = -1
     968        self._reset_header()
     969        self._panelrows = []
     970        if self.casabar_exists():
     971            self._plotter.figmgr.casabar.set_pagecounter(1)
     972
    971973    def _plot(self, scan):
    972974        savesel = scan.get_selection()
     
    10041006        #n = min(n-self._ipanel-1,maxpanel)
    10051007        n = n-self._ipanel-1
    1006 
    1007         ganged = False
    1008         if n > 1:
    1009             ganged = rcParams['plotter.ganged']
    1010             if self._panelling == 'i':
    1011                 ganged = False
    1012             if self._rows and self._cols:
    1013                 n = min(n,self._rows*self._cols)
     1008        # the number of panels in this page
     1009        if self._rows and self._cols:
     1010            n = min(n,self._rows*self._cols)
     1011        else:
     1012            n = min(n,maxpanel)
     1013
     1014        firstpage = (self._ipanel < 0)
     1015        #ganged = False
     1016        ganged = rcParams['plotter.ganged']
     1017        if self._panelling == 'i':
     1018            ganged = False
     1019        if not firstpage:
     1020            # not the first page just clear the axis
     1021            nx = self._plotter.cols
     1022            ipaxx = n - nx - 1 #the max panel id to supress x-label
     1023            for ip in xrange(len(self._plotter.subplots)):
     1024                self._plotter.subplot(ip)
     1025                self._plotter.clear()
     1026                self._plotter.axes.set_visible((ip<n))
     1027                if ganged:
     1028                    self._plotter.axes.xaxis.label.set_visible((ip > ipaxx))
     1029                    if ip <= ipaxx:
     1030                        map(lambda x: x.set_visible(False), \
     1031                            self._plotter.axes.get_xticklabels())
     1032                    self._plotter.axes.yaxis.label.set_visible((ip % nx)==0)
     1033                    if ip % nx:
     1034                        map(lambda y: y.set_visible(False), \
     1035                            self._plotter.axes.get_yticklabels())
     1036        elif (n > 1 and self._rows and self._cols):
    10141037                self._plotter.set_panels(rows=self._rows,cols=self._cols,
    10151038                                         nplots=n,margin=self._margins,
    10161039                                         ganged=ganged)
    1017             else:
    1018                 n = min(n,maxpanel)
    1019                 self._plotter.set_panels(rows=n,cols=0,nplots=n,
    1020                                          margin=self._margins,ganged=ganged)
    10211040        else:
    1022             self._plotter.set_panels(margin=self._margins)
     1041            self._plotter.set_panels(rows=n,cols=0,nplots=n,
     1042                                     margin=self._margins,ganged=ganged)
    10231043        #r = 0
    10241044        r = self._startrow
     
    11721192        if self._fp is not None and getattr(self._plotter.figure,'findobj',False):
    11731193            for o in self._plotter.figure.findobj(Text):
    1174                 o.set_fontproperties(self._fp)
     1194                if not self._headtext['textobj'] or \
     1195                   not (o in self._headtext['textobj']):
     1196                    o.set_fontproperties(self._fp)
    11751197
    11761198    def _get_sortstring(self, lorders):
     
    14001422        self._assert_plotter(action="reload")
    14011423        self._plotter.hold()
     1424        self._reset_counter()
    14021425        if self.casabar_exists():
    1403             self._plotter.figmgr.casabar.set_pagecounter(1)
    14041426            self._plotter.figmgr.casabar.disable_button()
    14051427        # for now, only one plot
     
    16671689            self._plotter.hold()
    16681690            self._header_plot(headstr,fontsize=fontsize)
    1669             import time
    1670             self._plotter.figure.text(0.99,0.01,
    1671                             time.strftime("%a %d %b %Y  %H:%M:%S %Z"),
    1672                             horizontalalignment='right',
    1673                             verticalalignment='bottom',fontsize=8)
     1691            #import time
     1692            #self._plotter.figure.text(0.99,0.01,
     1693            #                time.strftime("%a %d %b %Y  %H:%M:%S %Z"),
     1694            #                horizontalalignment='right',
     1695            #                verticalalignment='bottom',fontsize=8)
    16741696            self._plotter.release()
    16751697        if logger:
     
    18671889        self._assert_plotter(action="reload")
    18681890        self._plotter.hold()
    1869         #self._plotter.clear() #all artists are cleared at set_panels
     1891        self._reset_counter()
    18701892        self._plotter.legend()
    18711893
     
    18761898                                 nplots=ntotpl,margin=self._margins,ganged=True)       
    18771899        if self.casabar_exists():
    1878             self._plotter.figmgr.casabar.set_pagecounter(1)
    18791900            self._plotter.figmgr.casabar.enable_button()
    18801901        # Plot helper
Note: See TracChangeset for help on using the changeset viewer.