casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
plotuv.py
Go to the documentation of this file.
00001 #
00002 # This file was generated using xslt from its XML file
00003 #
00004 # Copyright 2009, Associated Universities Inc., Washington DC
00005 #
00006 import sys
00007 import os
00008 from  casac import *
00009 import string
00010 from taskinit import casalog
00011 #from taskmanager import tm
00012 import task_plotuv
00013 def plotuv(vis='', field='', antenna='', spw='', observation='', array='', maxnpts=100000, colors=['r', 'y', 'g', 'b'], symb=',', ncycles=1, figfile=''):
00014 
00015         """Plot the baseline distribution
00016     Plots the uv coverage of vis in klambda.  ncycles of colors will be
00017     allocated to representative wavelengths.
00018 
00019     Keyword arguments:
00020       vis -- Name of input visibility file
00021              default: none; example: vis='ngc5921.ms'
00022 
00023       --- Data Selection (see help par.selectdata for more detailed
00024           information)
00025 
00026        field -- Select field using field id(s) or field name(s).
00027                  [run listobs to obtain the list IDs or names]
00028               default: ''=all fields.  If field is a non-negative
00029               integer, it is assumed to be a field index.
00030               Otherwise, it is assumed to be a field name
00031               field='0~2'; field ids 0,1,2
00032               field='0,4,5~7'; field ids 0,4,5,6,7
00033               field='3C286,3C295'; fields named 3C286 and 3C295
00034               field = '3,4C*'; field id 3, all names starting with 4C
00035         antenna -- Select data based on antenna/baseline
00036                 default: '' (all)
00037                 Non-negative integers are assumed to be antenna indices, and
00038                 anything else is taken as an antenna name.
00039 
00040                 Examples:
00041                 antenna='5&6': baseline between antenna index 5 and index 6.
00042                 antenna='VA05&VA06': baseline between VLA antenna 5 and 6.
00043                 antenna='5&6;7&8': baselines 5-6 and 7-8
00044                 antenna='5': all baselines with antenna 5
00045                 antenna='5,6,10': all baselines including antennas 5, 6, or 10
00046                 antenna='5,6,10&': all baselines with *only* antennas 5, 6, or
00047                                        10.  (cross-correlations only.  Use &&
00048                                        to include autocorrelations, and &&&
00049                                        to get only autocorrelations.)
00050                 antenna='!ea03,ea12,ea17': all baselines except those that
00051                                            include EVLA antennas ea03, ea12, or
00052                                            ea17.
00053        spw -- Select spectral windows.  Channel selection is ignored for now.
00054               default: ''=all spectral windows
00055               spw='0~2,4'; spectral windows 0,1,2,4
00056               spw='<2';  spectral windows less than 2 (i.e. 0,1)
00057               spw='0'; spw 0
00058               spw='0,10,3'; spws 0, 10, and 3
00059        observation -- Select by observation ID(s). default: '' = all
00060        array -- (Sub)array number range. default: ''=all
00061 
00062       maxnpts -- Save memory and/or screen space by plotting a maximum of maxnpts
00063                  (or all of them if maxnpts < 1).  There is a very sharp
00064                  slowdown if the plotter starts swapping.
00065                  default: 100000
00066       colors -- a list of matplotlib color codes, used in order of decreasing
00067                 visibility wavelength.
00068                 default: ['r', 'y', 'g', 'b']  (red, yellow, green, blue)
00069       symb -- One of matplotlib's codes for plot symbols: .:,o^v<>s+xDd234hH|_
00070               default: ',':  The smallest points I could find.
00071       ncycles -- The number of times colors will be cycled through per plot.
00072                  default: 1
00073       figfile -- If not '', save the plots using names based on figfile.
00074                  Example: if figfile is 'test.png', and field is '1,2,4', the plots
00075                           will be saved to test_fld1.png, test_fld2.png,
00076                           and test_fld4.png.
00077                  default: '' (Do not save)
00078     
00079         """
00080         if type(colors)==str: colors=[colors]
00081 
00082 #
00083 #    The following is work around to avoid a bug with current python translation
00084 #
00085         mytmp = {}
00086 
00087         mytmp['vis'] = vis
00088         mytmp['field'] = field
00089         mytmp['antenna'] = antenna
00090         mytmp['spw'] = spw
00091         mytmp['observation'] = observation
00092         mytmp['array'] = array
00093         mytmp['maxnpts'] = maxnpts
00094         mytmp['colors'] = colors
00095         mytmp['symb'] = symb
00096         mytmp['ncycles'] = ncycles
00097         mytmp['figfile'] = figfile
00098         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00099         trec = casac.utils().torecord(pathname+'plotuv.xml')
00100 
00101         casalog.origin('plotuv')
00102         if trec.has_key('plotuv') and casac.utils().verify(mytmp, trec['plotuv']) :
00103             result = task_plotuv.plotuv(vis, field, antenna, spw, observation, array, maxnpts, colors, symb, ncycles, figfile)
00104 
00105         else :
00106           result = False
00107         return result