Ignore:
Timestamp:
08/05/09 17:48:43 (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: Yes

Module(s): Module Names change impacts.

Description: Describe your changes here...

I have changed that almost all log messages are output to casapy.log,
not to the terminal window. After this change, asap becomes to depend on casapy
and is not running in standalone, because asap have to import taskinit module
to access casalogger.


File:
1 edited

Legend:

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

    r1603 r1612  
    66from asap import linecatalog
    77from asap import _n_bools, mask_not, mask_and, mask_or
     8from taskinit import *
    89
    910class scantable(Scantable):
     
    5556                    if rcParams['verbose']:
    5657                        asaplog.push(s)
    57                         print asaplog.pop().strip()
     58                        #print asaplog.pop().strip()
     59                        print_log()
    5860                        return
    5961                    raise IOError(s)
     
    7274                              "asap table." % (filename)
    7375                        if rcParams['verbose']:
    74                             print msg
     76                            #print msg
     77                            casalog.post( msg, 'WARN' )
    7578                            return
    7679                        else:
     
    120123                msg = "File %s exists." % name
    121124                if rcParams['verbose']:
    122                     print msg
     125                    #print msg
     126                    casalog.post( msg, 'WARN' )
    123127                    return
    124128                else:
     
    159163        if not _is_valid(scanid):
    160164            if rcParams['verbose']:
    161                 print "Please specify a scanno to drop from the scantable"
     165                #print "Please specify a scanno to drop from the scantable"
     166                casalog.post( "Please specify a scanno to drop from the scantable", 'WARN' )
    162167                return
    163168            else:
     
    171176        except ValueError:
    172177            if rcParams['verbose']:
    173                 print "Couldn't find any match."
     178                #print "Couldn't find any match."
     179                casalog.post( "Couldn't find any match.", 'WARN' )
    174180                return
    175181            else: raise
     
    184190        except RuntimeError:
    185191            if rcParams['verbose']:
    186                 print "Couldn't find any match."
     192                #print "Couldn't find any match."
     193                casalog.post( "Couldn't find any match.", 'WARN' )
    187194            else:
    188195                raise
     
    209216        if scanid is None:
    210217            if rcParams['verbose']:
    211                 print "Please specify a scan no or name to " \
    212                       "retrieve from the scantable"
     218                #print "Please specify a scan no or name to " \
     219                #      "retrieve from the scantable"
     220                casalog.post( "Please specify a scan no or name to retrieve from the scantable", 'WARN' )
    213221                return
    214222            else:
     
    239247                msg = "Illegal scanid type, use 'int' or 'list' if ints."
    240248                if rcParams['verbose']:
    241                     print msg
     249                    #print msg
     250                    casalog.post( msg, 'WARN' )
    242251                else:
    243252                    raise TypeError(msg)
    244253        except RuntimeError:
    245             if rcParams['verbose']: print "Couldn't find any match."
     254            if rcParams['verbose']:
     255                #print "Couldn't find any match."
     256                casalog.post( "Couldn't find any match.", 'WARN' )
    246257            else: raise
    247258
     
    272283                msg = "Illegal file name '%s'." % (filename)
    273284                if rcParams['verbose']:
    274                     print msg
     285                    #print msg
     286                    casalog.post( msg, 'WARN' )
    275287                else:
    276288                    raise IOError(msg)
     
    430442
    431443        if rcParams['verbose']:
    432             print "--------------------------------------------------"
    433             print " ", stat, statunit
    434             print "--------------------------------------------------"
    435             print out
     444            tmpfile='/tmp/tmp_casapy_asap_scantable_stats'
     445            f=open(tmpfile,'w')
     446            print >> f, "--------------------------------------------------"
     447            print >> f, " ", stat, statunit
     448            print >> f, "--------------------------------------------------"
     449            print >> f, out
     450            f.close()
     451            f=open(tmpfile,'r')
     452            x=f.readlines()
     453            f.close()
     454            for xx in x:
     455                casalog.post( xx )
    436456        #else:
    437457            #retval = { 'axesnames': ['scanno', 'beamno', 'ifno', 'polno', 'cycleno'],
     
    513533            out +=  "--------------------------------------------------\n"
    514534        if rcParams['verbose']:
    515             print "--------------------------------------------------"
    516             print " %s" % (label)
    517             print "--------------------------------------------------"
    518             print out
     535            #print "--------------------------------------------------"
     536            #print " %s" % (label)
     537            #print "--------------------------------------------------"
     538            #print out
     539            casalog.post( "--------------------------------------------------" )
     540            casalog.post( " %s" % (label) )
     541            casalog.post( "--------------------------------------------------" )
     542            casalog.post( out )
    519543        # disabled because the vector seems more useful
    520544        #retval = {'axesnames': axesnames, 'axes': axes, 'data': outvec}
     
    703727            msg  = "Please specify a valid freq type. Valid types are:\n", valid
    704728            if rcParams['verbose']:
    705                 print msg
     729                #print msg
     730                casalog.post( msg, 'WARN' )
    706731            else:
    707732                raise TypeError(msg)
     
    722747        except RuntimeError, msg:
    723748            if rcParams['verbose']:
    724                 print msg
     749                #print msg
     750                casalog.post( msg, 'WARN' )
    725751            else:
    726752                raise
     
    768794        except RuntimeError, msg:
    769795            if rcParams['verbose']:
    770                 print msg
     796                #print msg
     797                casalog.post( msg, 'WARN' )
    771798                return
    772799            else: raise
     
    799826        except RuntimeError, msg:
    800827            if rcParams['verbose']:
    801                 print msg
     828                #print msg
     829                casalog.post( msg, 'WARN' )
    802830                return
    803831            else: raise
     
    11181146                msg = "Illegal file name '%s'." % (filename)
    11191147                if rcParams['verbose']:
    1120                     print msg
     1148                    #print msg
     1149                    casalog.post( msg, 'WARN' )
    11211150                else:
    11221151                    raise IOError(msg)
     
    11761205        except RuntimeError, msg:
    11771206            if rcParams['verbose']:
    1178                 print msg
     1207                #print msg
     1208                casalog.post( msg, 'WARN' )
    11791209                return
    11801210            else: raise
     
    14001430        except RuntimeError, msg:
    14011431            if rcParams['verbose']:
    1402                 print msg
     1432                #print msg
     1433                casalog.post( msg, 'WARN' )
    14031434                return
    14041435            else:
     
    14771508            msg = "The fit failed, possibly because it didn't converge."
    14781509            if rcParams['verbose']:
    1479                 print msg
     1510                #print msg
     1511                casalog.post( msg, 'WARN' )
    14801512                return
    14811513            else:
     
    19221954        fit = asapfit(self._getfit(row))
    19231955        if rcParams['verbose']:
    1924             print fit
     1956            #print fit
     1957            casalog.post( '%s' %(fit) )
    19251958            return
    19261959        else:
     
    20292062                if rcParams['verbose']:
    20302063                    asaplog.push(msg)
    2031                     print asaplog.pop().strip()
     2064                    #print asaplog.pop().strip()
     2065                    casalog.post( asaplog.pop().strip(), 'WARN' )
    20322066                    return
    20332067                raise IOError(msg)
Note: See TracChangeset for help on using the changeset viewer.