Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/sdgaincal.py: 100%
27 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 07:19 +0000
1##################### generated by xml-casa (v2) from sdgaincal.xml #################
2##################### 3435b5a8876f7acffd0f57525a93684d ##############################
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_sdgaincal import sdgaincal as _sdgaincal_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 _sdgaincal:
15 """
16 sdgaincal ---- MS SD gain calibration task
22 --------- parameter descriptions ---------------------------------------------
24 infile name of input SD dataset (must be MS)
25 calmode gain calibration mode
26 radius radius of central region to be used for calibration
27 smooth smooth data or not
28 antenna select data by antenna name or ID, e.g. "PM03"
29 field select data by field IDs and names, e.g. "3C2*" ("" = all)
30 spw select data by spw IDs (spectral windows), e.g., "3,5,7" ("" = all)
31 scan select data by scan numbers, e.g. "21~23" (""=all)
32 intent select data by observation intent, e.g. "OBSERVE_TARGET#ON_SOURCE" (""=all)
33 applytable (List of) sky and/or tsys tables for pre-application
34 interp Interp type in time[,freq], per gaintable. default==linear,linear
35 spwmap Spectral window mappings to form for applytable(s)
36 Only used if callib=False
37 default: [] (apply solutions from each calibration spw to
38 the same MS spw only)
39 Any available calibration spw can be mechanically mapped to any
40 MS spw.
41 Examples:
42 spwmap=[0,0,1,1] means apply calibration
43 from cal spw = 0 to MS spw 0,1 and cal spw 1 to MS spws 2,3.
44 spwmap=[[0,0,1,1],[0,1,0,1]] (use a list of lists for multiple
45 applytables)
46 outfile name of output caltable
47 overwrite overwrite the output file if already exists
48 [1;42mRETURNS[1;m void
50 --------- examples -----------------------------------------------------------
53 Keyword arguments:
54 infile -- Name of input SD dataset
55 calmode -- Gain calibration mode. Currently, only 'doublecircle' is supported.
56 options: 'doublecircle'
57 default: 'doublecircle'
58 >>> calmode expandable parameter
59 radius -- Radius of the central region for double circle calibration.
60 Default ('') is a radius of the primary beam. If numeric value
61 is given, it is interpreted as a value in arcsec.
62 default: ''
63 options: '20arcsec', 20.0
64 smooth -- Whether apply smoothing during gain calibration or not.
65 options: (bool) True, False
66 default: True
67 antenna -- select data by antenna name or ID
68 default: '' (use all antennas)
69 example: 'PM03'
70 field -- select data by field IDs and names
71 default: '' (use all fields)
72 example: field='3C2*' (all names starting with 3C2)
73 field='0,4,5~7' (field IDs 0,4,5,6,7)
74 field='0,3C273' (field ID 0 or field named 3C273)
75 this selection is in addition to the other selections to data
76 spw -- select data by spw IDs (spectral windows)
77 NOTE this task only supports spw ID selction and ignores channel
78 selection.
79 default: '' (use all spws and channels)
80 example: spw='3,5,7' (spw IDs 3,5,7; all channels)
81 spw='<2' (spw IDs less than 2, i.e., 0,1; all channels)
82 spw='30~45GHz' (spw IDs with the center frequencies in range 30-45GHz; all channels)
83 this selection is in addition to the other selections to data
84 NOTE spw input must be '' (''= all) in calmode='tsys'.
85 scan -- select data by scan numbers
86 default: '' (use all scans)
87 example: scan='21~23' (scan IDs 21,22,23)
88 this selection is in addition to the other selections to data
89 NOTE scan input must be '' (''= all) in calmode='tsys'.
90 intent -- select data by observational intent, also referred to as 'scan intent'
91 default: '' (use all scan intents)
92 example: intent='*ON_SOURCE*' (any valid scan-intent expression accepted by the MSSelection module can be specified)
93 this selection is in addition to the other selections to data
94 applytable -- List of sky/Tsys calibration tables you want to pre-apply.
95 default: ''
96 >>> applytable expandable parameter
97 interp -- Interpolation type (in time[,freq]) to use for each gaintable.
98 When frequency interpolation is relevant (bandpass solutions,
99 frequency-dependent polcal solutions, ALMA Tsys)
100 separate time-dependent and freq-dependent interp
101 types with a comma (freq _after_ the comma).
102 Specifications for frequency are ignored when the
103 calibration table has no channel-dependence.
104 Time-dependent interp options ending in 'PD' enable a
105 "phase delay" correction per spw for non-channel-dependent
106 calibration types.
107 For multi-obsId datasets, 'perobs' can be appended to
108 the time-dependent interpolation specification to
109 enforce obsId boundaries when interpolating in time.
110 For multi-scan datasets, 'perscan' can be appended to
111 the time-dependent interpolation specification to
112 enforce scan boundaries when interpolating in time.
113 Add 'flag' to the freq-dependent interpolation options
114 to enforce channel-dependent flagging (rather than
115 interpolation/extrapolation).
116 default: '' --> 'linear,linear' for all gaintable(s)
117 example: interp='nearest' (in time, freq-dep will be
118 linear, if relevant)
119 interp='linear,cubic' (linear in time, cubic
120 in freq)
121 interp='linearperobs,splineflag' (linear in time
122 per obsId,
123 spline in
124 freq with
125 channelized
126 flagging)
127 interp=',spline' (spline in freq; linear in
128 time by default)
129 interp=['nearest,spline','linear'] (for multiple gaintables)
130 Options: Time: 'nearest', 'linear', 'nearestPD', 'linearPD'
131 Freq: 'nearest', 'linear', 'cubic', 'spline',
132 'nearestflag', 'linearflag', 'cubicflag', 'splineflag',
134 spwmap -- Spectral windows combinations to form for gaintable(s)
135 default: [] (apply solutions from each spw to that spw only)
136 Example: spwmap=[0,0,1,1] means apply the caltable solutions
137 from spw = 0 to the spw 0,1 and spw 1 to spw 2,3.
138 spwmap=[[0,0,1,1],[0,1,0,1]] (for multiple gaintables)
140 Complicated example:
142 gaintable=['tab1','tab2','tab3']
143 gainfield='3C286'
144 interp=['linear','nearest']
145 spwmap=[[],[0,0,2]]
147 This means: apply 3 cal tables, selecting only solutions for 3C286
148 from tab1 (but all fields from tab2 and tab3, indicated by
149 no gainfield entry for these files). Linear interpolation
150 (in time) will be used for 'tab1' and 'tab3' (default); 'tab2' will
151 use nearest. For the 'tab2', the calibration spws map
152 will be mapped to the data spws according to 0->0, 0->1, 2->2.
153 (I.e., for data spw=0 and 2, the spw mapping is one to one,
154 but data spw 1 will be calibrated by solutions from spw 0.)
156 outfile -- Name of output caltable.
157 default: '' (<infile>_<suffix> for calibration)
158 overwrite -- overwrite the output caltable if already exists
159 options: (bool) True,False
160 default: False
163 DESCRIPTION:
164 sdgaincal computes and removes a time-dependent gain variation in single-dish
165 data on a per-spectral-window and per-antenna basis. Presently the task
166 operates only on data taken with the ALMA fast-mapped, double-circle
167 observation modes [1]. This task exploits the fact that the double-circle mode
168 observes the same position in the center of the mapped field, approximately
169 circular every sub-cycle, and normalizes the gains throughout the entire
170 dataset, relative to the measured brightness at the center position.
172 Note that this gain calibration task is done independently of the atmosphere
173 (i.e. Tsys) and sky calibration steps. This can be applied through the sdcal
174 task. Alternatively, you can pass those caltables to applytable parameter to
175 apply them on-the-fly prior to gain calibration.
177 Presently, this task has only one calibration mode: calmode='doublecircle'.
178 In this mode, the size of the region that CASA regards as "the center" is
179 user-configurable via the expandable 'radius' (in arcsec) parameter (under
180 'calmode'). The default is to use the size of the primary beam. The data can
181 also be smoothed in the time domain, prior to computation of the gain variation.
182 Selection is by specral window/channels, field IDs, and antenna through the spw,
183 field, and antenna selection parameters. The default is to use all data for the
184 gain calibration. The caltable can be output with the 'outfile' parameter.
186 REFERENCE:
187 [1] Phillips et al, 2015. Fast Single-Dish Scans of the Sun Using ALMA
191 """
193 _info_group_ = """single dish"""
194 _info_desc_ = """ MS SD gain calibration task"""
196 def __call__( self, infile='', calmode='doublecircle', radius='', smooth=True, antenna='', field='', spw='', scan='', intent='', applytable='', interp='', spwmap=[ ], outfile='', overwrite=False ):
197 schema = {'infile': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'calmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'doublecircle' ]}, 'radius': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'smooth': {'type': 'cBool'}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'scan': {'type': 'cStr', 'coerce': _coerce.to_str}, 'intent': {'type': 'cStr', 'coerce': _coerce.to_str}, 'applytable': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'interp': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'spwmap': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}}
198 doc = {'infile': infile, 'calmode': calmode, 'radius': radius, 'smooth': smooth, 'antenna': antenna, 'field': field, 'spw': spw, 'scan': scan, 'intent': intent, 'applytable': applytable, 'interp': interp, 'spwmap': spwmap, 'outfile': outfile, 'overwrite': overwrite}
199 assert _pc.validate(doc,schema), create_error_string(_pc.errors)
200 _logging_state_ = _start_log( 'sdgaincal', [ 'infile=' + repr(_pc.document['infile']), 'calmode=' + repr(_pc.document['calmode']), 'radius=' + repr(_pc.document['radius']), 'smooth=' + repr(_pc.document['smooth']), 'antenna=' + repr(_pc.document['antenna']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'applytable=' + repr(_pc.document['applytable']), 'interp=' + repr(_pc.document['interp']), 'spwmap=' + repr(_pc.document['spwmap']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']) ] )
201 task_result = None
202 try:
203 task_result = _sdgaincal_t( _pc.document['infile'], _pc.document['calmode'], _pc.document['radius'], _pc.document['smooth'], _pc.document['antenna'], _pc.document['field'], _pc.document['spw'], _pc.document['scan'], _pc.document['intent'], _pc.document['applytable'], _pc.document['interp'], _pc.document['spwmap'], _pc.document['outfile'], _pc.document['overwrite'] )
204 except Exception as exc:
205 _except_log('sdgaincal', exc)
206 raise
207 finally:
208 task_result = _end_log( _logging_state_, 'sdgaincal', task_result )
209 return task_result
211sdgaincal = _sdgaincal( )