casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
task_plotants.py
Go to the documentation of this file.
00001 import os
00002 import pylab as pl
00003 from taskinit import *
00004 
00005 def plotants(vis=None,figfile=''):
00006        """Plot the antenna distribution in the local reference frame:
00007 
00008        The location of the antennas in the MS will be plotted with
00009        X-toward local east; Y-toward local north.
00010 
00011        Keyword arguments:
00012        vis -- Name of input visibility file.
00013                default: none. example: vis='ngc5921.ms'
00014 
00015        figfile -- Save the plotted figure in this file.
00016                default: ''. example: figfile='myFigure.png'
00017 
00018                The name of each antenna (egs. vla=antenna number) is
00019                   shown next to its respective location.
00020 
00021                DO NOT use the buttons on the Mark Region line.  These are
00022                   not implemented yet and might abort CASA.
00023 
00024                You can zoom in by pressing the magnifier button (bottom,
00025                   third from left) and making a rectangular region with
00026                   the mouse.  Press the home button (left most button) to
00027                   remove zoom.
00028 
00029                A hard-copy of this plot can be obtained by pressing the
00030                   button on the right at the bottom of the display.  This
00031                   produces a png format file.
00032        """
00033 
00034        try:
00035               if type(vis) == str and os.path.isdir(vis):
00036                      mp.open(vis)
00037               else:
00038                      raise Exception, 'Visibility data set not found - please verify the name'
00039               pl.ion() # countering tableplot's inadequacies with poor practice
00040               pl.clf()
00041               mp.plotoptions(plotsymbol='ro');
00042               mp.plot(type='array')
00043               mp.reset()
00044               pl.axis('equal')
00045               pl.axis('scaled')
00046               #pl.ylabel('Y (m)')          # Replace mp's "X (m)".
00047               pl.title(vis)
00048               if ( len(figfile) > 0 ) :
00049                    mp.savefig( figfile )
00050 
00051        except Exception, instance:
00052               print '*** Error ***',instance
00053 
00054        mp.done()