Coverage for /wheeldirectory/casa-6.7.0-12-py3.10.el8/lib/py/lib/python3.10/site-packages/casatasks/listcal.py: 56%

27 statements  

« prev     ^ index     » next       coverage.py v7.6.4, created at 2024-10-31 19:53 +0000

1##################### generated by xml-casa (v2) from listcal.xml ################### 

2##################### b343a7988fdaf2c3b471d36e6403326b ############################## 

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_listcal import listcal as _listcal_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 

13 

14class _listcal: 

15 """ 

16 listcal ---- List antenna gain solutions 

17 

18  

19  

20 This task lists antenna gain solutions in tabular form. The table 

21 is organized as follows. Solutions are output by 

22 1) Spectral window, 

23 2) Antenna, 

24 3) Time, 

25 4) Channel, 

26 5) and Polarization; 

27 where the inner-most loop is over polarization. 

28  

29 The listcal output table contains two table headers. The top-level header 

30 is printed each time the spectral window changes. This header lists 

31 the spectral window ID (SpwID), the date of observation (Date), 

32 the calibration table name (CalTable), and the measurement set name (MS name). 

33  

34 A lower-level header is printed when the the top-level header is printed, 

35 when the antenna names change, and every `pagerows' of output. 

36 The lower-level header columns are described here: 

37  

38 Column Name Description 

39 ----------- ----------- 

40 Ant Antenna name (contains sub-columns: Amp, Phs, F) 

41 Time Visibility timestamp corresponding to gain solution 

42 Field Field name 

43 Chn Channel number 

44 Amp Complex solution amplitude 

45 Phs Complex solution phase 

46 F Flag 

47  

48 Elements of the ``F'' column contain an `F' when the datum is flagged, 

49 and ` ' (whitespace) when the datum is not flagged. 

50  

51 Presently, the polarization mode names (for example: R, L) 

52 are not given, but the ordering of the polrization modes (left-to-right) is 

53 equivalent to the order output by task listobs (see ``Feeds'' in listobs 

54 output). 

55  

56 Input Parameters: 

57  

58 vis Name of input visibility file 

59 default: none; example: vis='ngc5921.ms' 

60  

61 caltable Name of input calibration table 

62 default: none; example: caltable='ngc5921.gcal' 

63  

64 field Select data based on field ID(s) or name(s) 

65 default: ''==>all; example: field='1' 

66 field='0~2' field ids inclusive from 0 to 2 

67 field='3C*' all field names starting with 3C 

68  

69 antenna Select calibration data based on antenna 

70 default: ''-->all; example: antenna='5' 

71 antenna='5,6' antenna index 5 and 6 solutions 

72 antenna='VA05','VA06' VLA antenna 5 and 6 

73  

74 spw Select spectral window, channel to list 

75 default: '' --> All spws and channels; 

76 spw='2:34' spectral window 2, channel 34 

77 will only list one spw, one channel at a time 

78  

79 listfile write output to disk; will not overwrite 

80 default: '' --> write to screen 

81  

82 pagerows rows per page of listing 

83 default: 50; 0 --> do not paginate 

84  

85  

86 

87 --------- parameter descriptions --------------------------------------------- 

88 

89 vis Name of input visibility file 

90 caltable Input calibration table to list 

91 field Field name or index 

92 antenna Antenna name or index 

93 spw Spectral window and channel 

94 listfile Disk file to write output 

95 pagerows Rows per page 

96 RETURNS void 

97 

98 --------- examples ----------------------------------------------------------- 

99 

100  

101  

102 This task lists antenna gain solutions in tabular form. The table 

103 is organized as follows. Solutions are output by 

104 1) Spectral window, 

105 2) Antenna, 

106 3) Time, 

107 4) Channel, 

108 5) and Polarization; 

109 where the inner-most loop is over polarization. 

110  

111 The listcal output table contains two table headers. The top-level header 

112 is printed each time the spectral window changes. This header lists 

113 the spectral window ID (SpwID), the date of observation (Date), 

114 the calibration table name (CalTable), and the measurement set name (MS name). 

115  

116 A lower-level header is printed when the the top-level header is printed, 

117 when the antenna names change, and every `pagerows' of output. 

118 The lower-level header columns are described here: 

119  

120 Column Name Description 

121 ----------- ----------- 

122 Ant Antenna name (contains sub-columns: Amp, Phs, F) 

123 Time Visibility timestamp corresponding to gain solution 

124 Field Field name 

125 Chn Channel number 

126 Amp Complex solution amplitude 

127 Phs Complex solution phase 

128 F Flag 

129  

130 Elements of the ``F'' column contain an `F' when the datum is flagged, 

131 and ` ' (whitespace) when the datum is not flagged. 

132  

133 Presently, the polarization mode names (for example: R, L) 

134 are not given, but the ordering of the polrization modes (left-to-right) is 

135 equivalent to the order output by task listobs (see ``Feeds'' in listobs 

136 output). 

137  

138 Input Parameters: 

139  

140 vis Name of input visibility file 

141 default: none; example: vis='ngc5921.ms' 

142  

143 caltable Name of input calibration table 

144 default: none; example: caltable='ngc5921.gcal' 

145  

146 field Select data based on field ID(s) or name(s) 

147 default: ''==>all; example: field='1' 

148 field='0~2' field ids inclusive from 0 to 2 

149 field='3C*' all field names starting with 3C 

150  

151 antenna Select calibration data based on antenna name 

152 default: ''-->all; example: antenna='5'; 

153 antenna='5,6' antenna index 5 and 6 solutions 

154 antenna='VA05','VA06' VLA antenna 5 and 6 

155  

156 spw Select spectral window(s), channel(s) to list 

157 default: '' --> All spws and channels; 

158 spw='2:34' spectral window 2, channel 34; 

159 spw='1:5,3~5:7~9' spectral window 1, channel 

160 5 and spectral windows 3 thru 5, channels 

161 7 thru 9. 

162  

163 listfile write output to disk; will not overwrite 

164 default: '' --> write to screen 

165  

166 pagerows rows per page of listing 

167 default: 50; 0 --> do not paginate 

168  

169 Example: 

170  

171 # Get path to CASA home dir 

172 pathname=os.environ.get('CASAPATH').split()[0] 

173 # Select uv-data (FITS) file 

174 fitsdata=pathname+'/data/demo/NGC5921.fits' 

175 # MS name; write to current directory 

176 msdata='NGC5921.ms' 

177 # import FITS data to MS 

178 importuvfits(fitsfile=fitsdata, vis=msdata) 

179 # Create model data for flux calibrator 

180 setjy(vis=msdata) 

181 # Calibration table name 

182 caldata=msdata+'.bcal' 

183 # Bandpass calibration 

184 bandpass(vis=msdata, caltable=caldata) 

185 # List a subset of calibration factors 

186 listcal(vis=msdata, caltable=caldata, field='N5921_2, 0, 1', 

187 antenna='1,2,5;10~14', spw='0:1,0:22~25', pagerows=0) 

188  

189 Example Output: 

190  

191 SpwID = 0, Date = 1995/04/13, CalTable = NGC5921.ms.bcal (B Jones), MS name = /users/jcrossle/NRAO/casa/NGC5921.ms 

192 ------------------------------------------------------------------------------------------------------------------------------------------------------- 

193 | Ant = 1 | Ant = 2 | Ant = 5 | Ant = 10 | 

194 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| 

195 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------| 

196 09:21:46.0 1331+30500002_0 1|0.165 7.9 0.117 21.3 0.168 98.8 0.161 -116.8 0.146 -24.6 0.153 -109.7 0.163 -158.6 0.139 3.9 

197 10:05:27.9 1445+09900002_0 1|0.260 10.3 0.185 20.0 0.266 102.3 0.250 -116.1 0.233 -20.4 0.245 -108.6 0.255 -156.5 0.217 4.1 

198 10:09:05.3 N5921_2 1|0.047 54.2 0.030 50.7 0.057 -64.6 0.041 36.5 0.050 93.5 0.035 -13.9 0.079 97.5 0.048 -107.0 

199 | Ant = 11 | Ant = 12 | Ant = 13 | Ant = 14 | 

200 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| 

201 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------| 

202 09:21:46.0 1331+30500002_0 1|0.156 -112.6 0.128 -5.5 0.156 -178.4 0.169 -146.2 0.160 -177.4 0.148 -89.1 0.173 -117.0 0.145 141.5 

203 10:05:27.9 1445+09900002_0 1|0.243 -110.6 0.199 -5.7 0.251 -175.4 0.272 -146.9 0.249 -175.0 0.238 -89.5 0.268 -113.5 0.228 142.5 

204 10:09:05.3 N5921_2 1|0.054 47.1 0.056 105.5 0.042 -84.9 0.043 -18.9 0.058 72.4 0.055 155.6 0.040 -35.0 0.044 -153.6 

205 SpwID = 0, Date = 1995/04/13, CalTable = NGC5921.ms.bcal (B Jones), MS name = /users/jcrossle/NRAO/casa/NGC5921.ms 

206 ------------------------------------------------------------------------------------------------------------------------------------------------------- 

207 | Ant = 1 | Ant = 2 | Ant = 5 | Ant = 10 | 

208 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| 

209 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------| 

210 09:21:46.0 1331+30500002_0 22|0.319 4.6 0.323 -6.8 0.311 109.6 0.315 -109.0 0.286 -26.8 0.324 -106.8 0.303 -146.6 0.303 4.3 

211 09:21:46.0 1331+30500002_0 23|0.318 4.4 0.323 -6.8 0.309 109.7 0.315 -108.8 0.285 -26.8 0.325 -106.5 0.304 -146.2 0.304 4.6 

212 09:21:46.0 1331+30500002_0 24|0.318 4.2 0.323 -6.6 0.309 109.8 0.316 -108.6 0.285 -26.8 0.324 -106.6 0.302 -146.1 0.304 5.0 

213 09:21:46.0 1331+30500002_0 25|0.319 4.3 0.323 -6.6 0.308 109.5 0.315 -108.4 0.285 -26.7 0.323 -106.7 0.301 -145.9 0.303 5.1 

214 10:05:27.9 1445+09900002_0 22|0.502 7.0 0.508 -7.9 0.483 112.2 0.499 -108.5 0.451 -24.2 0.515 -106.2 0.481 -144.1 0.489 4.6 

215 10:05:27.9 1445+09900002_0 23|0.498 7.2 0.509 -8.2 0.489 112.6 0.502 -108.8 0.455 -23.9 0.513 -106.2 0.477 -144.0 0.480 5.0 

216 10:05:27.9 1445+09900002_0 24|0.496 6.3 0.506 -7.1 0.487 111.9 0.502 -108.3 0.450 -23.8 0.517 -106.1 0.473 -144.6 0.478 4.0 

217 10:05:27.9 1445+09900002_0 25|0.489 6.3 0.512 -8.2 0.483 113.0 0.498 -108.7 0.456 -24.3 0.507 -105.5 0.470 -144.4 0.476 4.3 

218 10:09:05.3 N5921_2 22|0.089 53.9 0.084 38.8 0.135 -84.0 0.148 54.9 0.100 94.2 0.112 4.4 0.112 90.6 0.115 -124.0 

219 10:09:05.3 N5921_2 23|0.068 50.4 0.073 31.5 0.117 -80.7 0.150 50.5 0.103 90.3 0.120 2.6 0.104 103.6 0.104 -121.5 

220 10:09:05.3 N5921_2 24|0.068 51.4 0.080 45.1 0.125 -89.0 0.146 47.3 0.106 99.9 0.122 8.8 0.102 95.9 0.099 -121.4 

221 10:09:05.3 N5921_2 25|0.060 45.8 0.060 42.5 0.124 -85.4 0.146 47.8 0.110 93.4 0.125 7.2 0.088 100.9 0.096 -115.9 

222 | Ant = 11 | Ant = 12 | Ant = 13 | Ant = 14 | 

223 Time Field Chn| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| Amp Phs F Amp Phs F| 

224 ----------|---------------|---|--------------|--------------|--------------|--------------|--------------|--------------|--------------|--------------| 

225 09:21:46.0 1331+30500002_0 22|0.302 -99.8 0.301 -10.5 0.341 169.8 0.350 -137.6 0.306 -167.6 0.308 -84.8 0.319 -103.6 0.316 143.7 

226 09:21:46.0 1331+30500002_0 23|0.301 -99.9 0.302 -10.6 0.341 169.7 0.349 -138.0 0.306 -167.4 0.307 -84.5 0.318 -103.6 0.316 143.8 

227 09:21:46.0 1331+30500002_0 24|0.300 -100.0 0.301 -10.9 0.342 169.6 0.348 -138.4 0.305 -167.4 0.306 -84.3 0.319 -103.4 0.317 143.4 

228 09:21:46.0 1331+30500002_0 25|0.301 -100.1 0.300 -11.0 0.339 169.9 0.347 -138.5 0.305 -167.4 0.306 -84.0 0.317 -103.2 0.315 143.5 

229 10:05:27.9 1445+09900002_0 22|0.478 -97.3 0.482 -9.7 0.535 171.3 0.544 -138.1 0.480 -165.1 0.487 -86.0 0.502 -100.2 0.503 144.6 

230 10:05:27.9 1445+09900002_0 23|0.481 -97.4 0.479 -10.4 0.531 171.4 0.549 -138.9 0.483 -165.3 0.489 -84.3 0.498 -99.7 0.501 144.7 

231 10:05:27.9 1445+09900002_0 24|0.482 -97.6 0.484 -10.1 0.532 172.7 0.544 -139.3 0.489 -165.3 0.476 -84.6 0.498 -100.3 0.502 144.6 

232 10:05:27.9 1445+09900002_0 25|0.479 -98.4 0.484 -10.1 0.534 172.4 0.553 -139.0 0.481 -165.4 0.479 -84.3 0.498 -100.3 0.497 145.0 

233 10:09:05.3 N5921_2 22|0.127 44.8 0.142 128.9 0.090 -94.4 0.090 -48.5 0.112 41.3 0.103 109.0 0.075 7.2 0.095 -120.1 

234 10:09:05.3 N5921_2 23|0.135 43.1 0.132 126.0 0.087 -89.3 0.103 -38.2 0.112 39.3 0.100 117.8 0.076 -3.4 0.098 -113.5 

235 10:09:05.3 N5921_2 24|0.135 49.4 0.137 136.1 0.092 -95.9 0.084 -42.7 0.104 49.9 0.120 117.6 0.087 2.9 0.097 -121.2 

236 10:09:05.3 N5921_2 25|0.144 49.8 0.119 130.0 0.086 -96.5 0.074 -42.8 0.109 41.5 0.124 120.8 0.087 0.4 0.104 -117.3 

237  

238 Listed 120 antenna solutions. 

239  

240  

241 

242 

243 """ 

