Ignore:
Timestamp:
08/06/09 15:48:39 (15 years ago)
Author:
Takeshi Nakazato
Message:

New Development: No

JIRA Issue: Yes CAS-729, CAS-1147

Ready to Release: Yes

Interface Changes: No

What Interface Changed: Please list interface changes

Test Programs: List test programs

Put in Release Notes: No

Module(s): Module Names change impacts.

Description: Describe your changes here...

  1. Added level parameter to print_log()
  2. Replaced casalog.post() to asaplog.push() + print_log().


File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/alma/python/scantable.py

    r1613 r1614  
    66from asap import linecatalog
    77from asap import _n_bools, mask_not, mask_and, mask_or
    8 from taskinit import *
    98
    109class scantable(Scantable):
     
    5756                        asaplog.push(s)
    5857                        #print asaplog.pop().strip()
    59                         print_log()
     58                        print_log('ERROR')
    6059                        return
    6160                    raise IOError(s)
     
    7574                        if rcParams['verbose']:
    7675                            #print msg
    77                             casalog.post( msg, 'WARN' )
     76                            asaplog.push( msg )
     77                            print_log( 'ERROR' )
    7878                            return
    7979                        else:
     
    124124                if rcParams['verbose']:
    125125                    #print msg
    126                     casalog.post( msg, 'WARN' )
     126                    asaplog.push( msg )
     127                    print_log( 'ERROR' )
    127128                    return
    128129                else:
     
    164165            if rcParams['verbose']:
    165166                #print "Please specify a scanno to drop from the scantable"
    166                 casalog.post( "Please specify a scanno to drop from the scantable", 'WARN' )
     167                asaplog.push( 'Please specify a scanno to drop from the scantable' )
     168                print_log( 'ERROR' )
    167169                return
    168170            else:
     
    177179            if rcParams['verbose']:
    178180                #print "Couldn't find any match."
    179                 casalog.post( "Couldn't find any match.", 'WARN' )
     181                print_log()
     182                asaplog.push( "Couldn't find any match." )
     183                print_log( 'ERROR' )
    180184                return
    181185            else: raise
     
    191195            if rcParams['verbose']:
    192196                #print "Couldn't find any match."
    193                 casalog.post( "Couldn't find any match.", 'WARN' )
     197                print_log()
     198                asaplog.push( "Couldn't find any match." )
     199                print_log( 'ERROR' )
    194200            else:
    195201                raise
     
    218224                #print "Please specify a scan no or name to " \
    219225                #      "retrieve from the scantable"
    220                 casalog.post( "Please specify a scan no or name to retrieve from the scantable", 'WARN' )
     226                asaplog.push( 'Please specify a scan no or name to retrieve from the scantable' )
     227                print_log( 'ERROR' )
    221228                return
    222229            else:
     
    248255                if rcParams['verbose']:
    249256                    #print msg
    250                     casalog.post( msg, 'WARN' )
     257                    asaplog.push( msg )
     258                    print_log( 'ERROR' )
    251259                else:
    252260                    raise TypeError(msg)
     
    254262            if rcParams['verbose']:
    255263                #print "Couldn't find any match."
    256                 casalog.post( "Couldn't find any match.", 'WARN' )
     264                print_log()
     265                asaplog.push( "Couldn't find any match." )
     266                print_log( 'ERROR' )
    257267            else: raise
    258268
     
    284294                if rcParams['verbose']:
    285295                    #print msg
    286                     casalog.post( msg, 'WARN' )
     296                    asaplog.push( msg )
     297                    print_log( 'ERROR' )
    287298                else:
    288299                    raise IOError(msg)
     
    454465            f.close()
    455466            for xx in x:
    456                 casalog.post( xx )
     467                asaplog.push( xx )
     468            print_log()
    457469        #else:
    458470            #retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'],
     
    534546            out +=  "--------------------------------------------------\n"
    535547        if rcParams['verbose']:
    536             #print "--------------------------------------------------"
    537             #print " %s" % (label)
    538             #print "--------------------------------------------------"
    539             #print out
    540             casalog.post( "--------------------------------------------------" )
    541             casalog.post( " %s" % (label) )
    542             casalog.post( "--------------------------------------------------" )
    543             casalog.post( out )
     548            usr=os.environ['USER']
     549            tmpfile='/tmp/tmp_'+usr+'_casapy_asap_scantable_row_callback'
     550            f=open(tmpfile,'w')
     551            print >> f, "--------------------------------------------------"
     552            print >> f, " %s" % (label)
     553            print >> f, "--------------------------------------------------"
     554            print >> f, out
     555            f.close()
     556            f=open(tmpfile,'r')
     557            x=f.readlines()
     558            f.close()
     559            for xx in x:
     560                asaplog.push( xx )
     561            print_log()
    544562        # disabled because the vector seems more useful
    545563        #retval = {'axesnames': axesnames, 'axes': axes, 'data': outvec}
     
    729747            if rcParams['verbose']:
    730748                #print msg
    731                 casalog.post( msg, 'WARN' )
     749                asaplog.push( msg )
     750                print_log( 'ERROR' )
    732751            else:
    733752                raise TypeError(msg)
     
    749768            if rcParams['verbose']:
    750769                #print msg
    751                 casalog.post( msg, 'WARN' )
     770                print_log()
     771                asaplog.push( msg )
     772                print_log( 'ERROR' )
    752773            else:
    753774                raise
     
    796817            if rcParams['verbose']:
    797818                #print msg
    798                 casalog.post( msg, 'WARN' )
     819                print_log()
     820                asaplog.push( msg )
     821                print_log( 'ERROR' )
    799822                return
    800823            else: raise
     
    828851            if rcParams['verbose']:
    829852                #print msg
    830                 casalog.post( msg, 'WARN' )
     853                print_log()
     854                asaplog.push( msg )
     855                print_log( 'ERROR' )
    831856                return
    832857            else: raise
     
    11481173                if rcParams['verbose']:
    11491174                    #print msg
    1150                     casalog.post( msg, 'WARN' )
     1175                    asaplog.push( msg )
     1176                    print_log( 'ERROR' )
    11511177                else:
    11521178                    raise IOError(msg)
     
    12071233            if rcParams['verbose']:
    12081234                #print msg
    1209                 casalog.post( msg, 'WARN' )
     1235                print_log()
     1236                asaplog.push( msg )
     1237                print_log( 'ERROR' )
    12101238                return
    12111239            else: raise
     
    14321460            if rcParams['verbose']:
    14331461                #print msg
    1434                 casalog.post( msg, 'WARN' )
     1462                print_log()
     1463                asaplog.push( msg )
     1464                print_log( 'ERROR' )
    14351465                return
    14361466            else:
     
    15101540            if rcParams['verbose']:
    15111541                #print msg
    1512                 casalog.post( msg, 'WARN' )
     1542                print_log()
     1543                asaplog.push( msg )
     1544                print_log( 'ERROR' )
    15131545                return
    15141546            else:
     
    19561988        if rcParams['verbose']:
    19571989            #print fit
    1958             casalog.post( '%s' %(fit) )
     1990            asaplog.push( '%s' %(fit) )
     1991            print_log()
    19591992            return
    19601993        else:
     
    20642097                    asaplog.push(msg)
    20652098                    #print asaplog.pop().strip()
    2066                     casalog.post( asaplog.pop().strip(), 'WARN' )
     2099                    print_log( 'ERROR' )
    20672100                    return
    20682101                raise IOError(msg)
Note: See TracChangeset for help on using the changeset viewer.