Changeset 1858 for trunk/python
- Timestamp:
- 08/05/10 11:46:40 (14 years ago)
- Location:
- trunk/python
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/python/asapplotter.py
r1824 r1858 14 14 By default the plotter is set up to plot polarisations 15 15 'colour stacked' and scantables across panels. 16 Note: 16 17 .. note:: 18 17 19 Currenly it only plots 'spectra' not Tsys or 18 20 other variables. 21 19 22 """ 20 23 def __init__(self, visible=None , **kwargs): … … 113 116 self._plotter.tidy() 114 117 self._plotter.show(hardrefresh=False) 115 print_log()116 118 return 117 119 … … 352 354 353 355 def set_panelling(self, what=None): 356 """Set the 'panelling' mode i.e. which type of spectra should be 357 spread across different panels. 358 """ 359 354 360 mode = what 355 361 if mode is None: … … 382 388 383 389 def set_stacking(self, what=None): 390 """Set the 'stacking' mode i.e. which type of spectra should be 391 overlayed. 392 """ 384 393 mode = what 385 394 if mode is None: -
trunk/python/env.py
r1848 r1858 1 """This module has various functions for environment specific setings. 2 """ 1 3 __all__ = ["is_casapy", "is_ipython", "setup_env", "get_revision"] 2 4 … … 7 9 8 10 def is_casapy(): 11 """Are we running inside casapy?""" 9 12 try: 10 13 from taskinit import casalog … … 14 17 15 18 def is_ipython(): 19 """Are we running inside IPython?""" 16 20 return 'IPython' in sys.modules.keys() 17 21 18 22 def setup_env(): 23 """Set-up environment variables for casa and initialise ~/.asap on first 24 use. 25 """ 19 26 # Set up CASAPATH and first time use of asap i.e. ~/.asap/* 20 27 plf = None … … 59 66 60 67 def get_revision(): 68 """Get the revision of the software. Only useful within casapy.""" 61 69 if not is_casapy: 62 70 return ' unknown ' -
trunk/python/logging.py
r1833 r1858 1 __all__ = ["asaplog", "print_log", "print_log_dec"] 1 """This module presents a logging abstraction layer on top of casa. 2 """ 3 __all__ = ["asaplog", "print_log", "print_log_dec", "AsapLogger"] 2 4 3 5 from asap.env import is_casapy … … 10 12 11 13 12 class _asaplog(object): 13 """Wrapper object to allow for both casapy and asap logging""" 14 class AsapLogger(object): 15 """Wrapper object to allow for both casapy and asap logging. 16 17 Inside casapy this will connect to `taskinit.casalog`. Otherwise it will 18 create its own casa log sink. 19 20 .. note:: Do instantiate a new one - use the :obj:`asaplog` instead. 21 22 """ 14 23 def __init__(self): 15 24 self._enabled = False … … 25 34 """Post the messages to the logger. This will clear the buffered 26 35 logs. 36 37 Parameters: 38 39 level: The log level (severity). One of INFO, WARN, ERROR. 40 27 41 """ 28 42 if not self._enabled: … … 41 55 42 56 def push(self, msg, newline=True): 43 """Push logs into the buffer. post needs to be called to send them.""" 57 """Push logs into the buffer. post needs to be called to send them. 58 59 Parameters: 60 61 msg: the log message (string) 62 63 newline: should we terminate with a newline (default yes) 64 65 """ 44 66 from asap import rcParams 45 67 if self._enabled: … … 58 80 self._enabled = flag 59 81 60 asaplog = _asaplog() 82 asaplog = AsapLogger() 83 """Default asap logger""" 61 84 62 85 def print_log_dec(f, level='INFO'): 86 """Decorator which posts log at completion of the wrapped method. 87 Example:: 88 89 @print_log_dec 90 def test(self): 91 do_stuff() 92 asaplog.push('testing...', False) 93 do_more_stuff() 94 asaplog.push('finished') 95 """ 63 96 @wraps_dec(f) 64 97 def wrap_it(*args, **kw): … … 69 102 70 103 def print_log(level='INFO'): 71 """Alias for asaplog.post ."""104 """Alias for asaplog.post(level)""" 72 105 asaplog.post(level) -
trunk/python/parameters.py
r1834 r1858 1 """This module provides functions to set up resource parameters (rc). 2 These can be set in a file .asaprc or using functions. 3 """ 1 4 __all__ = ["rc", "list_rcparameters", "rcParams", "rcParamsDefault"] 2 5
Note:
See TracChangeset
for help on using the changeset viewer.