Changeset 1861


Ignore:
Timestamp:
08/05/10 16:07:30 (14 years ago)
Author:
Malte Marquarding
Message:

Got rid of redundant print_log. Use asaplog.post directly.

Location:
trunk/python
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/python/__init__.py

    r1859 r1861  
    3939        plotter = asapplotter(gui)
    4040    except ImportError:
    41         asaplog.post( "Matplotlib not installed. No plotting available")
    42         print_log('WARN')
     41        asaplog.push( "Matplotlib not installed. No plotting available")
     42        asaplog.post('WARN')
    4343
    4444from selector import selector
  • trunk/python/asapfitter.py

    r1859 r1861  
    11import _asap
    22from asap.parameters import rcParams
    3 from asap.logging import asaplog, print_log, print_log_dec
     3from asap.logging import asaplog, print_log_dec
    44from asap.utils import _n_bools, mask_and
    55
     
    99    The fitting class for ASAP.
    1010    """
    11 
    1211    def __init__(self):
    1312        """
  • trunk/python/asaplotbase.py

    r1836 r1861  
    1414
    1515from asap.parameters import rcParams as asaprcParams
    16 from asap.logging import asaplog, print_log
     16from asap.logging import asaplog
    1717
    1818# API change in mpl >= 0.98
     
    2525    #print "Warning: matplotlib version < 0.87. This might cause errors. Please upgrade."
    2626    asaplog.push( "matplotlib version < 0.99. This might cause errors. Please upgrade." )
    27     print_log( 'WARN' )
     27    asaplog.post( 'WARN' )
    2828
    2929class asaplotbase:
     
    456456            except IOError, msg:
    457457                #print 'Failed to save %s: Error msg was\n\n%s' % (fname, err)
    458                 print_log()
     458                asaplog.post()
    459459                asaplog.push('Failed to save %s: Error msg was\n\n%s' % (fname, str(msg)))
    460                 print_log( 'ERROR' )
     460                asaplog.post( 'ERROR' )
    461461                return
    462462        else:
     
    465465            asaplog.push( "Invalid image type. Valid types are:" )
    466466            asaplog.push( "'ps', 'eps', 'png'" )
    467             print_log('WARN')
     467            asaplog.post('WARN')
    468468
    469469
  • trunk/python/asapmath.py

    r1859 r1861  
    11from asap.scantable import scantable
    22from asap.parameters import rcParams
    3 from asap.logging import asaplog, print_log, print_log_dec
     3from asap.logging import asaplog, print_log_dec
    44from asap.selector import selector
    55from asap import asaplotgui
     
    307307        del sel
    308308        # plot
    309         print_log()
     309        asaplog.post()
    310310        asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.')
    311         print_log('WARN')
     311        asaplog.post('WARN')
    312312        p=asaplotgui.asaplotgui()
    313313        #nr=min(6,len(ifnos)*len(polnos))
     
    336336                btics.append(b)
    337337        else:
    338             print_log()
     338            asaplog.post()
    339339            asaplog.push('Only first 6 [if,pol] pairs are plotted.')
    340             print_log('WARN')
     340            asaplog.post('WARN')
    341341            nr=6
    342342            for i in range(2*nr):
     
    525525        del sel
    526526        # plot
    527         print_log()
     527        asaplog.post()
    528528        asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.')
    529         print_log('WARN')
     529        asaplog.post('WARN')
    530530        p=asaplotgui.asaplotgui()
    531531        #nr=min(6,len(ifnos)*len(polnos))
     
    554554                btics.append(b)
    555555        else:
    556             print_log()
     556            asaplog.post()
    557557            asaplog.push('Only first 6 [if,pol] pairs are plotted.')
    558             print_log('WARN')
     558            asaplog.post('WARN')
    559559            nr=6
    560560            for i in range(2*nr):
     
    736736        del sel
    737737        # plot
    738         print_log()
     738        asaplog.post()
    739739        asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.')
    740         print_log('WARN')
     740        asaplog.post('WARN')
    741741        p=asaplotgui.asaplotgui()
    742742        #nr=min(6,len(ifnos)*len(polnos))
     
    745745        btics=[]
    746746        if nr>3:
    747             print_log()
     747            asaplog.post()
    748748            asaplog.push('Only first 3 [if,pol] pairs are plotted.')
    749             print_log('WARN')
     749            asaplog.post('WARN')
    750750            nr=3
    751751        p.set_panels(rows=nr,cols=3,nplots=3*nr,ganged=False)
  • trunk/python/asapplotter.py

    r1859 r1861  
    22from asap.selector import selector
    33from asap.scantable import scantable
    4 from asap.logging import asaplog, print_log, print_log_dec
     4from asap.logging import asaplog, print_log_dec
    55import matplotlib.axes
    66from matplotlib.font_manager import FontProperties
     
    834834                  "Selecting first %d selections..." % (maxn, maxn)
    835835            asaplog.push(msg)
    836             print_log('WARN')
     836            asaplog.post('WARN')
    837837            n = min(n,maxpanel)
    838838            nstack = min(nstack,maxstack)
  • trunk/python/logging.py

    r1859 r1861  
    11"""This module presents a logging abstraction layer on top of casa.
    22"""
    3 __all__ = ["asaplog", "print_log", "print_log_dec", "AsapLogger"]
     3__all__ = ["asaplog", "print_log_dec", "AsapLogger"]
    44
     5import inspect
    56from asap.env import is_casapy
    67from asap.parameters import rcParams
     
    3132            set_global_sink(self.logger)
    3233
    33     def post(self, level, origin=""):
     34    def post(self, level='INFO', origin=""):
    3435        """Post the messages to the logger. This will clear the buffered
    3536        logs.
     
    4344            return
    4445
     46        if not origin:
     47            origin = inspect.getframeinfo(inspect.currentframe().f_back)[2]
    4548        logs = self._log.strip()
    4649        if len(logs) > 0:
     
    108111                raise
    109112        finally:
    110             print_log(level, f.func_name)
     113            asaplog.post(level, f.func_name)
     114            #asaplog.post(level, ".".join([f.__module__,f.func_name]))
    111115    return wrap_it
    112116
    113 def print_log(level='INFO', origin=""):
    114     """Alias for asaplog.post(level)"""
    115     asaplog.post(level, origin)
  • trunk/python/parameters.py

    r1860 r1861  
    177177            print ('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
    178178            #asaplog.push('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname))
    179             #print_log('WARN')
     179            #asaplog.post('WARN')
    180180            continue
    181181
     
    185185            print ('Bad key "%s" on line %d in %s' % (key, cnt, fname))
    186186            #asaplog.push('Bad key "%s" on line %d in %s' % (key, cnt, fname))
    187             #print_log('WARN')
     187            #asaplog.post('WARN')
    188188            continue
    189189
     
    197197            print ('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, msg))
    198198            #asaplog.push('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, str(msg)))
    199             #print_log('WARN')
     199            #asaplog.post('WARN')
    200200            continue
    201201        else:
  • trunk/python/scantable.py

    r1859 r1861  
    1111from asap._asap import filler
    1212from asap.parameters import rcParams
    13 from asap.logging import asaplog, print_log, print_log_dec
     13from asap.logging import asaplog, print_log_dec
    1414from asap.selector import selector
    1515from asap.linecatalog import linecatalog
     
    8888            asaplog.push("Antenna selection currently unsupported."
    8989                         "Using '0'")
    90             print_log('WARN')
     90            asaplog.post('WARN')
    9191        if antenna is None:
    9292            antenna = ''
     
    660660        asaplog.push(sep)
    661661        asaplog.push(out)
    662         print_log()
     662        asaplog.post()
    663663        return outvec
    664664
     
    25232523            del r, tbl
    25242524            first = False
     2525            #flush log
     2526        asaplog.post()
    25252527        if unit is not None:
    25262528            self.set_fluxunit(unit)
Note: See TracChangeset for help on using the changeset viewer.