244 

245 _info_group_ = """information, calibration""" 

246 _info_desc_ = """List antenna gain solutions""" 

247 

248 def __call__( self, vis='', caltable='', field='', antenna='', spw='', listfile='', pagerows=int(50) ): 

249 schema = {'vis': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'caltable': {'type': 'cReqPath', 'coerce': _coerce.expand_path}, 'field': {'type': 'cStr', 'coerce': _coerce.to_str}, 'antenna': {'type': 'cStr', 'coerce': _coerce.to_str}, 'spw': {'type': 'cStr', 'coerce': _coerce.to_str}, 'listfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'pagerows': {'type': 'cInt'}} 

250 doc = {'vis': vis, 'caltable': caltable, 'field': field, 'antenna': antenna, 'spw': spw, 'listfile': listfile, 'pagerows': pagerows} 

251 assert _pc.validate(doc,schema), create_error_string(_pc.errors) 

252 _logging_state_ = _start_log( 'listcal', [ 'vis=' + repr(_pc.document['vis']), 'caltable=' + repr(_pc.document['caltable']), 'field=' + repr(_pc.document['field']), 'antenna=' + repr(_pc.document['antenna']), 'spw=' + repr(_pc.document['spw']), 'listfile=' + repr(_pc.document['listfile']), 'pagerows=' + repr(_pc.document['pagerows']) ] ) 

253 task_result = None 

254 try: 

255 task_result = _listcal_t( _pc.document['vis'], _pc.document['caltable'], _pc.document['field'], _pc.document['antenna'], _pc.document['spw'], _pc.document['listfile'], _pc.document['pagerows'] ) 

256 except Exception as exc: 

257 _except_log('listcal', exc) 

258 raise 

259 finally: 

260 task_result = _end_log( _logging_state_, 'listcal', task_result ) 

261 return task_result 

262 

263listcal = _listcal( ) 

264