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/asapfitter.py

    r1603 r1612  
    44from asap import _n_bools
    55from asap import mask_and
     6from taskinit import *
    67
    78class fitter:
     
    5960            msg = "Please give a correct scan"
    6061            if rcParams['verbose']:
    61                 print msg
     62                #print msg
     63                casalog.post( msg, 'WARN' )
    6264                return
    6365            else:
     
    105107            msg = "Invalid function type."
    106108            if rcParams['verbose']:
    107                 print msg
     109                #print msg
     110                casalog.post( msg, 'WARN' )
    108111                return
    109112            else:
     
    134137            msg = "Fitter not yet initialised. Please set data & fit function"
    135138            if rcParams['verbose']:
    136                 print msg
     139                #print msg
     140                casalog.post( msg, 'WARN' )
    137141                return
    138142            else:
     
    170174        except RuntimeError, msg:
    171175            if rcParams['verbose']:
    172                 print msg
     176                #print msg
     177                casalog.post( msg, 'WARN' )
    173178            else:
    174179                raise
     
    228233            msg = "Please specify a fitting function first."
    229234            if rcParams['verbose']:
    230                 print msg
     235                #print msg
     236                casalog.post( msg, 'WARN' )
    231237                return
    232238            else:
     
    270276            msg = "Function only operates on Gaussian components."
    271277            if rcParams['verbose']:
    272                 print msg
     278                #print msg
     279                casalog.post( msg, 'WARN' )
    273280                return
    274281            else:
     
    281288            msg = "Please select a valid  component."
    282289            if rcParams['verbose']:
    283                 print msg
     290                #print msg
     291                casalog.post( msg, 'WARN' )
    284292                return
    285293            else:
     
    322330            msg = "Not yet fitted."
    323331            if rcParams['verbose']:
    324                 print msg
     332                #print msg
     333                casalog.post( msg, 'WARN' )
    325334                return
    326335            else:
     
    345354            msg = "Not yet fitted."
    346355            if rcParams['verbose']:
    347                 print msg
     356                #print msg
     357                casalog.post( msg, 'WARN' )
    348358                return
    349359            else:
     
    375385        fpars = self._format_pars(cpars, cfixed, errors and cerrs, area)
    376386        if rcParams['verbose']:
    377             print fpars
     387            #print fpars
     388            casalog.post( fpars )
    378389        return {'params':cpars, 'fixed':cfixed, 'formatted': fpars,
    379390                'errors':cerrs}
     
    416427        fixed = self.fitter.getfixedparameters()
    417428        if rcParams['verbose']:
    418             print self._format_pars(pars,fixed,None)
     429            #print self._format_pars(pars,fixed,None)
     430            casalog.post( self._format_pars(pars,fixed,None) )
    419431        return pars
    420432
     
    426438            msg = "Not yet fitted."
    427439            if rcParams['verbose']:
    428                 print msg
     440                #print msg
     441                casalog.post( msg, 'WARN' )
    429442                return
    430443            else:
     
    439452            msg = "Not yet fitted."
    440453            if rcParams['verbose']:
    441                 print msg
     454                #print msg
     455                casalog.post( msg, 'WARN' )
    442456                return
    443457            else:
     
    445459        ch2 = self.fitter.getchi2()
    446460        if rcParams['verbose']:
    447             print 'Chi^2 = %3.3f' % (ch2)
     461            #print 'Chi^2 = %3.3f' % (ch2)
     462            casalog.post( 'Chi^2 = %3.3f' % (ch2) )
    448463        return ch2
    449464
     
    455470            msg = "Not yet fitted."
    456471            if rcParams['verbose']:
    457                 print msg
     472                #print msg
     473                casalog.post( msg, 'WARN' )
    458474                return
    459475            else:
     
    468484            msg = "Not yet fitted."
    469485            if rcParams['verbose']:
    470                 print msg
     486                #print msg
     487                casalog.post( msg, 'WARN' )
    471488                return
    472489            else:
     
    476493            msg = "Not a scantable"
    477494            if rcParams['verbose']:
    478                 print msg
     495                #print msg
     496                casalog.post( msg, 'WARN' )
    479497                return
    480498            else:
     
    594612            msg = "Data is not a scantable"
    595613            if rcParams['verbose']:
    596                 print msg
     614                #print msg
     615                casalog.post( msg, 'WARN' )
    597616                return
    598617            else:
Note: See TracChangeset for help on using the changeset viewer.