Changeset 2604


Ignore:
Timestamp:
07/20/12 15:00:14 (12 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: No (minor improvements)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs: unit tests of sdplot

Put in Release Notes: No

Module(s): asapplotter, sdplot (CASA)

Description:

Eliminated duplication of codes.
A minor bug fix to asapplotter.plotgrid.
Initial attempt to add destructor to asapplotter class.


File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r2603 r2604  
    7878        self._linestyles = None
    7979        self._legendloc = None
     80
     81    def __del__(self):
     82        print "Destructor of sd.plotter"
     83        del self._data
     84        if self._plotter: self._plotter.quit()
    8085
    8186    def _translate(self, instr):
     
    412417        from asap import scantable
    413418        if isinstance(scan, scantable):
    414             if self._data is not None:
    415                 if scan != self._data:
    416                     del self._data
    417                     self._data = scan
    418                     # reset
    419                     self._reset()
    420                     msg = "A new scantable is set to the plotter. "\
    421                           "The masks and data selections are reset."
    422                     asaplog.push( msg )
    423             else:
    424                 self._data = scan
    425                 self._reset()
     419            if (self._data is not None) and (scan != self._data):
     420                del self._data
     421                msg = "A new scantable is set to the plotter. "\
     422                      "The masks and data selections are reset."
     423                asaplog.push( msg )
     424            self._data = scan
     425            # reset
     426            self._reset()
    426427        else:
    427428            msg = "Input is not a scantable"
     
    16151616            msg = "No scantable is specified to plot"
    16161617            raise TypeError(msg)
    1617         if isinstance(scan, scantable):
    1618             if self._data is not None:
    1619                 if scan != self._data:
    1620                     self._data = scan
    1621                     # reset
    1622                     self._reset()
    1623             else:
    1624                 self._data = scan
    1625                 self._reset()
    1626         elif not self._data:
    1627             msg = "Input is not a scantable"
    1628             raise TypeError(msg)
    1629        
     1618        if scan:
     1619            self.set_data(scan, refresh=False)
     1620            del scan
     1621
    16301622        # Rows and cols
    16311623        if rows:
     
    17501742        self._plotter.hold()
    17511743        self._plotter.clear()
     1744        self._plotter.legend()
    17521745       
    17531746        # Adjust subplot margins
Note: See TracChangeset for help on using the changeset viewer.