casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
fixplanets.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_fixplanets
00013 def fixplanets(vis='', field="", fixuvw=False, direction='', refant=0, reftime='first'):
00014 
00015         """Changes FIELD and SOURCE table entries based on user given direction or POINTING table, optionally fixes the UVW coordinates
00016     This task's main purpose is to correct observations which were performed
00017     with correct pointing and correlation but for which incorrect direction
00018     information was entered in the FIELD and SOURCE table of the MS.
00019     If you actually want to change the phase center of the visibilties in an MS,
00020     you should use task fixvis.
00021 
00022     Input Parameters
00023     vis        -- Name of the input visibility set
00024     
00025     field      -- field selection string
00026     
00027     fixuvw     -- recalc uvw coordinates? (default: False)
00028 
00029     direction  -- if set, don't use pointing table but set direction to this value
00030                   default= '' (use pointing table)
00031                   example: 'J2000 19h30m00 -40d00m00'
00032 
00033     refant     -- if using pointing table information, use it from this antenna
00034                   default: 0 (antenna id 0)
00035                   examples: 'DV06' (antenna with name DV06)
00036                             3 (antenna id 3)
00037     reftime    -- if using pointing table information, use it from this timestamp
00038                   default: 'first'
00039                   examples: 'median' will use the median timestamp for the given field
00040                             using only the unflagged maintable rows 
00041                             '2012/07/11/08:41:32' will use the given timestamp (must be
00042                             within the observaton time)
00043 
00044     Examples:
00045 
00046     fixplanets('uid___A002_X1c6e54_X223.ms', 'Titan', True)
00047           will look up the pointing direction from antenna 0 for field 'Titan' in 
00048           the POINTING table based on the first timestamp in the main table rows for 
00049           this field, enter this direction in the FIELD and SOURCE tables, and then 
00050           recalculate the UVW coordinates for this field.
00051 
00052     fixplanets('uid___A002_X1c6e54_X223.ms', 'Titan', False, 'J2000 12h30m15 -02d12m00')
00053           will set the directions for field 'Titan' in the FIELD and SOURCE table to the
00054           given direction and not recalculate the UVW coordinates.
00055           (This can be useful for several purposes, among them preparing a concatenation
00056           of datasets. Only fields with the same direction will be recognised as identical.
00057           fixplanets can then be run again after the concatenation using parameters as in
00058           the first example above.)
00059 
00060 
00061         """
00062 
00063 #
00064 #    The following is work around to avoid a bug with current python translation
00065 #
00066         mytmp = {}
00067 
00068         mytmp['vis'] = vis
00069         mytmp['field'] = field
00070         mytmp['fixuvw'] = fixuvw
00071         mytmp['direction'] = direction
00072         mytmp['refant'] = refant
00073         mytmp['reftime'] = reftime
00074         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00075         trec = casac.utils().torecord(pathname+'fixplanets.xml')
00076 
00077         casalog.origin('fixplanets')
00078         if trec.has_key('fixplanets') and casac.utils().verify(mytmp, trec['fixplanets']) :
00079             result = task_fixplanets.fixplanets(vis, field, fixuvw, direction, refant, reftime)
00080 
00081         else :
00082           result = False
00083         return result