Changeset 753


Ignore:
Timestamp:
11/29/05 12:06:57 (18 years ago)
Author:
mar637
Message:

Bug fix: plot_other with panelling==p didn't work with cursor selction. added use of asaplog

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r734 r753  
    1 from asap import rcParams
     1from asap import rcParams, print_log
    22from numarray import logical_and
    33
     
    109109                       (isinstance(self._cursor["t"],list) and \
    110110                        len(self._cursor["t"]) > maxrows ):
    111                     print "Scan to be plotted contains more than %d rows.\n" \
     111                    from asap import asaplog
     112                    msg ="Scan to be plotted contains more than %d rows.\n" \
    112113                          "Selecting first %d rows..." % (maxrows,maxrows)
     114                    asaplog.push(msg)
    113115                    self._cursor["t"] = range(maxrows)
    114116            self._plot_time(self._data[0], self._stacking)
     
    120122            self._plotter.set_limits(ylim=self._minmaxy)
    121123        self._plotter.release()
     124        print_log()
    122125        return
    123126
     
    231234
    232235    def _plot_scans(self, scans, colmode):
    233         print "Plotting mode is scans across panels. Can only plot one row per scan."
     236        from asap import asaplog
     237        msg = "Plotting mode is scans across panels. Can only plot one row per scan."
     238        asaplog.push(msg)
    234239        if colmode == 's':
    235240            return
     
    330335            self._plotter.set_axes('ylabel',ylab)
    331336            self._plotter.set_axes('title',tlab)
     337        print_log()
    332338        return
    333339
     
    367373            if self._panelling == "p":
    368374                polmode = self._polmode[ii]
    369                 eval(cdict.get(self._panelling))
    370             else:
    371                 eval(cdict.get(self._panelling))
     375
     376            eval(cdict.get(self._panelling))
     377
    372378            colvals = eval(cdict2.get(colmode))
    373379            for j in colvals:
     
    393399                    if colmode == 'p':
    394400                        polmode = self._polmode[self._cursor["p"].index(j)]
     401
    395402                    i = j
    396403                    eval(cdict.get(colmode))
    397404                    i = savei
     405                if self._panelling == "p":
     406                    eval(cdict.get(self._panelling))
    398407                x = None
    399408                y = None
     
    485494                 'time' 'Time' 't':     Times
    486495        """
    487         if not self.set_panelling(panelling):
    488             print "Invalid mode"
    489             return
    490         if not self.set_stacking(stacking):
    491             print "Invalid mode"
    492             return
     496        msg = "Invalid mode"
     497        if not self.set_panelling(panelling) or \
     498               not self.set_stacking(stacking):
     499            if rcParams['verbose']:
     500                print msg
     501                return
     502            else:
     503                raise TypeError(msg)
    493504        if self._data: self.plot()
    494505        return
     
    694705        """
    695706        if not self._data:
    696             print "Can only set cursor after a first call to plot()"
    697             return
     707            msg = "Can only set cursor after a first call to plot()"
     708            if rcParams['verbose']:
     709                print msg
     710                return
     711            else:
     712                raise RuntimeError(msg)
    698713
    699714        n = self._data[0].nrow()
     
    703718            for i in row:
    704719                if i < 0 or i >= n:
    705                     print "Row index '%d' out of range" % i
    706                     return
     720                    msg = "Row index '%d' out of range" % i
     721                    if rcParams['verbose']:
     722                        print msg
     723                        return       
     724                    else:
     725                        raise IndexError(msg)
    707726            self._cursor["t"] = row
    708727
     
    713732            for i in beam:
    714733                if i < 0 or  i >= n:
    715                     print "Beam index '%d' out of range" % i
    716                     return
     734                    msg = "Beam index '%d' out of range" % i
     735                    if rcParams['verbose']:
     736                        print msg
     737                        return       
     738                    else:
     739                        raise IndexError(msg)
     740
    717741            self._cursor["b"] = beam
    718742
     
    723747            for i in IF:
    724748                if i < 0 or i >= n:
    725                     print "IF index '%d' out of range" %i
    726                     return
     749                    msg = "IF index '%d' out of range" %i
     750                    if rcParams['verbose']:
     751                        print msg
     752                        return       
     753                    else:
     754                        raise IndexError(msg)
    727755            self._cursor["i"] = IF
    728756
     
    756784                        polmode.append("circular")
    757785                    else:
    758                         print "Pol type '%s' not valid" %i
    759                         return
     786                        msg = "Pol type '%s' not valid" %i
     787                        if rcParams['verbose']:
     788                            print msg
     789                            return       
     790                        else:
     791                            raise TypeError(msg)                       
    760792                elif 0 > i >= n:
    761793                    print "Pol index '%d' out of range" %i
    762                     return
     794                    if rcParams['verbose']:
     795                        print msg
     796                        return       
     797                    else:
     798                        raise IndexError(msg)                   
    763799                else:
    764800                    pols.append(i)
     
    779815        """
    780816        if not self._data:
    781             print "Can only set cursor after a first call to plot()"
    782             return
     817            msg = "Can only set cursor after a first call to plot()"
     818            if rcParams['verbose']:
     819                print msg
     820                return       
     821            else:
     822                raise RuntimeError(msg)                       
    783823        if isinstance(mask, array):
    784824            self._usermask = mask
Note: See TracChangeset for help on using the changeset viewer.