Coverage for /home/casatest/venv/lib/python3.12/site-packages/casatasks/tsdimaging.py: 56%

27 statements  

« prev     ^ index     » next       coverage.py v7.10.4, created at 2025-08-21 07:43 +0000

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

2##################### 713609c253d369e84269a826601df774 ############################## 

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_tsdimaging import tsdimaging as _tsdimaging_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 _tsdimaging: 

15 """ 

16 tsdimaging ---- SD task: imaging for total power and spectral data 

17 

18  

19 Task sdimaging creates an image from input single-dish data sets. 

20 The input can be either total power and spectral data. 

21  

22 The coordinate of output image is defined by four axes, i.e., two 

23 spatial axes, frequency and polarization axes.n 

24 By default, spatial coordinate of image is defined so that the all 

25 pointing directions in POINTING tables of input data sets are covered 

26 with the cell size, 1/3 of FWHM of primary beam of antennas in the 

27 first MS. Therefore, it is often easiest to leave spatial definitions 

28 at the default values. It is also possible to define spatial axes of 

29 the image by specifying the image center direction (phasecenter), 

30 number of image pixel (imsize) and size of the pixel (cell).n 

31 The frequency coordinate of image is defined by three parameters, 

32 the number of channels (nchan), the channel id/frequency/velocity of 

33 the first channel (start), and channel width (width).There are three 

34 modes available to define unit of start and width, i.e., 'channel' (use 

35 channel indices), 'frequency' (use frequency unit, e.g., 'GHz'), 

36 and 'velocity' (use velocity unit, e.g., 'km/s'). By default, nchan, 

37 start, and width are defined so that all selected spectral windows are 

38 covered with the channel width equal to separation of first two 

39 channels selected.n 

40 Finally, polarizations of image is defined by stokes parameter or 

41 polarization. For example, stokes='XXYY' produces an image cube with 

42 each plane contains the image of one of the polarizations, while 

43 stokes='I' produces a 'total intensity' or Stokes I image. 

44 The stokes parameter has a special option, 'pseudoI'. The option is 

45 introduced to support imaging of partially flagged correlations. 

46 Main difference between 'I' and 'pseudoI' is that the former only takes 

47 into account the data whose correlations are all valid (this is the 

48 Stokes I in the strict sense) while the latter accumulates partially 

49 flagged data in addition. Note that the 'pseudoI' option is compatible 

50 with 'I' for sdimaging task. 

51  

52 The task also supports various grid function (convolution kernel) to 

53 weight spectra as well as an option to remove the most extreme minimum 

54 and maximum (unweighted) values prior to computing the gridded pixel 

55 values. See description below for details of gridfunction available. 

56  

57  

58 

59 --------- parameter descriptions --------------------------------------------- 

60 

61 infiles a list of names of input SD Measurementsets (only MS is allowed for this task) 

62 outfile prefix of output images (.image, .weight) 

63 overwrite overwrite the output file if already exists [True, False] 

64 field select data by field IDs and names, e.g. \'3C2*\' (\'\'=all) 

65 spw select data by IF IDs (spectral windows), e.g. \'3,5,7\' (\'\'=all) 

66 antenna select data by antenna names or IDs, e.g, \'PM03\' (\'\' = all antennas) 

67 scan select data by scan numbers, e.g. \'21~23\' (\'\'=all) 

68 intent select data by observational intent, e.g. \'*ON_SOURCE*\' (\'\'=all) 

69 timerange select data by range of time, e.g. 20:15:00~20:16:00 (\'\'=all) 

70 outframe velocity frame of output image (''=current frame or LSRK for multiple-MS inputs) 

71 mode spectral gridding type [\'channel\', \'frequency\', \'velocity\'] 

72 nchan number of channels (planes) in output image (-1=all) 

73 start start of output spectral dimension, e.g. \'0\', \'110GHz\', \'-20km/s\' 

74 width width of output spectral channels 

75 veltype velocity definition 

76 specmode Spectral definition mode (cube, cubedata, cubesource) 

77 interpolation Spectral interpolation ["nearest", "linear", "cubic"] 

78 Interpolation rules to use when binning data channels onto image channels and evaluating visibility values at the centers of image channels. 

79 Note : 

80 - "linear" and "cubic" interpolation requires data points on both sides of each image frequency. Errors are therefore possible at edge channels, or near flagged data channels. When image channel width is much larger than the data channel width there is nothing much to be gained using linear or cubic thus not worth the extra computation involved. 

81 - If there are significant differences in the observation dates of the input MSes, "nearest" interpolation may cause some problems with frequency channel matching. 

82 pointingcolumn pointing data column to use 

83 convertfirst Specify whether the direction of the specified pointing column must be converted to image"s reference frame prior to being interpolated at data-taking time, and when. "never": interpolate against the pointing column, then convert. "always": interpolate against the beforehand converted pointing column. "auto": if there are less pointings than selected data rows convert first, else interpolate first 

84 projection map projection type 

85 imsize x and y image size in pixels, e.g., [64,64]. Single value: same for both spatial axes ([] = number of pixels to cover whole pointings in MSes) 

86 cell x and y cell size, (e.g., [\'8arcsec\',\'8arcsec\']. default unit arcmin. ('' = 1/3 of FWHM of primary beam) 

87 phasecenter image center direction: position or field index or ephemeris source info, e.g., \'J2000 17:30:15.0 -25.30.00.0\', \'MARS\'. (\'\' = the center of pointing directions in MSes) 

88 stokes stokes parameters or polarization types to image, e.g. \'I\', \'XX\' 

89 gridfunction gridding function for imaging (see description in help) 

90 convsupport convolution support for gridding 

91 truncate truncation radius for gridding 

92 gwidth HWHM for gaussian 

93 jwidth c-parameter for jinc function 

94 clipminmax Clip minimum and maximum value from each pixel. Note the benefit of clipping is lost when the number of integrations contributing to each gridded pixel is small, or where the incidence of spurious datapoints is approximately or greater than the number of beams (in area) encompassed by expected image. 

95 minweight Minimum weight ratio to the median of weight used in weight correction and weight beased masking 

96 brightnessunit Overwrite the brightness unit in image (\'\' = respect the unit in MS) [\'K\' or \'Jy/beam\']. 

97 If no unit is provided, the task examines unit keywords ('UNIT' and 'QuantumUnits' in turn) of data columns. 

98 Order of the examination is 'CORRECTED_DATA' - 'FLOAT_DATA' - 'DATA'. The order also represents the priority. 

99 When unit string is found, it will be used as brightness unit. 

100 restfreq rest frequency to assign to image, e.g., \'114.5GHz\'. When the default value \'\' is used, the task currently internally uses REST_FREQUENCY of SOURCE table or mean frequency of given spectral window as a default value. 

101 RETURNS void 

102 

103 --------- examples ----------------------------------------------------------- 

104 

105  

106 Keyword arguments: 

107 infiles -- a list of names of input SD Measurementsets 

108 example: 'm100.PM01.ms' 

109 ['m100.PM01.ms','m100.PM03.ms']; multiple MSes 

110 outfile -- prefix of output images 

111 Currently, four images are created by the task: 

112 .image -- target image 

113 .weight -- weight image 

114 .sumwt -- sumwt image 

115 .psf -- psf image (equivalent to weight image) 

116 .sumwt and .psf are kind of useless so far. image products 

117 will be improved later. 

118 default: '' 

119 example: 'mySDimage.im' 

120 overwrite -- overwrite the output file if already exists 

121 options: (bool) True,False 

122 default: False (do NOT overwrite) 

123 example: if True, existing file will be overwritten 

124 field -- select data by field IDs and names 

125 If field string is a non-negative integer, it is assumed to 

126 be a field index otherwise, it is assumed to be a 

127 field name 

128 default: '' (use all fields) 

129 example: field='3C2*' (all names starting with 3C2) 

130 field='0,4,5~7' (field IDs 0,4,5,6,7) 

131 field='0,3C273' (field ID 3 or filed named 3C273) 

132 For multiple MS input, a list of field strings can be used: 

133 field = ['0~2','0~4'] (field ids 0-2 for the first MS and 0-4 

134 for the second) 

135 field = '0~2' (field ids 0-2 for all input MSes) 

136 this selection is in addition to the other selections to data 

137 spw -- select data by spectral window IDs/channels 

138 NOTE: channels de-selected here will contain all zeros if 

139 selected by the parameter mode subparameters. 

140 default: '' (use all IFs and channels) 

141 example: spw='3,5,7' (IF IDs 3,5,7; all channels) 

142 spw='<2' (IF IDs less than 2, i.e., 0,1; all channels) 

143 spw='30~45GHz' (IF IDs with the center frequencies in range 30-45GHz; all channels) 

144 spw='0:5~61' (IF ID 0; channels 5 to 61; all channels) 

145 spw='3:10~20;50~60' (select multiple channel ranges within IF ID 3) 

146 spw='3:10~20,4:0~30' (select different channel ranges for IF IDs 3 and 4) 

147 spw='1~4;6:15~48' (for channels 15 through 48 for IF IDs 1,2,3,4 and 6) 

148 For multiple MS input, a list of spw strings can be used: 

149 spw=['0','0~3'] (spw ids 0 for the first MS and 0-3 for the second) 

150 spw='0~3' (spw ids 0-3 for all input MSes) 

151 this selection is in addition to the other selections to data 

152 antenna -- select data by antenna names or IDs 

153 If antenna string is a non-negative integer, it is 

154 assumed to be an antenna index, otherwise, it is 

155 considered an antenna name. 

156 default: '' (all baselines, i.e. all antenna in case of auto data) 

157 example: antenna='PM03' 

158 For multiple MS input, a list of antenna strings can be used: 

159 antenna=['5','6'] (antenna id5 for the first MS and 6 for the second) 

160 antenna='5' (antenna index 5 for all input MSes) 

161 this selection is in addition to the other selections to data 

162 scan -- select data by scan numbers 

163 default: '' (use all scans) 

164 example: scan='21~23' (scan IDs 21,22,23) 

165 For multiple MS input, a list of scan strings can be used: 

166 scan=['0~100','10~200'] (scan ids 0-100 for the first MS 

167 and 10-200 for the second) 

168 scan='0~100 (scan ids 0-100 for all input MSes) 

169 this selection is in addition to the other selections to data 

170 intent -- select data by observational intent, also referred to as 'scan intent' 

171 default: 'OBSERVE_TARGET#ON_SOURCE' (ALMA ON-source intent) 

172 example: intent='' (use all scan intents) 

173 intent='*ON_SOURCE*' (any valid scan-intent expression accepted by the MSSelection module can be specified) 

174 For multiple MS input, a list of scan-intent expressions can be used: 

175 intent=['ON_SOURCE','CALIBRATE_BANDPASS'] (scan intent ON_SOURCE for the first MS 

176 and CALIBRATE_BANDPASS for the second) 

177 this selection is in addition to the other selections to data 

178 mode -- spectral gridding type 

179 options: 'channel', 'velocity', 'frequency' 

180 default: 'channel' 

181 >>> mode expandable parameters 

182 nchan -- Total number of channels in the output image. 

183 default: -1; Automatically selects enough channels to cover 

184 data selected by 'spw' consistent with 'start' and 'width'. 

185 It is often easiest to leave nchan at the default value. 

186 example: nchan=100 

187 start -- First channel, velocity, or frequency. 

188 For mode='channel'; This selects the channel index number 

189 from the MS (0 based) that you want to correspond to the 

190 first channel of the output cube. The output cube will be 

191 in frequency space with the first channel having the 

192 frequency of the MS channel selected by start. start=0 

193 refers to the first channel in the first selected spw, even 

194 if that channel is de-selected in the spw parameter. 

195 Channels de-selected by the spw parameter will be filled with 

196 zeros if included by the start parameter. For example, 

197 spw=3~8:3~100 and start=2 will produce a cube that starts on 

198 the third channel (recall 0 based) of spw index 3, and the 

199 first channel will be blank. 

200 default: '' (the first input channel of first input spw) 

201 example: start=100 (mode='channel') 

202 start='22.3GHz' (mode='frequency') 

203 start='5.0km/s' (mode='velocity') 

204 width -- Output channel width 

205 For mode='channel', default=1; width>1 indicates channel averaging 

206 example: width=4. 

207 For mode= 'velocity' or 'frequency', default=''; width of 

208 first input channel, or more precisely, the difference 

209 in frequencies between the first two selected channels. 

210 -- For example if channels 1 and 3 are selected with spw, 

211 then the default width will be the difference between their 

212 frequencies, and not the width of channel 1. 

213 -- Similarly, if the selected data has uneven channel-spacing, 

214 the default width will be picked from the first two selected 

215 channels. In this case, please specify the desired width. 

216 When specifying the width, one must give units 

217 examples: width='1.0km/s', or width='24.2kHz'. 

218 Setting width>0 gives channels of increasing frequency for 

219 mode='frequency', and increasing velocity for mode='velocity'. 

220 veltype -- Velocity definition 

221 Options: 'radio','optical','true','relativistic' 

222 default: 'radio' 

223 specmode -- Spectral definition mode (cube, cubedata, cubesource) 

224 default: 'cube' 

225 Options: 'cube', 'cubedata', 'cubesource' 

226 'cube' : Spectral line imaging with one or more channels 

227 Parameters start, width,and nchan define the spectral 

228 coordinate system and can be specified either in terms 

229 of channel numbers, frequency or velocity in whatever 

230 spectral frame is specified in 'outframe'. 

231 All internal and output images are made with outframe as the 

232 base spectral frame. However imaging code internally uses the fixed 

233 spectral frame, LSRK for automatic internal software 

234 Doppler tracking so that a spectral line observed over an 

235 extended time range will line up appropriately. 

236 Therefore the output images have additional spectral frame conversion 

237 layer in LSRK on the top the base frame. 

238 'cubedata' : Spectral line imaging with one or more channels 

239 There is no internal software Doppler tracking so 

240 a spectral line observed over an extended time range 

241 may be smeared out in frequency. There is strictly 

242 no valid spectral frame with which to label the output 

243 images, but they will list the frame defined in the MS 

244 'cubesource': Spectral line imaging while 

245 tracking moving source (near field or solar system 

246 objects). The velocity of the source is accounted 

247 and the frequency reported is in the source frame. 

248 As there is not SOURCE frame defined, 

249 the frame reported will be REST (as it may not be 

250 in the rest frame emission region may be 

251 moving w.r.t the systemic velocity frame) 

252 outframe -- velocity reference frame of output image 

253 Options: '','LSRK','LSRD','BARY','GEO','TOPO','GALACTO', 

254 'LGROUP','CMB' 

255 default: ''; same as input data or 'LSRK' for multiple-MS inputs 

256 example: frame='bary' for Barycentric frame 

257 gridfunction -- gridding function for imaging 

258 options: 'BOX' (Box-car), 'SF' (Spheroidal), 

259 'PB' (Primary-beam), 'GAUSS' (Gaussian), 

260 'GJINC' (Gaussian*Jinc) 

261 default: 'BOX' 

262 example: 'SF' 

263 >>> gridfunction expandable parameter: 

264 convsupport -- convolution support for 'SF' 

265 default: -1 (use default for each gridfunction) 

266 example: 3 

267 truncate -- truncattion radius of convolution kernel. 

268 effective only for 'GAUSS' and 'GJINC'. 

269 default: '-1' (use default for each gridfunction) 

270 example: 3, '20arcsec', '3pixel' 

271 gwidth -- HWHM for gaussian. Effective only for 

272 'GAUSS' and 'GJINC'. 

273 default: '-1' (use default for each gridfunction) 

274 example: 3, '20arcsec', '3pixel' 

275 jwidth -- Width of jinc function. Effective only for 

276 'GJINC'. 

277 default: '-1' (use default for each gridfunction) 

278 example: 3, '20arcsec', '3pixel' 

279 imsize -- x and y image size in pixels, symmetric for single value 

280 default: [] (=cover all pointings in MS) 

281 example: imsize=200 (equivalent to [200,200]) 

282 cell -- x and y cell size. default unit arcmin 

283 default: '' (= 1/3 of FWHM of primary beam) 

284 example: cell=['0.2arcmin, 0.2arcmin'] 

285 cell='0.2arcmin' (equivalent to example above) 

286 phasecenter -- image center: direction measure, field ID, or 

287 ephemerides source information for moving source (solar system objects) 

288 default: '' (= the center of pointing directions in 

289 POINTING table of infiles) 

290 example: phasecenter=6 (field ID) 

291 phasecenter='J2000 13h44m00 -17d02m00' 

292 phasecenter='AZEL -123d48m29 15d41m41' 

293 phasecenter='MARS' 

294 phasecenter='myComet_ephem.tab' 

295 phasecenter='TRACKFIELD' 

296  

297 If the phasecenter is the name known major solar system object 

298 ('MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS', 

299 'NEPTUNE', 'PLUTO', 'SUN', 'MOON') or is an ephemerides table 

300 then that source is tracked and the background sources get smeared. 

301 There is a special case, when phasecenter='TRACKFIELD', which 

302 will use the ephemerides or polynomial phasecenter in the FIELD 

303 table of the MS's as the source center to track. 

304  

305 When moving source correction is applied, the source is fixed to 

306 the position at the beginning of on-source observations in the data. 

307 Direction reference frame of output image refers phasecenter ('J2000' 

308 if phasecenter is empty). 

309  

310 Caution: in case of specifying ephemeris table name, its name or path 

311 must not start with known major solar system object listed 

312 above (case-insensitive), otherwise, CASA will use its 

313 internal ephemeris data for phasecenter instead. In such case 

314 you need to add './' at the beginning so that the specified 

315 table will be used. For example, if you wish to explicitly 

316 specify ephemeris table attached to the input MS 'SunObs.ms', 

317 set phasecenter like './SunObs.ms/FIELD/ephemtab_name.tab'. 

318  

319 projection -- map projection type. See Calabretta & Greisen (2002) for detail. 

320 default: 'SIN' 

321 options: 'SIN', 'CAR', 'TAN', 'SFL' 

322 pointingcolumn -- pointing data column to use 

323 option: 'direction', 'target', 'pointing_offset', 'source_offset', encoder' 

324 default: 'direction' 

325 restfreq -- specify rest frequency to use for output image 

326 default: '' (refer input data) 

327 example: 1.0e11, '100GHz' 

328 stokes -- Stokes Planes to make 

329 default='I'; example: stokes='XXYY'; 

330 options: 'I','Q','U','V','IV','QU','IQ','UV','IQUV','RR','LL','XX','YY','RRLL','XXYY','pseudoI' 

331 Note : The 'pseudoI' option is a partial solution, allowing Stokes I imaging 

332 when either of the parallel-hand correlations are unflagged. 

333  

334 minweight -- Minimum weight ratio to the median of weight used in 

335 weight correction and weight based masking 

336 default: 0.1 

337 example: minweight = 0. 

338 brightnessunit -- Overwrite the brightness unit in image ['K' or 'Jy/beam']. 

339 If no unit is provided, the task examines unit keywords ('UNIT' and 'QuantumUnits' in turn) of data columns. 

340 Order of the examination is 'CORRECTED_DATA' - 'FLOAT_DATA' - 'DATA'. The order also represents the priority. 

341 When unit string is found, it will be used as brightness unit. 

342 default: '' (use the unit in MS) 

343 Options: '', 'K' (Kelvin), 'Jy/beam' 

344 clipminmax -- Clip minimum and maximum value from each pixel. 

345 Note the benefit of clipping is lost when the number of 

346 integrations contributing to each gridded pixel is small, 

347 or where the incidence of spurious datapoints is 

348 approximately or greater than the number of beams (in area) 

349 encompassed by expected image. 

350 default: False 

351 option: True, False 

352 interpolation -- Spectral interpolation. 

353 Interpolation rules to use when binning data channels onto image channels and 

354 evaluating visibility values at the centers of image channels. 

355 Note : 

356 - 'linear' and 'cubic' interpolation requires data points on both sides of each image frequency. 

357 Errors are therefore possible at edge channels, or near flagged data channels. 

358 When image channel width is much larger than the data channel width there is nothing much to be gained 

359 using linear or cubic thus not worth the extra computation involved. 

360 - If there are significant differences in observing dates of input MSes, some problems merely occur 

361 in frequency channel matching when 'nearest' interpolation. 

362 option: 'linear', 'nearest', 'cubic' 

363 default: 'linear' 

364  

365 ----------------- 

366 Gridding Kernel 

367 ----------------- 

368 The parameter gridfunction sets gridding function (convolution kernel) 

369 for imaging. Currently, the task supports 'BOX' (Box-car), 'SF' (Prolate 

370 Spheroidal Wave Function), 'GAUSS' (Gaussian), 'GJINC' (Gaussian*Jinc), 

371 where Jinc(x) = J_1(pi*x/c)/(pi*x/c) with a first order Bessel function 

372 J_1, and 'PB' (Primary Beam). For 'PB', correct antenna informations 

373 should be included in input file. 

374  

375 There are four subparameters for gridfunction: convsupport, truncate, 

376 gwidth, and jwidth. The convsupport is an integer specifying cut-off 

377 radius for 'SF' in units of pixel. By default (convsupport=-1), 

378 the cut-off radius is set to 3 pixels. The truncate is a cut-off 

379 radius for 'GAUSS' or 'GJINC'. It accepts integer, float, and 

380 string values of numeric plus unit. Allowed units are angular 

381 units such as 'deg', 'arcmin', 'arcsec', and 'pixel'. Default unit 

382 is 'pixel' so that string without unit or numerical values (integer 

383 or float) will be interpreted as radius in pixel. Default value 

384 for truncate, which is used when negative radius is set, is 3*HWHM 

385 for 'GAUSS' and radius at first null for 'GJINC'. The gwidth is 

386 the HWHM of gaussian for 'GAUSS' and 'GJINC'. Default value is 

387 sqrt(log(2)) pixel for 'GAUSS' and 2.52*sqrt(log(2)) pixel for 

388 'GJINC'. The jwidth specifies width of the jinc function (parameter 

389 'c' in the definition above). Default is 1.55 pixel. Both gwidth 

390 jwidth allows integer, float, or string of numeric plus unit. 

391 Default values for gwidth and jwidth are taken from Mangum et al. 

392 (2007). Formula for 'GAUSS' and 'GJINC' are taken from Table 1 in 

393 the paper, and are written as below using gwidth and jwidth: 

394  

395 GAUSS: exp[-log(2)*(|r|/gwidth)**2] 

396  

397 GJINC: J_1(pi*|r|/jwidth)/(pi*|r|/jwidth) 

398 * exp[-log(2)*(|r|/gwidth)^2] 

399  

400  

401 Reference: Mangum, et al. 2007, A&A, 474, 679-687 

402  

403 -------------------- 

404 Mask in Output Image 

405 -------------------- 

406 The parameter minweight defines a threshold of weight values 

407 to mask. The pixels in outfile whose weight is smaller than 

408 minweight*median(weight) are masked out. The task also creates 

409 a weight image with the name outfile.weight. 

410  

411  

412 

413 

414 """ 

