casa
$Rev:20696$
|
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_wvrgcal 00013 def wvrgcal(vis='', caltable='', toffset=-1, segsource=True, sourceflag=[''], tie=[''], nsol=1, disperse=False, wvrflag=[''], statfield='', statsource='', smooth=1, scale=1., reversespw='', cont=False): 00014 00015 """Generate a gain table based on Water Vapour Radiometer data 00016 00017 Information about the observation and the performance of WVRGCAL is written to the CASA logger; 00018 see the CASA cookbook for a more detailed description of these parameters. 00019 00020 Of particular note is the discrepancy parameter (Disc): high values (> a few hundred microns) 00021 may indicate some levels of cloud contamination and the effect of applying the WVRGCAL correction 00022 should be checked; values > 1000 um in all antennas have currently been found to indicate that 00023 WVRGCAL correction should not be used. 00024 00025 00026 vis -- Name of input visibility file 00027 default: none; example: vis='ngc5921.ms' 00028 00029 caltable -- Name of output gain calibration table 00030 default: none; example: caltable='ngc5921.wvr' 00031 00032 toffset -- Time offset (sec) between interferometric and WVR data 00033 default: -1 (ALMA default) 00034 00035 segsource -- Do a new coefficient calculation for each source 00036 default: True 00037 00038 tie -- Prioritise tieing the phase of these sources as well as possible 00039 (requires segsource=True) 00040 default: [] example: ['3C273,NGC253', 'IC433,3C279'] 00041 00042 sourceflag -- Flag the WVR data for these source(s) as bad and do not produce corrections for it 00043 (requires segsource=True) 00044 default: [] (none) example: ['3C273'] 00045 00046 nsol -- Number of solutions for phase correction coefficients during this observation. 00047 By default only one set of coefficients is generated for the entire observation. 00048 If more sets are requested, then they will be evenly distributed in time throughout 00049 the observation. Values > 1 require segsource=False. 00050 default: 1 00051 00052 disperse -- Apply correction for dispersion 00053 default: False 00054 00055 wvrflag -- Flag the WVR data for these antenna(s) as bad and replace its data with interpolated values 00056 default: [] (none) example: ['DV03','DA05','PM02'] 00057 00058 statfield -- Compute the statistics (Phase RMS, Disc) on this field only 00059 default: '' (all) 00060 00061 statsource -- Compute the statistics (Phase RMS, Disc) on this source only 00062 default: '' (all) 00063 00064 smooth -- Smooth WVR data by this many samples before applying the correction 00065 default: 1 (no smoothing) example: 3 00066 00067 scale -- Scale the entire phase correction by this factor 00068 default: 1. (no scaling) 00069 00070 reversespw -- Reverse the sign of the correction for the listed SPWs 00071 (only neede for early ALMA data before Cycle 0) 00072 default: '' (none), example: reversespw='0~2,4'; spectral windows 0,1,2,4 00073 00074 cont -- Estimate the continuum (e.g., due to clouds) 00075 default: False 00076 00077 00078 """ 00079 if type(sourceflag)==str: sourceflag=[sourceflag] 00080 if type(tie)==str: tie=[tie] 00081 if type(wvrflag)==str: wvrflag=[wvrflag] 00082 00083 # 00084 # The following is work around to avoid a bug with current python translation 00085 # 00086 mytmp = {} 00087 00088 mytmp['vis'] = vis 00089 mytmp['caltable'] = caltable 00090 mytmp['toffset'] = toffset 00091 mytmp['segsource'] = segsource 00092 mytmp['sourceflag'] = sourceflag 00093 mytmp['tie'] = tie 00094 mytmp['nsol'] = nsol 00095 mytmp['disperse'] = disperse 00096 mytmp['wvrflag'] = wvrflag 00097 mytmp['statfield'] = statfield 00098 mytmp['statsource'] = statsource 00099 mytmp['smooth'] = smooth 00100 mytmp['scale'] = scale 00101 mytmp['reversespw'] = reversespw 00102 mytmp['cont'] = cont 00103 pathname='file:///'+os.environ.get('CASAPATH').split()[0]+'/share/xml/' 00104 trec = casac.utils().torecord(pathname+'wvrgcal.xml') 00105 00106 casalog.origin('wvrgcal') 00107 if trec.has_key('wvrgcal') and casac.utils().verify(mytmp, trec['wvrgcal']) : 00108 result = task_wvrgcal.wvrgcal(vis, caltable, toffset, segsource, sourceflag, tie, nsol, disperse, wvrflag, statfield, statsource, smooth, scale, reversespw, cont) 00109 00110 else : 00111 result = False 00112 return result