Changeset 2535


Ignore:
Timestamp:
05/17/12 19:00:47 (12 years ago)
Author:
Kana Sugimoto
Message:

New Development: No

JIRA Issue: Yes (CAS-3749/TRAC-266)

Ready for Test: Yes

Interface Changes: No

What Interface Changed:

Test Programs:

interactive tests are required

  1. on CASA

(1) plot something by CASA sdplot task
(2) run CASA sdfit with plotlevel!=0
(3) close plotter window by pressing X button on the window
(4) plot something by sdplot task again.

  1. on stand-alone ASAP

(1) plot something by asapplotter
(2) run asapfitter.auto_fit with plot=T
(3) plot something by asapplotter again

Put in Release Notes: No

Module(s): sdplot, asapplotter

Description:

Fixed a bug which caused sdplot and asapplotter crash after closing
plotter loaded by the other modules (tasks) with X button. It was
a bug caused by the fact ID numbers of figure managers are
identical in both sdplot (asapplotter) and the other plotter.
It is also possible, that user loads plotter with the ID identical
to asapplotter and overrides it. This is because, user can select
arbitrary ID when generating a new plot.

asap.plotter._assert_plotter does more tests to make sure the
previous plotter GUI is alive, and properly reloads plotter if not.

Also some minor fixes to reset linewidth for plot invoked by
modules other than asapplot/sdplot, i.e., scantable, asapfitter,
and asapmath.

Location:
trunk/python
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapfitter.py

    r2451 r2535  
    549549        self._p.hold()
    550550        self._p.clear()
     551        rcp('lines', linewidth=1)
    551552        self._p.set_panels()
    552553        self._p.palette(0)
  • trunk/python/asapmath.py

    r2472 r2535  
    312312        asaplog.post('WARN')
    313313        p=new_asaplot()
     314        rcp('lines', linewidth=1)
    314315        #nr=min(6,len(ifnos)*len(polnos))
    315316        nr=len(ifnos)*len(polnos)
     
    531532        asaplog.post('WARN')
    532533        p=new_asaplot()
     534        rcp('lines', linewidth=1)
    533535        #nr=min(6,len(ifnos)*len(polnos))
    534536        nr=len(ifnos)*len(polnos)
     
    741743        asaplog.post('WARN')
    742744        p=new_asaplot()
     745        rcp('lines', linewidth=1)
    743746        #nr=min(6,len(ifnos)*len(polnos))
    744747        nr=len(ifnos)/2*len(polnos)
  • trunk/python/asapplotter.py

    r2453 r2535  
    66from matplotlib.font_manager import FontProperties
    77from matplotlib.text import Text
     8from matplotlib import _pylab_helpers
    89
    910import re
     
    8687        return None
    8788
     89    @asaplog_post_dec
    8890    def _reload_plotter(self):
    8991        if self._plotter is not None:
    90             if  not self._plotter.is_dead:
    91                 # clear lines and axes
    92                 self._plotter.clear()
     92            #if not self._plotter.is_dead:
     93            #    # clear lines and axes
     94            #    try:
     95            #        self._plotter.clear()
     96            #    except: # Can't remove when already killed.
     97            #        pass
    9398            if self.casabar_exists():
    9499                del self._plotter.figmgr.casabar
    95100            self._plotter.quit()
    96101            del self._plotter
     102        asaplog.push('Loading new plotter')
    97103        self._plotter = new_asaplot(self._visible,**self._inikwg)
    98104        self._plotter.figmgr.casabar=self._new_custombar()
     
    134140                       when plot window is not alive.
    135141        """
    136         if self._plotter and not self._plotter.is_dead:
     142        isAlive = (self._plotter != None and not self._plotter.is_dead)
     143        # More tests
     144        if isAlive:
     145            if self._plotter.figmgr:
     146                figmgr = self._plotter.figmgr
     147                figid = figmgr.num
     148                # Make sure figid=0 is what asapplotter expects.
     149                # It might be already destroied/overridden by matplotlib
     150                # commands or other plotting methods using asaplot.
     151                isAlive = _pylab_helpers.Gcf.has_fignum(figid) and \
     152                          (figmgr == \
     153                           _pylab_helpers.Gcf.get_fig_manager(figid))
     154            else:
     155                isAlive = False
     156           
     157        if isAlive:
    137158            return True
    138159        # Plotter is not alive.
  • trunk/python/scantable.py

    r2480 r2535  
    22652265            from asap.asapplotter import new_asaplot
    22662266            theplot = new_asaplot(rcParams['plotter.gui'])
     2267            from matplotlib import rc as rcp
     2268            rcp('lines', linewidth=1)
    22672269            theplot.set_panels()
    22682270            ylab=s._get_ordinate_label()
     
    23362338#             from asap.asapplotter import new_asaplot
    23372339#             theplot = new_asaplot(rcParams['plotter.gui'])
     2340#             from matplotlib import rc as rcp
     2341#             rcp('lines', linewidth=1)
    23382342#             theplot.set_panels()
    23392343#             ylab=s._get_ordinate_label()
Note: See TracChangeset for help on using the changeset viewer.