Changeset 1861
- Timestamp:
- 08/05/10 16:07:30 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/__init__.py
r1859 r1861 39 39 plotter = asapplotter(gui) 40 40 except ImportError: 41 asaplog.p ost( "Matplotlib not installed. No plotting available")42 print_log('WARN')41 asaplog.push( "Matplotlib not installed. No plotting available") 42 asaplog.post('WARN') 43 43 44 44 from selector import selector -
trunk/python/asapfitter.py
r1859 r1861 1 1 import _asap 2 2 from asap.parameters import rcParams 3 from asap.logging import asaplog, print_log , print_log_dec3 from asap.logging import asaplog, print_log_dec 4 4 from asap.utils import _n_bools, mask_and 5 5 … … 9 9 The fitting class for ASAP. 10 10 """ 11 12 11 def __init__(self): 13 12 """ -
trunk/python/asaplotbase.py
r1836 r1861 14 14 15 15 from asap.parameters import rcParams as asaprcParams 16 from asap.logging import asaplog , print_log16 from asap.logging import asaplog 17 17 18 18 # API change in mpl >= 0.98 … … 25 25 #print "Warning: matplotlib version < 0.87. This might cause errors. Please upgrade." 26 26 asaplog.push( "matplotlib version < 0.99. This might cause errors. Please upgrade." ) 27 print_log( 'WARN' )27 asaplog.post( 'WARN' ) 28 28 29 29 class asaplotbase: … … 456 456 except IOError, msg: 457 457 #print 'Failed to save %s: Error msg was\n\n%s' % (fname, err) 458 print_log()458 asaplog.post() 459 459 asaplog.push('Failed to save %s: Error msg was\n\n%s' % (fname, str(msg))) 460 print_log( 'ERROR' )460 asaplog.post( 'ERROR' ) 461 461 return 462 462 else: … … 465 465 asaplog.push( "Invalid image type. Valid types are:" ) 466 466 asaplog.push( "'ps', 'eps', 'png'" ) 467 print_log('WARN')467 asaplog.post('WARN') 468 468 469 469 -
trunk/python/asapmath.py
r1859 r1861 1 1 from asap.scantable import scantable 2 2 from asap.parameters import rcParams 3 from asap.logging import asaplog, print_log , print_log_dec3 from asap.logging import asaplog, print_log_dec 4 4 from asap.selector import selector 5 5 from asap import asaplotgui … … 307 307 del sel 308 308 # plot 309 print_log()309 asaplog.post() 310 310 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 311 print_log('WARN')311 asaplog.post('WARN') 312 312 p=asaplotgui.asaplotgui() 313 313 #nr=min(6,len(ifnos)*len(polnos)) … … 336 336 btics.append(b) 337 337 else: 338 print_log()338 asaplog.post() 339 339 asaplog.push('Only first 6 [if,pol] pairs are plotted.') 340 print_log('WARN')340 asaplog.post('WARN') 341 341 nr=6 342 342 for i in range(2*nr): … … 525 525 del sel 526 526 # plot 527 print_log()527 asaplog.post() 528 528 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 529 print_log('WARN')529 asaplog.post('WARN') 530 530 p=asaplotgui.asaplotgui() 531 531 #nr=min(6,len(ifnos)*len(polnos)) … … 554 554 btics.append(b) 555 555 else: 556 print_log()556 asaplog.post() 557 557 asaplog.push('Only first 6 [if,pol] pairs are plotted.') 558 print_log('WARN')558 asaplog.post('WARN') 559 559 nr=6 560 560 for i in range(2*nr): … … 736 736 del sel 737 737 # plot 738 print_log()738 asaplog.post() 739 739 asaplog.push('Plot only first spectrum for each [if,pol] pairs to verify calibration.') 740 print_log('WARN')740 asaplog.post('WARN') 741 741 p=asaplotgui.asaplotgui() 742 742 #nr=min(6,len(ifnos)*len(polnos)) … … 745 745 btics=[] 746 746 if nr>3: 747 print_log()747 asaplog.post() 748 748 asaplog.push('Only first 3 [if,pol] pairs are plotted.') 749 print_log('WARN')749 asaplog.post('WARN') 750 750 nr=3 751 751 p.set_panels(rows=nr,cols=3,nplots=3*nr,ganged=False) -
trunk/python/asapplotter.py
r1859 r1861 2 2 from asap.selector import selector 3 3 from asap.scantable import scantable 4 from asap.logging import asaplog, print_log , print_log_dec4 from asap.logging import asaplog, print_log_dec 5 5 import matplotlib.axes 6 6 from matplotlib.font_manager import FontProperties … … 834 834 "Selecting first %d selections..." % (maxn, maxn) 835 835 asaplog.push(msg) 836 print_log('WARN')836 asaplog.post('WARN') 837 837 n = min(n,maxpanel) 838 838 nstack = min(nstack,maxstack) -
trunk/python/logging.py
r1859 r1861 1 1 """This module presents a logging abstraction layer on top of casa. 2 2 """ 3 __all__ = ["asaplog", "print_log ", "print_log_dec", "AsapLogger"]3 __all__ = ["asaplog", "print_log_dec", "AsapLogger"] 4 4 5 import inspect 5 6 from asap.env import is_casapy 6 7 from asap.parameters import rcParams … … 31 32 set_global_sink(self.logger) 32 33 33 def post(self, level , origin=""):34 def post(self, level='INFO', origin=""): 34 35 """Post the messages to the logger. This will clear the buffered 35 36 logs. … … 43 44 return 44 45 46 if not origin: 47 origin = inspect.getframeinfo(inspect.currentframe().f_back)[2] 45 48 logs = self._log.strip() 46 49 if len(logs) > 0: … … 108 111 raise 109 112 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])) 111 115 return wrap_it 112 116 113 def print_log(level='INFO', origin=""):114 """Alias for asaplog.post(level)"""115 asaplog.post(level, origin) -
trunk/python/parameters.py
r1860 r1861 177 177 print ('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname)) 178 178 #asaplog.push('Illegal line #%d\n\t%s\n\tin file "%s"' % (cnt, line, fname)) 179 # print_log('WARN')179 #asaplog.post('WARN') 180 180 continue 181 181 … … 185 185 print ('Bad key "%s" on line %d in %s' % (key, cnt, fname)) 186 186 #asaplog.push('Bad key "%s" on line %d in %s' % (key, cnt, fname)) 187 # print_log('WARN')187 #asaplog.post('WARN') 188 188 continue 189 189 … … 197 197 print ('Bad val "%s" on line #%d\n\t"%s"\n\tin file "%s"\n\t%s' % (val, cnt, line, fname, msg)) 198 198 #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') 200 200 continue 201 201 else: -
trunk/python/scantable.py
r1859 r1861 11 11 from asap._asap import filler 12 12 from asap.parameters import rcParams 13 from asap.logging import asaplog, print_log , print_log_dec13 from asap.logging import asaplog, print_log_dec 14 14 from asap.selector import selector 15 15 from asap.linecatalog import linecatalog … … 88 88 asaplog.push("Antenna selection currently unsupported." 89 89 "Using '0'") 90 print_log('WARN')90 asaplog.post('WARN') 91 91 if antenna is None: 92 92 antenna = '' … … 660 660 asaplog.push(sep) 661 661 asaplog.push(out) 662 print_log()662 asaplog.post() 663 663 return outvec 664 664 … … 2523 2523 del r, tbl 2524 2524 first = False 2525 #flush log 2526 asaplog.post() 2525 2527 if unit is not None: 2526 2528 self.set_fluxunit(unit)
Note:
See TracChangeset
for help on using the changeset viewer.