415 

416 _info_group_ = """single dish""" 

417 _info_desc_ = """SD task: imaging for total power and spectral data""" 

418 

419 def __call__( self, infiles=[ ], outfile='', overwrite=False, field='', spw='', antenna='', scan='', intent='OBSERVE_TARGET#ON_SOURCE', timerange='', outframe='', mode='channel', nchan=int(-1), start=int(0), width=int(1), veltype='radio', specmode='cube', interpolation='linear', pointingcolumn='direction', convertfirst='never', projection='SIN', imsize=[ ], cell='', phasecenter='', stokes='I', gridfunction='BOX', convsupport=int(-1), truncate=int(-1), gwidth=int(-1), jwidth=int(-1), clipminmax=False, minweight=float(0.1), brightnessunit='', restfreq='' ): 

420 schema = {'infiles': {'type': 'cReqPathVec', 'coerce': [_coerce.to_list,_coerce.expand_pathvec]}, 'outfile': {'type': 'cStr', 'coerce': _coerce.to_str}, 'overwrite': {'type': 'cBool'}, 'field': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'spw': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'antenna': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'scan': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'intent': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'timerange': {'type': 'cStr', 'coerce': _coerce.to_str}, 'outframe': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'LSRK', 'CMB', 'geo', 'bary', 'GALACTO', 'GEO', 'TOPO', 'LSRD', 'lsrk', 'topo', 'LGROUP', 'BARY', 'lsrd', 'cmb', 'galacto', 'lgroup', '' ]}, 'mode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'channel', 'frequency', 'velocity' ]}, 'nchan': {'type': 'cInt'}, 'start': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'width': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'veltype': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'OPTICAL', 'RELATIVISTIC', 'radio', 'true', 'optical', 'RADIO', 'TRUE', 'relativistic' ]}, 'specmode': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'cube', 'cubedata', 'cubesource' ]}, 'interpolation': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'nearest', 'linear', 'cubic' ]}, 'pointingcolumn': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'TARGET', 'encoder', 'ENCODER', 'source_offset', 'pointing_offset', 'target', 'POINTING_OFFSET', 'DIRECTION', 'SOURCE_OFFSET', 'direction' ]}, 'convertfirst': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'never', 'auto', 'always' ]}, 'projection': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'sin', 'SIN', 'SFL', 'CAR', 'sfl', 'car', 'TAN', 'tan' ]}, 'imsize': {'anyof': [{'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'cell': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'phasecenter': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'stokes': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'I', 'IQUV', 'UV', 'RRLL', 'IQ', 'V', 'pseudoI', 'QU', 'YY', 'RR', 'Q', 'U', 'IV', 'XX', 'XXYY', 'LL' ]}, 'gridfunction': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'GJINC', 'pb', 'sf', 'GAUSS', 'PB', 'SF', 'gauss', 'BOX', 'box', 'gjinc' ]}, 'convsupport': {'type': 'cInt'}, 'truncate': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'gwidth': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'jwidth': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'clipminmax': {'type': 'cBool'}, 'minweight': {'type': 'cFloat', 'coerce': _coerce.to_float, 'min': 0}, 'brightnessunit': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ '', 'K', 'Jy/beam' ]}, 'restfreq': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}} 

