Changeset 2697 for trunk/python


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.


Location:
trunk/python
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asaplotbase.py

    r2693 r2697  
    9494        """
    9595
    96         for i in range(len(self.lines)):
    97            self.delete(i)
     96        #for i in range(len(self.lines)):
     97        #   self.delete(i)
    9898        self.axes.clear()
    9999        self.color = 0
    100100        self.lines = []
     101        self.subplots[self.i]['lines'] = self.lines
    101102
    102103    def palette(self, color, colormap=None, linestyle=0, linestyles=None):
  • 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
  • trunk/python/customgui_base.py

    r2606 r2697  
    326326        doheader = (isinstance(header['textobj'],list) and \
    327327                    len(header['textobj']) > 0)
     328        if doheader:
     329            top = self.plotter._plotter.figure.subplotpars.top
     330            fontsize = header['textobj'][0].get_fontproperties().get_size()
    328331        if self.plotter._startrow <= 0:
    329332            msg = "The page counter is reset due to chages of plot settings. "
     
    340343                    selstr = header['selstr']
    341344            self.plotter._reset_header()
    342         if doheader:
    343             top = self.plotter._plotter.figure.subplotpars.top
    344             fontsize = header['textobj'][0].get_fontproperties().get_size()
    345345
    346346        self.plotter._plotter.hold()
     
    349349        #self.plotter._plotter.clear()
    350350        self.plotter._plot(self.plotter._data)
    351         self.set_pagecounter(self._get_pagenum())
     351        pagenum = self._get_pagenum()
     352        self.set_pagecounter(pagenum)
    352353        # Plot header information
    353         if header['textobj']:
     354        #if header['textobj']:
     355        if doheader and pagenum == 1:
    354356            if top and top != self.plotter._margins[3]:
    355357                # work around for sdplot in CASA. complete checking in future?
     
    403405
    404406    def _get_pagenum(self):
    405         maxpanel = 16
    406407        # get the ID of last panel in the current page
    407408        idlastpanel = self.plotter._ipanel
    408         if self.plotter._rows and self.plotter._cols:
    409             ppp = self.plotter._rows*self.plotter._cols
    410         else:
    411             ppp = maxpanel
     409        # max panels in a page
     410        ppp = self.plotter._plotter.rows*self.plotter._plotter.cols
    412411        return int(idlastpanel/ppp)+1
    413412
     
    12391238
    12401239    def _get_pagenum(self):
    1241         maxpanel = 25
    12421240        # get the ID of last panel in the current page
    12431241        idlastpanel = self.plotter._ipanel
    1244         if self.plotter._rows and self.plotter._cols:
    1245             ppp = self.plotter._rows*self.plotter._cols
    1246         else:
    1247             ppp = maxpanel
     1242        # max panels in a page
     1243        ppp = self.plotter._plotter.rows*self.plotter._plotter.cols
    12481244        return int(idlastpanel/ppp)+1
    12491245
Note: See TracChangeset for help on using the changeset viewer.