Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/blcal.py: 56%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-10-31 19:53 +0000
1##################### generated by xml-casa (v2) from blcal.xml #####################
2##################### 305b0cd5f4c91d6a5f3a5696419a82d5 ##############################
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_blcal import blcal as _blcal_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 _blcal:
15 """
16 blcal ---- Calculate a baseline-based calibration solution (gain or bandpass)
19 This task determines a baseline by baseline gain (time) or bandpass
20 (freq) for all baseline pairs in the data set. For the usual
21 antenna-based calibration of interferometric data, this task gaincal
22 is recommended, even with only one to three baselines. For arrays
23 with closure errors, use blcal.
25 --------- parameter descriptions ---------------------------------------------
27 vis Name of input visibility file
28 Default: none
30 Example: vis='ngc5921.ms'
31 caltable Name of output gain calibration table
32 Default: none
34 Example: caltable='ngc5921.gcal'
35 field Select field using field id(s) or field name(s)
36 Default: '' (all fields)
38 Use 'go listobs' to obtain the list id's or
39 names. If field string is a non-negative integer,
40 it is assumed a field index, otherwise, it is
41 assumed a field name.
43 Examples:
44 field='0~2'; field ids 0,1,2
45 field='0,4,5~7'; field ids 0,4,5,6,7
46 field='3C286,3C295'; field named 3C286 and
47 3C295
48 field = '3,4C\*'; field id 3, all names
49 starting with 4C
50 spw Select spectral window/channels
51 Default: '' (all spectral windows and channels)
53 Examples:
54 spw='0~2,4'; spectral windows 0,1,2,4 (all
55 channels)
56 spw='<2'; spectral windows less than 2
57 (i.e. 0,1)
58 spw='0:5~61'; spw 0, channels 5 to 61,
59 INCLUSIVE
60 spw='\*:5~61'; all spw with channels 5 to 61
61 spw='0,10,3:3~45'; spw 0,10 all channels, spw
62 3, channels 3 to 45.
63 spw='0~2:2~6'; spw 0,1,2 with channels 2
64 through 6 in each.
65 spw='0:0~10;15~60'; spectral window 0 with
66 channels 0-10,15-60. (NOTE ';' to separate
67 channel selections)
68 spw='0:0~10^2,1:20~30^5'; spw 0, channels
69 0,2,4,6,8,10, spw 1, channels 20,25,30
70 intent Select observing intent
71 Default: '' (no selection by intent)
73 Example: intent='\*BANDPASS\*' (selects data
74 labelled with BANDPASS intent)
75 selectdata Other data selection parameters
76 Default: True
77 Options: True|False
78 timerange Select data based on time range
79 Subparameter of selectdata=True
80 Default = '' (all)
82 Examples:
83 timerange =
84 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss'
85 (Note: if YYYY/MM/DD is missing date defaults
86 to first day in data set.)
87 timerange='09:14:0~09:54:0' picks 40 min on
88 first day
89 timerange= '25:00:00~27:30:00' picks 1 hr to 3
90 hr 30min on NEXT day
91 timerange='09:44:00' pick data within one
92 integration of time
93 timerange='>10:24:00' data after this time
94 uvrange Select data by baseline length.
95 Default = '' (all)
97 Examples:
98 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda
99 uvrange='>4klambda';uvranges greater than 4 kilo-lambda
100 uvrange='0~1000km'; uvrange in kilometers
101 antenna Select data based on antenna/baseline
102 Subparameter of selectdata=True
103 Default: '' (all)
105 If antenna string is a non-negative integer, it
106 is assumed an antenna index, otherwise, it is
107 assumed as an antenna name
109 Examples:
110 antenna='5&6'; baseline between antenna
111 index 5 and index 6.
112 antenna='VA05&VA06'; baseline between VLA
113 antenna 5 and 6.
114 antenna='5&6;7&8'; baselines with
115 indices 5-6 and 7-8
116 antenna='5'; all baselines with antenna index
117 5
118 antenna='05'; all baselines with antenna
119 number 05 (VLA old name)
120 antenna='5,6,10'; all baselines with antennas
121 5,6,10 index numbers
122 scan Scan number range
123 Subparameter of selectdata=True
124 Default: '' = all
125 observation Select by observation ID(s)
126 Subparameter of selectdata=True
127 Default: '' = all
129 Example: observation='0~2,4'
130 msselect Optional complex data selection (ignore for now)
131 solint Solution interval
132 Default: 'inf' (infinite, up to boundaries
133 controlled by combine);
134 Options: 'inf' (~infinite), 'int' (per
135 integration), any float or integer value with or
136 without units
138 Examples:
139 solint='1min'; solint='60s', solint=60 (i.e.,
140 1 minute); solint='0s'; solint=0; solint='int'
141 (i.e., per integration); solint-'-1s';
142 solint='inf' (i.e., ~infinite, up to
143 boundaries enforced by combine)
144 combine Data axes which to combine for solve
145 Default: 'scan' (solutions will break at obs,
146 field, and spw boundaries, but may extend over
147 multiple scans [per obs, field, and spw] up to
148 solint.)
149 Options: '','obs','scan','spw',field', or any
150 comma-separated combination in a single string
152 Example: combine='scan,spw' - Extend solutions
153 over scan boundaries (up to the solint), and
154 combine spws for solving
155 freqdep Solve for frequency dependent solutions
156 Default: False (gain; True=bandpass)
157 Options: False|True
158 calmode Type of solution" ('ap', 'p', 'a')
159 Default: 'ap' (amp and phase)
160 Options: 'p' (phase) ,'a' (amplitude), 'ap'
161 (amplitude and phase)
163 Example: calmode='p'
164 solnorm Normalize average solution amplitudes to 1.0
165 Default: False (no normalization)
167 For freqdep=False, this is a global (per-spw)
168 normalization of amplitudes (only). For
169 freqdep=True, each baseline solution spectrum is
170 separately normalized by its (complex) mean.
171 gaintable Gain calibration table(s) to apply on the fly
172 Default: '' (none)
174 Examples:
175 gaintable='ngc5921.gcal'
176 gaintable=['ngc5921.ampcal','ngc5921.phcal']
177 gainfield Select a subset of calibrators from gaintable(s)
178 Default: '' (all sources on the sky)
180 'nearest' ==> nearest (on sky) available field in
181 table otherwise, same syntax as field
183 Examples:
184 gainfield='0~3'
185 gainfield=['0~3','4~6']
186 interp Interpolation parmameters (in time[,freq]) for each gaintable, as a list of strings.
187 Default: '' --> 'linear,linear' for all gaintable(s)
188 Options: Time: 'nearest', 'linear'
189 Freq: 'nearest', 'linear', 'cubic',
190 'spline'
191 Specify a list of strings, aligned with the list of caltable specified
192 in gaintable, that contain the required interpolation parameters
193 for each caltable.
195 - When frequency interpolation is relevant (B, Df,
196 Xf), separate time-dependent and freq-dependent
197 interp types with a comma (freq after the
198 comma).
199 - Specifications for frequency are ignored when the
200 calibration table has no channel-dependence.
201 - Time-dependent interp options ending in 'PD'
202 enable a "phase delay" correction per spw for
203 non-channel-dependent calibration types.
204 - For multi-obsId datasets, 'perobs' can be
205 appended to the time-dependent interpolation
206 specification to enforce obsId boundaries when
207 interpolating in time.
208 - For multi-scan datasets, 'perscan' can be
209 appended to the time-dependent interpolation
210 specification to enforce scan boundaries when
211 interpolating in time.
212 - Freq-dependent interp options can have 'flag' appended
213 to enforce channel-dependent flagging, and/or 'rel'
214 appended to invoke relative frequency interpolation
216 Examples:
217 interp='nearest' (in time, freq-dep will be
218 linear, if relevant)
219 interp='linear,cubic' (linear in time, cubic
220 in freq)
221 interp='linearperobs,splineflag' (linear in
222 time per obsId, spline in freq with
223 channelized flagging)
224 interp='nearest,linearflagrel' (nearest in
225 time, linear in freq with with channelized
226 flagging and relative-frequency interpolation)
227 interp=',spline' (spline in freq; linear in
228 time by default)
229 interp=['nearest,spline','linear'] (for
230 multiple gaintables)
231 spwmap Spectral window mappings to form for gaintable(s)
232 default: [] (apply solutions from each calibration spw to
233 the same MS spw only)
234 Any available calibration spw can be mechanically mapped to any
235 MS spw.
236 Examples:
237 spwmap=[0,0,1,1] means apply calibration
238 from cal spw = 0 to MS spw 0,1 and cal spw 1 to MS spws 2,3.
239 spwmap=[[0,0,1,1],[0,1,0,1]] (use a list of lists for multiple
240 gaintables)
241 parang Apply parallactic angle correction
242 Default: False
244 If True, apply the parallactic angle correction
245 (required for polarization calibration)
247 --------- examples -----------------------------------------------------------
251 For more information, see the task pages of blcal in CASA Docs:
253 https://casa.nrao.edu/casadocs/
256 """
258 _info_group_ = """calibration"""
259 _info_desc_ = """Calculate a baseline-based calibration solution (gain or bandpass)"""
261 def __call__( self, vis='', caltable='', field='', spw='', intent='', selectdata=True, timerange='', uvrange='', antenna='', scan='', observation='', msselect='', solint='inf', combine='scan', freqdep=False, calmode='ap', solnorm=False, gaintable=[ ], gainfield=[ ], interp=[ ], spwmap=[ ], parang=False ):
262 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'caltable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'selectdata': {'type': 'cBool'}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'uvrange': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'observation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'msselect': {'type': 'cStr', 'coerce': _coerce.to_str}, 'solint': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'combine': {'type': 'cStr', 'coerce': _coerce.to_str}, 'freqdep': {'type': 'cBool'}, 'calmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'a', 'p', 'ap' ]}, 'solnorm': {'type': 'cBool'}, 'gaintable': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'gainfield': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'interp': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'spwmap': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'parang': {'type': 'cBool'}}
263 doc = {'vis': vis, 'caltable': caltable, 'field': field, 'spw': spw, 'intent': intent, 'selectdata': selectdata, 'timerange': timerange, 'uvrange': uvrange, 'antenna': antenna, 'scan': scan, 'observation': observation, 'msselect': msselect, 'solint': solint, 'combine': combine, 'freqdep': freqdep, 'calmode': calmode, 'solnorm': solnorm, 'gaintable': gaintable, 'gainfield': gainfield, 'interp': interp, 'spwmap': spwmap, 'parang': parang}
264 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
265 _logging_state_ = _start_log( 'blcal', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'intent=' + repr(_pc.document['intent']), 'selectdata=' + repr(_pc.document['selectdata']), 'timerange=' + repr(_pc.document['timerange']), 'uvrange=' + repr(_pc.document['uvrange']), 'antenna=' + repr(_pc.document['antenna']), 'scan=' + repr(_pc.document['scan']), 'observation=' + repr(_pc.document['observation']), 'msselect=' + repr(_pc.document['msselect']), 'solint=' + repr(_pc.document['solint']), 'combine=' + repr(_pc.document['combine']), 'freqdep=' + repr(_pc.document['freqdep']), 'calmode=' + repr(_pc.document['calmode']), 'solnorm=' + repr(_pc.document['solnorm']), 'gaintable=' + repr(_pc.document['gaintable']), 'gainfield=' + repr(_pc.document['gainfield']), 'interp=' + repr(_pc.document['interp']), 'spwmap=' + repr(_pc.document['spwmap']), 'parang=' + repr(_pc.document['parang']) ] )
266 task_result = None
267 try:
268 task_result = _blcal_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['field'], _pc.document['spw'], _pc.document['intent'], _pc.document['selectdata'], _pc.document['timerange'], _pc.document['uvrange'], _pc.document['antenna'], _pc.document['scan'], _pc.document['observation'], _pc.document['msselect'], _pc.document['solint'], _pc.document['combine'], _pc.document['freqdep'], _pc.document['calmode'], _pc.document['solnorm'], _pc.document['gaintable'], _pc.document['gainfield'], _pc.document['interp'], _pc.document['spwmap'], _pc.document['parang'] )
269 except Exception as exc:
270 _except_log('blcal', exc)
271 raise
272 finally:
273 task_result = _end_log( _logging_state_, 'blcal', task_result )
274 return task_result
276blcal = _blcal( )