421 doc = {'infiles': infiles, 'outfile': outfile, 'overwrite': overwrite, 'field': field, 'spw': spw, 'antenna': antenna, 'scan': scan, 'intent': intent, 'timerange': timerange, 'outframe': outframe, 'mode': mode, 'nchan': nchan, 'start': start, 'width': width, 'veltype': veltype, 'specmode': specmode, 'interpolation': interpolation, 'pointingcolumn': pointingcolumn, 'convertfirst': convertfirst, 'projection': projection, 'imsize': imsize, 'cell': cell, 'phasecenter': phasecenter, 'stokes': stokes, 'gridfunction': gridfunction, 'convsupport': convsupport, 'truncate': truncate, 'gwidth': gwidth, 'jwidth': jwidth, 'clipminmax': clipminmax, 'minweight': minweight, 'brightnessunit': brightnessunit, 'restfreq': restfreq} 

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

423 _logging_state_ = _start_log( 'tsdimaging', [ 'infiles=' + repr(_pc.document['infiles']), 'outfile=' + repr(_pc.document['outfile']), 'overwrite=' + repr(_pc.document['overwrite']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), 'antenna=' + repr(_pc.document['antenna']), 'scan=' + repr(_pc.document['scan']), 'intent=' + repr(_pc.document['intent']), 'timerange=' + repr(_pc.document['timerange']), 'outframe=' + repr(_pc.document['outframe']), 'mode=' + repr(_pc.document['mode']), 'nchan=' + repr(_pc.document['nchan']), 'start=' + repr(_pc.document['start']), 'width=' + repr(_pc.document['width']), 'veltype=' + repr(_pc.document['veltype']), 'specmode=' + repr(_pc.document['specmode']), 'interpolation=' + repr(_pc.document['interpolation']), 'pointingcolumn=' + repr(_pc.document['pointingcolumn']), 'convertfirst=' + repr(_pc.document['convertfirst']), 'projection=' + repr(_pc.document['projection']), 'imsize=' + repr(_pc.document['imsize']), 'cell=' + repr(_pc.document['cell']), 'phasecenter=' + repr(_pc.document['phasecenter']), 'stokes=' + repr(_pc.document['stokes']), 'gridfunction=' + repr(_pc.document['gridfunction']), 'convsupport=' + repr(_pc.document['convsupport']), 'truncate=' + repr(_pc.document['truncate']), 'gwidth=' + repr(_pc.document['gwidth']), 'jwidth=' + repr(_pc.document['jwidth']), 'clipminmax=' + repr(_pc.document['clipminmax']), 'minweight=' + repr(_pc.document['minweight']), 'brightnessunit=' + repr(_pc.document['brightnessunit']), 'restfreq=' + repr(_pc.document['restfreq']) ] ) 

