casa  $Rev:20696$
 All Classes Namespaces Files Functions Variables
smoothcal.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_smoothcal
00013 def smoothcal(vis='', tablein='', caltable='', field=[''], smoothtype='median', smoothtime=60.0):
00014 
00015         """Smooth calibration solution(s) derived from one or more sources:
00016 
00017 
00018         A G- or T-type gain calibration can be smoothed.  The amplitude and
00019         phase smoothing times are currently the same.  Calibration values
00020         will be smoothed over all fields designed.
00021 
00022         Keyword arguments:
00023         vis -- Name of input visibility file
00024                 default: none; example: vis='ngc5921.ms'
00025         tablein -- Input calibration table (G or T)
00026                 default: none; example: tablein='ngc5921.gcal'
00027         caltable -- Output calibration table (smoothed)
00028                 default: none; example: caltable='ngc5921_smooth.gcal'
00029         field -- subset of fields to select and smooth
00030                 default: '' means all; example: field='0319_415_1,3C286'
00031         smoothtype -- The smoothing filter to be used for both amp and phase
00032                 default: 'median'; example: smoothtype='mean'
00033                 Options: 'median','mean'
00034         smoothtime -- Smoothing filter time (sec)
00035                 default: 300.0; example: smoothtime=60.
00036  
00037         """
00038         if type(field)==str: field=[field]
00039 
00040 #
00041 #    The following is work around to avoid a bug with current python translation
00042 #
00043         mytmp = {}
00044 
00045         mytmp['vis'] = vis
00046         mytmp['tablein'] = tablein
00047         mytmp['caltable'] = caltable
00048         mytmp['field'] = field
00049         mytmp['smoothtype'] = smoothtype
00050         mytmp['smoothtime'] = smoothtime
00051         pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/'
00052         trec = casac.utils().torecord(pathname+'smoothcal.xml')
00053 
00054         casalog.origin('smoothcal')
00055         if trec.has_key('smoothcal') and casac.utils().verify(mytmp, trec['smoothcal']) :
00056             result = task_smoothcal.smoothcal(vis, tablein, caltable, field, smoothtype, smoothtime)
00057 
00058         else :
00059           result = False
00060         return result