Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/wvrgcal.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 17:39 +0000
1##################### generated by xml-casa (v2) from wvrgcal.xml ###################
2##################### 62b478f27bd647d7dd85ba7e69456e62 ##############################
3from __future__ import absolute_import
4import numpy
5from casatools.typecheck import CasaValidator as _val_ctor
6_pc = _val_ctor( )
7from casatools.coercetype import coerce as _coerce
8from casatools.errors import create_error_string
9from .private.task_wvrgcal import wvrgcal as _wvrgcal_t
10from casatasks.private.task_logging import start_log as _start_log
11from casatasks.private.task_logging import end_log as _end_log
12from casatasks.private.task_logging import except_log as _except_log
14class _wvrgcal:
15 """
16 wvrgcal ---- Generate a gain table based on Water Vapour Radiometer data
20 Information about the observation and the performance of WVRGCAL is written to the CASA logger
21 and also returned in a dictionary; see the CASA cookbook for a more detailed description of these parameters.
22 The dictionary element 'success' is True if no errors occured.
24 Of particular note is the discrepancy parameter (Disc): high values (> a few hundred microns)
25 may indicate some levels of cloud contamination and the effect of applying the WVRGCAL correction
26 should be checked; values > 1000 um in all antennas have currently been found to indicate that
27 WVRGCAL correction should not be used.
30 vis -- Name of input visibility file
31 default: none; example: vis='ngc5921.ms'
33 caltable -- Name of output gain calibration table
34 default: none; example: caltable='ngc5921.wvr'
36 toffset -- Time offset (sec) between interferometric and WVR data
37 default: 0 (ALMA default for cycle 1, for cycle 0, i.e. up to Jan 2013 it was -1)
39 segsource -- Do a new coefficient calculation for each source
40 default: True
42 tie -- Prioritise tieing the phase of these sources as well as possible
43 (requires segsource=True)
44 default: [] example: ['3C273,NGC253', 'IC433,3C279']
46 sourceflag -- Flag the WVR data for these source(s) as bad and do not produce corrections for it
47 (requires segsource=True)
48 default: [] (none) example: ['3C273']
50 nsol -- Number of solutions for phase correction coefficients during this observation.
51 By default only one set of coefficients is generated for the entire observation.
52 If more sets are requested, then they will be evenly distributed in time throughout
53 the observation. Values > 1 require segsource=False.
54 default: 1
56 disperse -- Apply correction for dispersion
57 default: False
59 wvrflag -- Regard the WVR data for these antenna(s) as bad and use interpolated values instead
60 default: [] (none) example: ['DV03','DA05','PM02']
62 statfield -- Compute the statistics (Phase RMS, Disc) on this field only
63 default: '' (all)
65 statsource -- Compute the statistics (Phase RMS, Disc) on this source only
66 default: '' (all)
68 smooth -- Smooth the calibration solution on the given timescale
69 default: '' (no smoothing), example: '3s' smooth on a timescale of 3 seconds
71 scale -- Scale the entire phase correction by this factor
72 default: 1. (no scaling)
74 spw -- List of the spectral window IDs for which solutions should be saved into the caltable
75 default: [] (all spectral windows), example [17,19,21,23]
77 wvrspw -- List of the spectral window IDs from which the WVR data should be taken
78 default: [] (all WVR spectral windows), example [0]
80 reversespw -- Reverse the sign of the correction for the listed SPWs
81 (only neede for early ALMA data before Cycle 0)
82 default: '' (none), example: reversespw='0~2,4'; spectral windows 0,1,2,4
84 cont -- Estimate the continuum (e.g., due to clouds)
85 default: False
87 maxdistm -- maximum distance (m) an antenna may have to be considered for being part
88 of the antenna set (minnumants to 3 antennas) for the interpolation of a solution
89 for a flagged antenna
90 default: 500.
92 minnumants -- minimum number of near antennas required for interpolation
93 default: 2
95 mingoodfrac -- If the fraction of unflagged data for an antenna is below this value (0. to 1.),
96 the antenna is flagged.
97 default: 0.8
99 usefieldtab -- derive the antenna AZ/EL values from the FIELD rather than the POINTING table
100 default: False
102 refant -- use the WVR data from this antenna for calculating the dT/dL parameters (can give ranked list)
103 default: '' (use the first good or interpolatable antenna),
104 examples: 'DA45' - use DA45
105 ['DA45','DV51'] - use DA45 and if that is not good, use DV51 instead
107 offsetstable -- subtract the temperature offsets in this table from the WVR measurements before
108 using them to calculate the phase corrections
109 default: '' (do not apply any offsets)
110 examples: 'uid___A002_Xabd867_X2277.cloud_offsets' use the given table
112 rseed -- set random seed (integer) for the wvrgcal fitting routine to this specific value
113 default: 0 - use internal default value
114 example: 54321
118 --------- parameter descriptions ---------------------------------------------
120 vis Name of input visibility file
121 caltable Name of output gain calibration table
122 toffset Time offset (sec) between interferometric and WVR data
123 segsource Do a new coefficient calculation for each source
124 sourceflag Regard the WVR data for these source(s) as bad and do not produce corrections for it (requires segsource=True)
125 tie Prioritise tieing the phase of these sources as well as possible (requires segsource=True)
126 nsol Number of solutions for phase correction coefficients (nsol>1 requires segsource=False)
127 disperse Apply correction for dispersion
128 wvrflag Regard the WVR data for these antenna(s) as bad and replace its data with interpolated values from neighbouring antennas
129 statfield Compute the statistics (Phase RMS, Disc) on this field only
130 statsource Compute the statistics (Phase RMS, Disc) on this source only
131 smooth Smooth calibration solution on the given timescale
132 scale Scale the entire phase correction by this factor
133 spw List of the spectral window IDs for which solutions should be saved into the caltable
134 wvrspw List of the spectral window IDs from which the WVR data should be taken
135 reversespw Reverse the sign of the correction for the listed SPWs (only needed for early ALMA data before Cycle 0)
136 cont Estimate the continuum (e.g., due to clouds) (experimental)
137 maxdistm maximum distance (m) of an antenna used for interpolation for a flagged antenna
138 minnumants minimum number of near antennas (up to 3) required for interpolation
139 mingoodfrac If the fraction of unflagged data for an antenna is below this value (0. to 1.), the antenna is flagged.
140 usefieldtab derive the antenna AZ/EL values from the FIELD rather than the POINTING table
141 refant use the WVR data from this antenna for calculating the dT/dL parameters (can give ranked list)
142 offsetstable subtract the temperature offsets in this table from the WVR measurements before calculating the phase corrections
143 rseed random seed for fitting routine, 0 == use internal default
144 [1;42mRETURNS[1;m variant
146 --------- examples -----------------------------------------------------------
150 wvrgcal(vis='uid___A002_X1d54a1_X5.ms', caltable='cal-wvr-uid___A002_X1d54a1_X5.W',
151 toffset=-1, segsource=True, tie=['Titan,1037-295,NGC3256'], statsource='1037-295')
156 """
158 _info_group_ = """calibration"""
159 _info_desc_ = """Generate a gain table based on Water Vapour Radiometer data"""
161 def __call__( self, vis='', caltable='', toffset=float(0), segsource=True, sourceflag=[ ], tie=[ ], nsol=int(1), disperse=False, wvrflag=[ ], statfield='', statsource='', smooth='', scale=float(1.), spw=[ ], wvrspw=[ ], reversespw='', cont=False, maxdistm=float(500.), minnumants=int(2), mingoodfrac=float(0.8), usefieldtab=False, refant=[ ], offsetstable='', rseed=int(0) ):
162 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'caltable': {'type': 'cPath', 'coerce': _coerce.expand_path}, 'toffset': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'segsource': {'type': 'cBool'}, 'sourceflag': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'tie': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'nsol': {'type': 'cInt'}, 'disperse': {'type': 'cBool'}, 'wvrflag': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'statfield': {'type': 'cStr', 'coerce': _coerce.to_str}, 'statsource': {'type': 'cStr', 'coerce': _coerce.to_str}, 'smooth': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scale': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'spw': {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, 'wvrspw': {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, 'reversespw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'cont': {'type': 'cBool'}, 'maxdistm': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'minnumants': {'type': 'cInt', 'allowed': [ 1, 2, 3 ]}, 'mingoodfrac': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'usefieldtab': {'type': 'cBool'}, 'refant': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'offsetstable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'rseed': {'type': 'cInt'}}
163 doc = {'vis': vis, 'caltable': caltable, 'toffset': toffset, 'segsource': segsource, 'sourceflag': sourceflag, 'tie': tie, 'nsol': nsol, 'disperse': disperse, 'wvrflag': wvrflag, 'statfield': statfield, 'statsource': statsource, 'smooth': smooth, 'scale': scale, 'spw': spw, 'wvrspw': wvrspw, 'reversespw': reversespw, 'cont': cont, 'maxdistm': maxdistm, 'minnumants': minnumants, 'mingoodfrac': mingoodfrac, 'usefieldtab': usefieldtab, 'refant': refant, 'offsetstable': offsetstable, 'rseed': rseed}
164 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
165 _logging_state_ = _start_log( 'wvrgcal', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'toffset=' + repr(_pc.document['toffset']), 'segsource=' + repr(_pc.document['segsource']), 'sourceflag=' + repr(_pc.document['sourceflag']), 'tie=' + repr(_pc.document['tie']), 'nsol=' + repr(_pc.document['nsol']), 'disperse=' + repr(_pc.document['disperse']), 'wvrflag=' + repr(_pc.document['wvrflag']), 'statfield=' + repr(_pc.document['statfield']), 'statsource=' + repr(_pc.document['statsource']), 'smooth=' + repr(_pc.document['smooth']), 'scale=' + repr(_pc.document['scale']), 'spw=' + repr(_pc.document['spw']), 'wvrspw=' + repr(_pc.document['wvrspw']), 'reversespw=' + repr(_pc.document['reversespw']), 'cont=' + repr(_pc.document['cont']), 'maxdistm=' + repr(_pc.document['maxdistm']), 'minnumants=' + repr(_pc.document['minnumants']), 'mingoodfrac=' + repr(_pc.document['mingoodfrac']), 'usefieldtab=' + repr(_pc.document['usefieldtab']), 'refant=' + repr(_pc.document['refant']), 'offsetstable=' + repr(_pc.document['offsetstable']), 'rseed=' + repr(_pc.document['rseed']) ] )
166 task_result = None
167 try:
168 task_result = _wvrgcal_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['toffset'], _pc.document['segsource'], _pc.document['sourceflag'], _pc.document['tie'], _pc.document['nsol'], _pc.document['disperse'], _pc.document['wvrflag'], _pc.document['statfield'], _pc.document['statsource'], _pc.document['smooth'], _pc.document['scale'], _pc.document['spw'], _pc.document['wvrspw'], _pc.document['reversespw'], _pc.document['cont'], _pc.document['maxdistm'], _pc.document['minnumants'], _pc.document['mingoodfrac'], _pc.document['usefieldtab'], _pc.document['refant'], _pc.document['offsetstable'], _pc.document['rseed'] )
169 except Exception as exc:
170 _except_log('wvrgcal', exc)
171 raise
172 finally:
173 task_result = _end_log( _logging_state_, 'wvrgcal', task_result )
174 return task_result
176wvrgcal = _wvrgcal( )