Ignore:
Timestamp:
08/05/10 14:40:38 (14 years ago)
Author:
Malte Marquarding
Message:

Ticket #193: the rcParamsverbose? flag is only used in standard asap cli mode. Otherwise log messages are always send to the logger and one needs to call asaplog.disable()/asaplog.enable() to controls this. I have also added the function name as the log origin.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/asapplotter.py

    r1858 r1859  
    102102        if not self._data and not scan:
    103103            msg = "Input is not a scantable"
    104             if rcParams['verbose']:
    105                 #print msg
    106                 asaplog.push( msg )
    107                 print_log( 'ERROR' )
    108                 return
    109104            raise TypeError(msg)
    110105        if scan: self.set_data(scan,refresh=False)
     
    277272    # end matplotlib.axes fowarding functions
    278273
     274    @print_log_dec
    279275    def set_data(self, scan, refresh=True):
    280276        """
     
    299295                    msg = "A new scantable is set to the plotter. The masks and data selections are reset."
    300296                    asaplog.push( msg )
    301                     print_log( 'INFO' )
    302297            else:
    303298                self._data = scan
     
    305300        else:
    306301            msg = "Input is not a scantable"
    307             if rcParams['verbose']:
    308                 #print msg
    309                 asaplog.push( msg )
    310                 print_log( 'ERROR' )
    311                 return
    312302            raise TypeError(msg)
    313303
     
    320310        if refresh: self.plot()
    321311
    322 
     312    @print_log_dec
    323313    def set_mode(self, stacking=None, panelling=None, refresh=True):
    324314        """
     
    343333        if not self.set_panelling(panelling) or \
    344334               not self.set_stacking(stacking):
    345             if rcParams['verbose']:
    346                 #print msg
    347                 asaplog.push( msg )
    348                 print_log( 'ERROR' )
    349                 return
    350             else:
    351                 raise TypeError(msg)
     335            raise TypeError(msg)
    352336        if refresh and self._data: self.plot(self._data)
    353337        return
     
    745729        return
    746730
    747 
     731    @print_log_dec
    748732    def set_mask(self, mask=None, selection=None, refresh=True):
    749733        """
     
    763747        if not self._data:
    764748            msg = "Can only set mask after a first call to plot()"
    765             if rcParams['verbose']:
    766                 #print msg
    767                 asaplog.push( msg )
    768                 print_log( 'ERROR' )
    769                 return
    770             else:
    771                 raise RuntimeError(msg)
     749            raise RuntimeError(msg)
    772750        if len(mask):
    773751            if isinstance(mask, list) or isinstance(mask, tuple):
     
    11711149    # plot total power data
    11721150    # plotting in time is not yet implemented..
     1151    @print_log_dec
    11731152    def plottp(self, scan=None, outfile=None):
    11741153        if self._plotter.is_dead:
     
    11821161        if not self._data and not scan:
    11831162            msg = "Input is not a scantable"
    1184             if rcParams['verbose']:
    1185                 #print msg
    1186                 asaplog.push( msg )
    1187                 print_log( 'ERROR' )
    1188                 return
    11891163            raise TypeError(msg)
    11901164        if isinstance(scan, scantable):
     
    12161190        self._plotter.tidy()
    12171191        self._plotter.show(hardrefresh=False)
    1218         print_log()
    12191192        return
    12201193
     
    12771250
    12781251    # printing header information
     1252    @print_log_dec
    12791253    def print_header(self, plot=True, fontsize=9, logger=False, selstr='', extrastr=''):
    12801254        """
     
    12881262            extrastr:  additional string to print (not verified)
    12891263        """
    1290         if not plot and not logger: return
    1291         if not self._data: raise RuntimeError("No scantable has been set yet.")
     1264        if not plot and not logger:
     1265            return
     1266        if not self._data:
     1267            raise RuntimeError("No scantable has been set yet.")
    12921268        # Now header will be printed on plot and/or logger.
    12931269        # Get header information and format it.
     
    13221298            asaplog.push(extrastr)
    13231299            asaplog.push(ssum[ssum.find('Beams:'):])
    1324             print_log()
    13251300        del ssum
Note: See TracChangeset for help on using the changeset viewer.