casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
fixvis.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_fixvis
00013 def fixvis(vis='', outputvis='', field="", refcode='', reuse=True, phasecenter='', datacolumn='all'):
00014 
00015         """Recalculates (u, v, w) and/or changes Phase Center 
00016 
00017 If the phase center is changed, the corresponding modifications are applied to the 
00018 visibility columns given by the parameter "datacolumn" which is by default set 
00019 to "all" (DATA, CORRECTED, and MODEL).
00020 
00021     Input Parameters
00022     vis        -- Name of the input visibility set
00023     
00024     outputvis  -- Name of the output visibility set, default: same as vis
00025 
00026     field      -- field selection string
00027 
00028     refcode    -- Reference frame to convert to, default: the refcode of PHASE_DIR in the 
00029                   FIELD table
00030                   example: 'B1950'
00031     
00032     reuse      -- base recalculation on existing UVW coordinates? default=True
00033                   ignored if parameter 'phasecenter' is set
00034 
00035     phasecenter  --  if set to a valid direction: change the phase center for the given 
00036                      field to this value
00037                example: 'J2000 9h25m00s -05d12m00s'
00038                If given without the equinox, e.g. '0h01m00s +00d12m00s', the parameter
00039                is interpreted as a pair of offsets in RA and DEC to the present 
00040                phasecenter. The RA offset can be given in units of time or angle. If given 
00041                as a time, it is applied as is. If given as an angle, it is corrected for 
00042                the cos(DEC) before it is applied.
00043 
00044     datacolumn -- when applying a phase center shift, modify visibilities only in 
00045                   this/these column(s)
00046                   default: 'all' (DATA, CORRECTED, and MODEL)
00047                   example: 'DATA,CORRECTED' (will not modify MODEL)
00048                
00049     Examples:
00050 
00051     fixvis('NGC3256.ms','NGC3256-fixed.ms')
00052           will recalculate the UVW coordinates for all fields based on the existing
00053           phase center information in the FIELD table.
00054 
00055     fixvis('Moon.ms','Moon-fixed.ms','Moon', '', 'J2000 9h25m00s 05d12m00s')
00056           will set the phase center for field 'Moon' to the given direction and recalculate
00057           the UVW coordinates.
00058 
00059 
00060         """
00061 
00062 #
00063 #    The following is work around to avoid a bug with current python translation
00064 #
00065         mytmp = {}
00066 
00067         mytmp['vis'] = vis
00068         mytmp['outputvis'] = outputvis
00069         mytmp['field'] = field
00070         mytmp['refcode'] = refcode
00071         mytmp['reuse'] = reuse
00072         mytmp['phasecenter'] = phasecenter
00073         mytmp['datacolumn'] = datacolumn
00074         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00075         trec = casac.utils().torecord(pathname+'fixvis.xml')
00076 
00077         casalog.origin('fixvis')
00078         if trec.has_key('fixvis') and casac.utils().verify(mytmp, trec['fixvis']) :
00079             result = task_fixvis.fixvis(vis, outputvis, field, refcode, reuse, phasecenter, datacolumn)
00080 
00081         else :
00082           result = False
00083         return result