Ignore:
Timestamp:
06/09/10 19:03:06 (14 years ago)
Author:
Kana Sugimoto
Message:

New Development: Yes

JIRA Issue: Yes (CAS-2211)

Ready for Test: Yes

Interface Changes: Yes

What Interface Changed: ASAP 3.0.0 interface changes

Test Programs:

Put in Release Notes: Yes

Module(s): all the CASA sd tools and tasks are affected.

Description: Merged ATNF-ASAP 3.0.0 developments to CASA (alma) branch.

Note you also need to update casa/code/atnf.


Location:
branches/alma
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/alma

  • branches/alma/python/__init__.py

    r1729 r1757  
    44"""
    55import os,sys,shutil, platform
     6try:
     7    from functools import wraps as wraps_dec
     8except ImportError:
     9    from asap.compatibility import wraps as wraps_dec
    610
    711# Set up CASAPATH and first time use of asap i.e. ~/.asap/*
     
    3337    #shutil.copyfile(asapdata+"/data/ipythonrc-asap", userdir+"/ipythonrc-asap")
    3438    # commented out by TT on 2009.06.23 for casapy use
    35     ##shutil.copyfile(asapdata+"/data/ipy_user_conf.py", 
     39    ##shutil.copyfile(asapdata+"/data/ipy_user_conf.py",
    3640    ##                userdir+"/ipy_user_conf.py")
    3741    f = file(userdir+"/asapuserfuncs.py", "w")
     
    4347    # upgrade to support later ipython versions
    4448    ##if not os.path.exists(userdir+"/ipy_user_conf.py"):
    45     ##    shutil.copyfile(asapdata+"/data/ipy_user_conf.py", 
     49    ##    shutil.copyfile(asapdata+"/data/ipy_user_conf.py",
    4650    ##                    userdir+"/ipy_user_conf.py")
    4751
     
    7478
    7579    """
    76 
    7780    fname = os.path.join( os.getcwd(), '.asaprc')
    7881    if os.path.exists(fname): return fname
     
    109112    'plotter.histogram'  : [False, _validate_bool],
    110113    'plotter.papertype'  : ['A4', str],
    111     'plotter.xaxisformatting' : ['asap', str],
     114    ## for older Matplotlib version
     115    #'plotter.axesformatting' : ['mpl', str],
     116    'plotter.axesformatting' : ['asap', str],
    112117
    113118    # scantable
     
    118123    'scantable.storage'   : ['memory', str],
    119124    'scantable.history'   : [True, _validate_bool],
    120     'scantable.reference'      : ['.*(e|w|_R)$', str]
     125    'scantable.reference'      : ['.*(e|w|_R)$', str],
     126    'scantable.parallactify'   : [False, _validate_bool]
    121127    # fitter
    122128    }
     
    146152plotter.panelling          : scan
    147153
    148 # push panels together, to share axislabels
     154# push panels together, to share axis labels
    149155plotter.ganged             : True
    150156
     
    164170
    165171# The formatting style of the xaxis
    166 plotter.xaxisformatting    : 'asap' or 'mpl'
     172plotter.axesformatting    : 'mpl' (default) or 'asap' (for old versions of matplotlib)
    167173
    168174# scantable
     
    189195# Control the identification of reference (off) scans
    190196# This is has to be a regular expression
    191 scantable.reference         : .*(e|w|_R)$
     197scantable.reference        : .*(e|w|_R)$
     198
     199# Indicate whether the data was parallactified (total phase offest == 0.0)
     200scantable.parallactify     : False
     201
    192202# Fitter
    193203"""
     
    290300
    291301def _n_bools(n, val):
    292     return [ val for i in xrange(n) ] 
     302    return [ val for i in xrange(n) ]
    293303
    294304def _is_sequence_or_number(param, ptype=int):
     
    357367    asaplog.disable()
    358368
     369
     370def print_log_dec(f):
     371    @wraps_dec(f)
     372    def wrap_it(*args, **kw):
     373        val = f(*args, **kw)
     374        print_log()
     375        return val
     376    return wrap_it
     377
    359378def print_log(level='INFO'):
    360379    from taskinit import casalog
     
    382401from scantable import scantable
    383402from asaplinefind import linefinder
     403from simplelinefinder import simplelinefinder
    384404from linecatalog import linecatalog
    385405from interactivemask import interactivemask
     406from opacity import skydip
     407from opacity import model as opacity_model
    386408
    387409if rcParams['useplotter']:
     
    392414            import matplotlib
    393415            if not matplotlib.sys.modules['matplotlib.backends']: matplotlib.use("TkAgg")
    394         import pylab
     416        from matplotlib import pylab
    395417        xyplotter = pylab
    396418        plotter = asapplotter(gui)
     
    402424
    403425__date__ = '$Date$'.split()[1]
    404 __version__  = '2.3.1 alma'
     426__version__  = '3.0.0 alma'
    405427# nrao casapy specific, get revision number
    406428#__revision__ = ' unknown '
     
    427449
    428450def is_ipython():
    429     return '__IP' in dir(sys.modules["__main__"])
     451    return 'IPython' in sys.modules.keys()
    430452if is_ipython():
    431453    def version(): print  "ASAP %s(%s)"% (__version__, __date__)
     454
    432455    def list_scans(t = scantable):
    433         import types
    434         globs = sys.modules['__main__'].__dict__.iteritems()
    435         print "The user created scantables are:"
    436         sts = map(lambda x: x[0], filter(lambda x: isinstance(x[1], t), globs))
    437         print filter(lambda x: not x.startswith('_'), sts)
    438         return
     456        import inspect
     457        print "The user created scantables are: ",
     458        globs=inspect.currentframe().f_back.f_locals.copy()
     459        out = [ k for k,v in globs.iteritems() \
     460                     if isinstance(v, scantable) and not k.startswith("_") ]
     461        print out
     462        return out
    439463
    440464    def commands():
     
    462486            get_elevation   - get the elevation of the scans
    463487            get_parangle    - get the parallactic angle of the scans
     488            get_coordinate  - get the spectral coordinate for the given row,
     489                              which can be used for coordinate conversions
     490            get_weather     - get the weather condition parameters
    464491            get_unit        - get the current unit
    465492            set_unit        - set the abcissa unit to be used from this
     
    506533            mx_quotient     - Form a quotient using MX data (off beams)
    507534            scale, *, /     - return a scan scaled by a given factor
    508             add, +, -       - return a scan with given value added
     535            add, +          - return a scan with given value added
     536            sub, -          - return a scan with given value subtracted
    509537            bin             - return a scan with binned channels
    510538            resample        - return a scan with resampled channels
     
    529557            stddev          - Determine the standard deviation of the current
    530558                              beam/if/pol
     559            get_row_selector - get the selection object for a specified row
     560                               number
    531561     [Selection]
    532562         selector              - a selection object to set a subset of a scantable
     
    590620            plot            - plot a scantable
    591621            plot_lines      - plot a linecatalog overlay
     622            plotazel        - plot azimuth and elevation versus time
     623            plotpointing    - plot telescope pointings
    592624            save            - save the plot to a file ('png' ,'ps' or 'eps')
    593625            set_mode        - set the state of the plotter, i.e.
     
    613645            axhline,axvline - draw horizontal/vertical lines
    614646            axhspan,axvspan - draw horizontal/vertical regions
     647            annotate        - draw an arrow with label
     648            create_mask     - create a scnatble mask interactively
    615649
    616650        xyplotter           - matplotlib/pylab plotting functions
    617 
    618     [Reading files]
    619         reader              - access rpfits/sdfits files
    620             open            - attach reader to a file
    621             close           - detach reader from file
    622             read            - read in integrations
    623             summary         - list info about all integrations
    624651
    625652    [General]
    626653        commands            - this command
    627654        print               - print details about a variable
    628         list_scans          - list all scantables created bt the user
     655        list_scans          - list all scantables created by the user
    629656        list_files          - list all files readable by asap (default rpf)
    630657        del                 - delete the given variable from memory
     
    639666        mask_not            - boolean operations on masks created with
    640667                              scantable.create_mask
     668        skydip              - gain opacity values from a sky dip observation
     669        opacity_model       - compute opacities fro given frequencies based on
     670                              atmospheric model
    641671
    642672    Note:
Note: See TracChangeset for help on using the changeset viewer.