424 task_result = None 

425 try: 

426 task_result = _tsdimaging_t( _pc.document['infiles'], _pc.document['outfile'], _pc.document['overwrite'], _pc.document['field'], _pc.document['spw'], _pc.document['antenna'], _pc.document['scan'], _pc.document['intent'], _pc.document['timerange'], _pc.document['outframe'], _pc.document['mode'], _pc.document['nchan'], _pc.document['start'], _pc.document['width'], _pc.document['veltype'], _pc.document['specmode'], _pc.document['interpolation'], _pc.document['pointingcolumn'], _pc.document['convertfirst'], _pc.document['projection'], _pc.document['imsize'], _pc.document['cell'], _pc.document['phasecenter'], _pc.document['stokes'], _pc.document['gridfunction'], _pc.document['convsupport'], _pc.document['truncate'], _pc.document['gwidth'], _pc.document['jwidth'], _pc.document['clipminmax'], _pc.document['minweight'], _pc.document['brightnessunit'], _pc.document['restfreq'] ) 

427 except Exception as exc: 

428 _except_log('tsdimaging', exc) 

429 raise 

430 finally: 

431 task_result = _end_log( _logging_state_, 'tsdimaging', task_result ) 

432 return task_result 

433 

434tsdimaging = _tsdimaging( ) 

435