Coverage for /home/casatest/venv/lib/python3.12/site-packages/casatasks/sdintimaging.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 sdintimaging.xml ############## 

2##################### ca888a2f22e7dfabc903d68b3be18731 ############################## 

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_sdintimaging import sdintimaging as _sdintimaging_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 _sdintimaging: 

15 """ 

16 sdintimaging ----  

17 

18 Form images from interferometric visibilities and single dish image 

19 to reconstruct a sky model by joint deconvolution. 

20  

21 

22 --------- parameter descriptions --------------------------------------------- 

23 

24 usedata Output image type: 'int' - use interferometric data only;  

25 'sd' - use single dish data only; 

26 'sdint' - use both single dish and interferometric data (only Stokes I) 

27 sdimage Input single dish image 

28 This single dish Image cube must contain images per frequency channel (blanked for empty 

29 or flagged channels). 

30  

31 If the associated sdpsf parameter is set to an empty string to signal an automatic 

32 calculation of the SD PSF cube, this SD image cube must contain per-plane  

33 restoringbeams that represent the effect SDbeam per frequency. 

34 sdpsf Input single dish PSF image.  

35  

36 This single dish PSF cube must contain the effective SD beam in the center of the image, 

37 for each frequency channel, normalized to peak 1. The coordinate system should ideally  

38 be the same as the SD image cube and contain per-plane restoringbeams that represent the 

39 effect SD beam per frequency.  

40  

41 If the sdpsf is set to a blank string (sdpsf="") an approximate PSF cube will be automatically  

42 calculated internally by using per-plane restoring-beam information from the regridded sdimage 

43 to evaluate 2D Gaussians.  

44  

45 In the future, we will provide an option to auto-generate Airy disk beams derived from  

46 the specified dish diameter. 

47 sdgain A factor or gain to adjust single dish flux scale (to use in feather stage) 

48 dishdia Effective dish diameter of the SD telescope (meters) 

49 vis Name(s) of input visibility file(s) 

50 default: none; 

51 example: vis='ngc5921.ms' 

52 vis=['ngc5921a.ms','ngc5921b.ms']; multiple MSes 

53 selectdata Enable data selection parameters. 

54 field to image or mosaic. Use field id(s) or name(s). 

55 ['go listobs' to obtain the list id's or names] 

56 default: ''= all fields 

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

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

59 field name 

60 field='0~2'; field ids 0,1,2 

61 field='0,4,5~7'; field ids 0,4,5,6,7 

62 field='3C286,3C295'; field named 3C286 and 3C295 

63 field = '3,4C\*'; field id 3, all names starting with 4C 

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

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

66 for the second 

67 field = '0~2'; field ids 0-2 for all input MSes 

68 spw l window/channels 

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

70 selected by the parameter mode subparameters. 

71 default: ''=all spectral windows and channels 

72 spw='0~2,4'; spectral windows 0,1,2,4 (all channels) 

73 spw='0:5~61'; spw 0, channels 5 to 61 

74 spw='<2'; spectral windows less than 2 (i.e. 0,1) 

75 spw='0,10,3:3~45'; spw 0,10 all channels, spw 3, 

76 channels 3 to 45. 

77 spw='0~2:2~6'; spw 0,1,2 with channels 2 through 6 in each. 

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

79 spw=['0','0~3']; spw ids 0 for the first MS and 0-3 for the second 

80 spw='0~3' spw ids 0-3 for all input MS 

81 spw='3:10~20;50~60' for multiple channel ranges within spw id 3 

82 spw='3:10~20;50~60,4:0~30' for different channel ranges for spw ids 3 and 4 

83 spw='0:0~10,1:20~30,2:1;2;3'; spw 0, channels 0-10, 

84 spw 1, channels 20-30, and spw 2, channels, 1,2 and 3 

85 spw='1~4;6:15~48' for channels 15 through 48 for spw ids 1,2,3,4 and 6 

86 timerange Range of time to select from data 

87  

88 default: '' (all); examples, 

89 timerange = 'YYYY/MM/DD/hh:mm:ss~YYYY/MM/DD/hh:mm:ss' 

90 Note: if YYYY/MM/DD is missing date defaults to first 

91 day in data set 

92 timerange='09:14:0~09:54:0' picks 40 min on first day 

93 timerange='25:00:00~27:30:00' picks 1 hr to 3 hr 

94 30min on NEXT day 

95 timerange='09:44:00' pick data within one integration 

96 of time 

97 timerange='> 10:24:00' data after this time 

98 For multiple MS input, a list of timerange strings can be 

99 used: 

100 timerange=['09:14:0~09:54:0','> 10:24:00'] 

101 timerange='09:14:0~09:54:0''; apply the same timerange for 

102 all input MSes 

103 uvrange Select data within uvrange (default unit is meters) 

104 default: '' (all); example: 

105 uvrange='0~1000klambda'; uvrange from 0-1000 kilo-lambda 

106 uvrange='> 4klambda';uvranges greater than 4 kilo lambda 

107 For multiple MS input, a list of uvrange strings can be 

108 used: 

109 uvrange=['0~1000klambda','100~1000klamda'] 

110 uvrange='0~1000klambda'; apply 0-1000 kilo-lambda for all 

111 input MSes 

112 antenna Select data based on antenna/baseline 

113  

114 default: '' (all) 

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

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

117 considered an antenna name. 

118 antenna='5\&6'; baseline between antenna index 5 and 

119 index 6. 

120 antenna='VA05\&VA06'; baseline between VLA antenna 5 

121 and 6. 

122 antenna='5\&6;7\&8'; baselines 5-6 and 7-8 

123 antenna='5'; all baselines with antenna index 5 

124 antenna='05'; all baselines with antenna number 05 

125 (VLA old name) 

126 antenna='5,6,9'; all baselines with antennas 5,6,9 

127 index number 

128 For multiple MS input, a list of antenna strings can be 

129 used: 

130 antenna=['5','5\&6']; 

131 antenna='5'; antenna index 5 for all input MSes 

132 antenna='!DV14'; use all antennas except DV14 

133 scan Scan number range 

134  

135 default: '' (all) 

136 example: scan='1~5' 

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

138 scan=['0~100','10~200'] 

139 scan='0~100; scan ids 0-100 for all input MSes 

140 observation Observation ID range 

141 default: '' (all) 

142 example: observation='1~5' 

143 intent Scan Intent(s) 

144  

145 default: '' (all) 

146 example: intent='TARGET_SOURCE' 

147 example: intent='TARGET_SOURCE1,TARGET_SOURCE2' 

148 example: intent='TARGET_POINTING\*' 

149 datacolumn Data column to image (data or observed, corrected) 

150 default:'corrected' 

151 ( If 'corrected' does not exist, it will use 'data' instead ) 

152 imagename Pre-name of output images 

153  

154 example : imagename='try' 

155  

156 Output images will be (a subset of) : 

157  

158 try.psf - Point spread function 

159 try.residual - Residual image 

160 try.image - Restored image 

161 try.model - Model image (contains only flux components) 

162 try.sumwt - Single pixel image containing sum-of-weights. 

163 (for natural weighting, sensitivity=1/sqrt(sumwt)) 

164 try.pb - Primary beam model (values depend on the gridder used) 

165  

166 Widefield projection algorithms (gridder=mosaic,awproject) will 

167 compute the following images too. 

168 try.weight - FT of gridded weights or the 

169 un-normalized sum of PB-square (for all pointings) 

170 Here, PB = sqrt(weight) normalized to a maximum of 1.0 

171  

172 For multi-term wideband imaging, all relevant images above will 

173 have additional .tt0,.tt1, etc suffixes to indicate Taylor terms, 

174 plus the following extra output images. 

175 try.alpha - spectral index 

176 try.alpha.error - estimate of error on spectral index 

177 try.beta - spectral curvature (if nterms \> 2) 

178  

179 Tip : Include a directory name in 'imagename' for all 

180 output images to be sent there instead of the 

181 current working directory : imagename='mydir/try' 

182  

183 Tip : Restarting an imaging run without changing 'imagename' 

184 implies continuation from the existing model image on disk. 

185 - If 'startmodel' was initially specified it needs to be set to "" 

186 for the restart run (or sdintimaging will exit with an error message). 

187 - By default, the residual image and psf will be recomputed 

188 but if no changes were made to relevant parameters between 

189 the runs, set calcres=False, calcpsf=False to resume directly from 

190 the minor cycle without the (unnecessary) first major cycle. 

191 To automatically change 'imagename' with a numerical 

192 increment, set restart=False (see sdintimaging docs for 'restart'). 

193  

194 Note : All imaging runs will by default produce restored images. 

195 For a niter=0 run, this will be redundant and can optionally 

196 be turned off via the 'restoration=T/F' parameter. 

197 imsize Number of pixels 

198 example: 

199  

200 imsize = [350,250] 

201 imsize = 500 is equivalent to [500,500] 

202  

203 To take proper advantage of internal optimized FFT routines, the 

204 number of pixels must be even and factorizable by 2,3,5 only. 

205 To find the nearest optimal imsize to that desired by the user, please use the following tool method: 

206  

207 from casatools import synthesisutils 

208 su = synthesisutils() 

209 su.getOptimumSize(345)  

210 Output : 360 

211 cell Cell size 

212 example: cell=['0.5arcsec,'0.5arcsec'] or 

213 cell=['1arcmin', '1arcmin'] 

214 cell = '1arcsec' is equivalent to ['1arcsec','1arcsec'] 

215 phasecenter Phase center of the image (string or field id); if the phasecenter is the name known major solar system object ('MERCURY', 'VENUS', 'MARS', 'JUPITER', 'SATURN', 'URANUS', 'NEPTUNE', 'PLUTO', 'SUN', 'MOON') or is an ephemerides table then that source is tracked and the background sources get smeared. There is a special case, when phasecenter='TRACKFIELD', which will use the ephemerides or polynomial phasecenter in the FIELD table of the MS's as the source center to track. 

216 example: phasecenter=6 

217 phasecenter='J2000 19h30m00 -40d00m00' 

218 phasecenter='J2000 292.5deg -40.0deg' 

219 phasecenter='J2000 5.105rad -0.698rad' 

220 phasecenter='ICRS 13:05:27.2780 -049.28.04.458' 

221 phasecenter='myComet_ephem.tab' 

222 phasecenter='MOON' 

223 phasecenter='TRACKFIELD' 

224 stokes Stokes Planes to make 

225 default='I'; example: stokes='IQUV'; 

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

227  

228 Note: for parameter usedata='sdint', presently only stokes='I' is supported. 

229  

230 Note : Due to current internal code constraints, if any correlation pair 

231 is flagged, by default, no data for that row in the MS will be used. 

232 So, in an MS with XX,YY, if only YY is flagged, neither a 

233 Stokes I image nor an XX image can be made from those data points. 

234 In such a situation, please split out only the unflagged correlation into 

235 a separate MS. 

236  

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

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

239  

240 The remaining constraints shall be removed (where logical) in a future release. 

241 projection Coordinate projection 

242 Examples : SIN, NCP 

243 A list of supported (but untested) projections can be found here : 

244 http://casa.nrao.edu/active/docs/doxygen/html/classcasa_1_1Projection.html#a3d5f9ec787e4eabdce57ab5edaf7c0cd 

245 startmodel Name of starting model image 

246  

247 The contents of the supplied starting model image will be 

248 copied to the imagename.model before the run begins. 

249  

250 example : startmodel = 'singledish.im' 

251  

252 For deconvolver='mtmfs', one image per Taylor term must be provided. 

253 example : startmodel = ['try.model.tt0', 'try.model.tt1'] 

254 startmodel = ['try.model.tt0'] will use a starting model only 

255 for the zeroth order term. 

256 startmodel = ['','try.model.tt1'] will use a starting model only 

257 for the first order term. 

258  

259 This starting model can be of a different image shape and size from 

260 what is currently being imaged. If so, an image regrid is first triggered 

261 to resample the input image onto the target coordinate system. 

262  

263 A common usage is to set this parameter equal to a single dish image 

264  

265 Negative components in the model image will be included as is. 

266  

267 [ Note : If an error occurs during image resampling/regridding, 

268 please try using task imregrid to resample the starting model 

269 image onto a CASA image with the target shape and 

270 coordinate system before supplying it via startmodel ] 

271 specmode Spectral definition mode (mfs,cube,cubedata, cubesource) 

272  

273 mode='mfs' : Continuum imaging with only one output image channel. 

274 (mode='cont' can also be used here) 

275  

276 mode='cube' : Spectral line imaging with one or more channels 

277 Parameters start, width,and nchan define the spectral 

278 coordinate system and can be specified either in terms 

279 of channel numbers, frequency or velocity in whatever 

280 spectral frame is specified in 'outframe'. 

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

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

283 spectral frame, LSRK for automatic internal software 

284 Doppler tracking so that a spectral line observed over an 

285 extended time range will line up appropriately. 

286 Therefore the output images have additional spectral frame conversion 

287 layer in LSRK on the top the base frame. 

288  

289  

290 (Note : Even if the input parameters are specified in a frame 

291 other than LSRK, the viewer still displays spectral 

292 axis in LSRK by default because of the conversion frame 

293 layer mentioned above. The viewer can be used to relabel 

294 the spectral axis in any desired frame - via the spectral 

295 reference option under axis label properties in the 

296 data display options window.) 

297  

298  

299  

300  

301 mode='cubedata' : Spectral line imaging with one or more channels 

302 There is no internal software Doppler tracking so 

303 a spectral line observed over an extended time range 

304 may be smeared out in frequency. There is strictly 

305 no valid spectral frame with which to label the output 

306 images, but they will list the frame defined in the MS. 

307  

308 mode='cubesource': Spectral line imaging while 

309 tracking moving source (near field or solar system 

310 objects). The velocity of the source is accounted 

311 and the frequency reported is in the source frame. 

312 As there is not SOURCE frame defined, 

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

314 in the rest frame emission region may be 

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

316 reffreq Reference frequency of the output image coordinate system 

317  

318 Example : reffreq='1.5GHz' as a string with units. 

319  

320 By default, it is calculated as the middle of the selected frequency range. 

321  

322 For deconvolver='mtmfs' the Taylor expansion is also done about 

323 this specified reference frequency. 

324 nchan Number of channels in the output image 

325 For default (=-1), the number of channels will be automatically determined 

326 based on data selected by 'spw' with 'start' and 'width'. 

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

328 example: nchan=100 

329 start First channel (e.g. start=3,start=\'1.1GHz\',start=\'15343km/s\') 

330 of output cube images specified by data channel number (integer), 

331 velocity (string with a unit), or frequency (string with a unit). 

332 Default:''; The first channel is automatically determined based on 

333 the 'spw' channel selection and 'width'. 

334 When the channel number is used along with the channel selection 

335 in 'spw' (e.g. spw='0:6~100'), 

336 'start' channel number is RELATIVE (zero-based) to the selected 

337 channels in 'spw'. So for the above example, 

338 start=1 means that the first image channel is the second selected 

339 data channel, which is channel 7. 

340 For specmode='cube', when velocity or frequency is used it is 

341 interpreted with the frame defined in outframe. [The parameters of 

342 the desired output cube can be estimated by using the 'transform' 

343 functionality of 'plotms'] 

344 examples: start='5.0km/s'; 1st channel, 5.0km/s in outframe 

345 start='22.3GHz'; 1st channel, 22.3GHz in outframe 

346 width Channel width (e.g. width=2,width=\'0.1MHz\',width=\'10km/s\') of output cube images 

347 specified by data channel number (integer), velocity (string with a unit), or 

348 or frequency (string with a unit). 

349 Default:''; data channel width 

350 The sign of width defines the direction of the channels to be incremented. 

351 For width specified in velocity or frequency with '-' in front gives image channels in 

352 decreasing velocity or frequency, respectively. 

353 For specmode='cube', when velocity or frequency is used it is interpreted with 

354 the reference frame defined in outframe. 

355 examples: width='2.0km/s'; results in channels with increasing velocity 

356 width='-2.0km/s'; results in channels with decreasing velocity 

357 width='40kHz'; results in channels with increasing frequency 

358 width=-2; results in channels averaged of 2 data channels incremented from 

359 high to low channel numbers 

360 outframe Spectral reference frame in which to interpret \'start\' and \'width\' 

361 Options: '','LSRK','LSRD','BARY','GEO','TOPO','GALACTO','LGROUP','CMB' 

362 example: outframe='bary' for Barycentric frame 

363  

364 REST -- Rest frequency 

365 LSRD -- Local Standard of Rest (J2000) 

366 -- as the dynamical definition (IAU, [9,12,7] km/s in galactic coordinates) 

367 LSRK -- LSR as a kinematical (radio) definition 

368 -- 20.0 km/s in direction ra,dec = [270,+30] deg (B1900.0) 

369 BARY -- Barycentric (J2000) 

370 GEO --- Geocentric 

371 TOPO -- Topocentric 

372 GALACTO -- Galacto centric (with rotation of 220 km/s in direction l,b = [90,0] deg. 

373 LGROUP -- Local group velocity -- 308km/s towards l,b = [105,-7] deg (F. Ghigo) 

374 CMB -- CMB velocity -- 369.5km/s towards l,b = [264.4, 48.4] deg (F. Ghigo) 

375 DEFAULT = LSRK 

376 veltype Velocity type (radio, z, ratio, beta, gamma, optical) 

377 For start and/or width specified in velocity, specifies the velocity definition 

378 Options: 'radio','optical','z','beta','gamma','optical' 

379 NOTE: the viewer always defaults to displaying the 'radio' frame, 

380 but that can be changed in the position tracking pull down. 

381  

382 The different types (with F = f/f0, the frequency ratio), are: 

383  

384 Z = (-1 + 1/F) 

385 RATIO = (F) \* 

386 RADIO = (1 - F) 

387 OPTICAL == Z 

388 BETA = ((1 - F2)/(1 + F2)) 

389 GAMMA = ((1 + F2)/2F) \* 

390 RELATIVISTIC == BETA (== v/c) 

391 DEFAULT == RADIO 

392 Note that the ones with an '\*' have no real interpretation 

393 (although the calculation will proceed) if given as a velocity. 

394 restfreq List of rest frequencies or a rest frequency in a string. 

395 Specify rest frequency to use for output image. 

396 Currently it uses the first rest frequency in the list for translation of 

397 velocities. The list will be stored in the output images. 

398 Default: []; look for the rest frequency stored in the MS, if not available, 

399 use center frequency of the selected channels 

400 examples: restfreq=['1.42GHz'] 

401 restfreq='1.42GHz' 

402 interpolation Spectral interpolation (nearest,linear,cubic) 

403  

404 Interpolation rules to use when binning data channels onto image channels 

405 and evaluating visibility values at the centers of image channels. 

406  

407 Note : 'linear' and 'cubic' interpolation requires data points on both sides of 

408 each image frequency. Errors are therefore possible at edge channels, or near 

409 flagged data channels. When image channel width is much larger than the data 

410 channel width there is nothing much to be gained using linear or cubic thus 

411 not worth the extra computation involved. 

412 perchanweightdensity When calculating weight density for Briggs 

413 style weighting in a cube, this parameter 

414 determines whether to calculate the weight 

415 density for each channel independently  

416 (the default, True) 

417 or a common weight density for all of the selected 

418 data. This parameter has no 

419 meaning for continuum (specmode='mfs') 

420 imaging but for cube imaging 

421 perchanweightdensity=True is a recommended 

422 option that provides more uniform 

423 sensitivity per channel for cubes, but with 

424 generally larger psfs than the 

425 perchanweightdensity=False (prior behavior) 

426 option. When using Briggs style weight with 

427 perchanweightdensity=True, the imaging weight 

428 density calculations use only the weights of 

429 data that contribute specifically to that 

430 channel. On the other hand, when 

431 perchanweightdensity=False, the imaging 

432 weight density calculations sum all of the 

433 weights from all of the data channels 

434 selected whose (u,v) falls in a given uv cell 

435 on the weight density grid. Since the 

436 aggregated weights, in any given uv cell, 

437 will change depending on the number of 

438 channels included when imaging, the psf 

439 calculated for a given frequency channel will 

440 also necessarily change, resulting in 

441 variability in the psf for a given frequency 

442 channel when perchanweightdensity=False. In 

443 general, perchanweightdensity=False results 

444 in smaller psfs for the same value of 

445 robustness compared to 

446 perchanweightdensity=True, but the rms noise 

447 as a function of channel varies and increases 

448 toward the edge channels; 

449 perchanweightdensity=True provides more 

450 uniform sensitivity per channel for 

451 cubes. This may make it harder to find 

452 estimates of continuum when 

453 perchanweightdensity=False. If you intend to 

454 image a large cube in many smaller subcubes 

455 and subsequently concatenate, it is advisable 

456 to use perchanweightdensity=True to avoid 

457 surprisingly varying sensitivity and psfs 

458 across the concatenated cube. 

459 gridder Gridding options (standard, wproject, widefield, mosaic, awproject) 

460  

461 The following options choose different gridding convolution 

462 functions for the process of convolutional resampling of the measured 

463 visibilities onto a regular uv-grid prior to an inverse FFT. 

464 Model prediction (degridding) also uses these same functions. 

465 Several wide-field effects can be accounted for via careful choices of 

466 convolution functions. Gridding (degridding) runtime will rise in 

467 proportion to the support size of these convolution functions (in uv-pixels). 

468  

469 standard : Prolate Spheroid with 3x3 uv pixel support size 

470  

471 [ This mode can also be invoked using 'ft' or 'gridft' ] 

472  

473 wproject : W-Projection algorithm to correct for the widefield 

474 non-coplanar baseline effect. [Cornwell et.al 2008] 

475  

476 wprojplanes is the number of distinct w-values at 

477 which to compute and use different gridding convolution 

478 functions (see help for wprojplanes). 

479 Convolution function support size can range 

480 from 5x5 to few 100 x few 100. 

481  

482 [ This mode can also be invoked using 'wprojectft' ] 

483  

484 widefield : Facetted imaging with or without W-Projection per facet. 

485  

486 A set of facets x facets subregions of the specified image 

487 are gridded separately using their respective phase centers 

488 (to minimize max W). Deconvolution is done on the joint 

489 full size image, using a PSF from the first subregion. 

490  

491 wprojplanes=1 : standard prolate spheroid gridder per facet. 

492 wprojplanes > 1 : W-Projection gridder per facet. 

493 nfacets=1, wprojplanes > 1 : Pure W-Projection and no facetting 

494 nfacets=1, wprojplanes=1 : Same as standard,ft,gridft 

495  

496 A combination of facetting and W-Projection is relevant only for 

497 very large fields of view. 

498  

499 mosaic : A-Projection with azimuthally symmetric beams without 

500 sidelobes, beam rotation or squint correction. 

501 Gridding convolution functions per visibility are computed 

502 from FTs of PB models per antenna. 

503 This gridder can be run on single fields as well as mosaics. 

504  

505 VLA : PB polynomial fit model (Napier and Rots, 1982) 

506 EVLA : PB polynomial fit model (Perley, 2015) 

507 ALMA : Airy disks for a 10.7m dish (for 12m dishes) and 

508 6.25m dish (for 7m dishes) each with 0.75m 

509 blockages (Hunter/Brogan 2011). Joint mosaic 

510 imaging supports heterogeneous arrays for ALMA. 

511  

512 Typical gridding convolution function support sizes are 

513 between 7 and 50 depending on the desired 

514 accuracy (given by the uv cell size or image field of view). 

515  

516 [ This mode can also be invoked using 'mosaicft' or 'ftmosaic' ] 

517  

518 awproject : A-Projection with azimuthally asymmetric beams and 

519 including beam rotation, squint correction, 

520 conjugate frequency beams and W-projection. 

521 [Bhatnagar et.al, 2008] 

522  

523 Gridding convolution functions are computed from 

524 aperture illumination models per antenna and optionally 

525 combined with W-Projection kernels and a prolate spheroid. 

526 This gridder can be run on single fields as well as mosaics. 

527  

528 The awproject gridder is current not supported in the sdintimaging task. 

529 This feature will be added in the near future.  

530  

531 VLA : Uses ray traced model (VLA and EVLA) including feed 

532 leg and subreflector shadows, off-axis feed location 

533 (for beam squint and other polarization effects), and 

534 a Gaussian fit for the feed beams (Ref: Brisken 2009) 

535 ALMA : Similar ray-traced model as above (but the correctness 

536 of its polarization properties remains un-verified). 

537  

538 Typical gridding convolution function support sizes are 

539 between 7 and 50 depending on the desired 

540 accuracy (given by the uv cell size or image field of view). 

541 When combined with W-Projection they can be significantly larger. 

542  

543 [ This mode can also be invoked using 'awprojectft' ] 

544  

545 imagemosaic : (untested implementation) 

546 Grid and iFT each pointing separately and combine the 

547 images as a linear mosaic (weighted by a PB model) in 

548 the image domain before a joint minor cycle. 

549  

550 VLA/ALMA PB models are same as for gridder='mosaicft' 

551  

552 ------ Notes on PB models : 

553  

554 (1) Several different sources of PB models are used in the modes 

555 listed above. This is partly for reasons of algorithmic flexibility 

556 and partly due to the current lack of a common beam model 

557 repository or consensus on what beam models are most appropriate. 

558  

559 (2) For ALMA and gridder='mosaic', ray-traced (TICRA) beams 

560 are also available via the vpmanager tool. 

561 For example, call the following before the sdintimaging run. 

562 vp.setpbimage(telescope="ALMA", 

563 compleximage='/home/casa/data/trunk/alma/responses/ALMA_0_DV__0_0_360_0_45_90_348.5_373_373_GHz_ticra2007_VP.im', 

564 antnames=['DV'+'%02d'%k for k in range(25)]) 

565 vp.saveastable('mypb.tab') 

566 Then, supply vptable='mypb.tab' to sdintimaging. 

567  

568  

569 ------ Note on PB masks : 

570  

571 In sdintimaging, A-Projection gridders (mosaic and awproject) produce a 

572 .pb image and use the 'pblimit' subparameter to decide normalization 

573 cutoffs and construct an internal T/F mask in the .pb and .image images. 

574 However, this T/F mask cannot directly be used during deconvolution 

575 (which needs a 1/0 mask). There are two options for making a pb based 

576 deconvolution mask. 

577 -- Run sdintimaging with niter=0 to produce the .pb, construct a 1/0 image 

578 with the desired threshold (using ia.open('newmask.im'); 

579 ia.calc('iif("xxx.pb">0.3,1.0,0.0)');ia.close() for example), 

580 and supply it via the 'mask' parameter in a subsequent run 

581 (with calcres=F and calcpsf=F to restart directly from the minor cycle). 

582 -- Run sdintimaging with usemask='pb' for it to automatically construct 

583 a 1/0 mask from the internal T/F mask from .pb at a fixed 0.2 threshold. 

584  

585 ----- Making PBs for gridders other than mosaic,awproject 

586  

587 After the PSF generation, a PB is constructed using the same 

588 models used in gridder='mosaic' but just evaluated in the image 

589 domain without consideration to weights. 

590 facets Number of facets on a side 

591  

592 A set of (facets x facets) subregions of the specified image 

593 are gridded separately using their respective phase centers 

594 (to minimize max W). Deconvolution is done on the joint 

595 full size image, using a PSF from the first subregion/facet. 

596 psfphasecenter For mosaic use psf centered on this 

597 optional direction. You may need to use 

598 this if for example the mosaic does not 

599 have any pointing in the center of the 

600 image. Another reason; as the psf is 

601 approximate for a mosaic, this may help 

602 to deconvolve a non central bright source 

603 well and quickly. 

604  

605 example: 

606  

607 psfphasecenter=6 #center psf on field 6 

608 psfphasecenter='J2000 19h30m00 -40d00m00' 

609 psfphasecenter='J2000 292.5deg -40.0deg' 

610 psfphasecenter='J2000 5.105rad -0.698rad' 

611 psfphasecenter='ICRS 13:05:27.2780 -049.28.04.458' 

612 wprojplanes Number of distinct w-values at which to compute and use different 

613 gridding convolution functions for W-Projection 

614  

615 An appropriate value of wprojplanes depends on the presence/absence 

616 of a bright source far from the phase center, the desired dynamic 

617 range of an image in the presence of a bright far out source, 

618 the maximum w-value in the measurements, and the desired trade off 

619 between accuracy and computing cost. 

620  

621 As a (rough) guide, VLA L-Band D-config may require a 

622 value of 128 for a source 30arcmin away from the phase 

623 center. A-config may require 1024 or more. To converge to an 

624 appropriate value, try starting with 128 and then increasing 

625 it if artifacts persist. W-term artifacts (for the VLA) typically look 

626 like arc-shaped smears in a synthesis image or a shift in source 

627 position between images made at different times. These artifacts 

628 are more pronounced the further the source is from the phase center. 

629  

630 There is no harm in simply always choosing a large value (say, 1024) 

631 but there will be a significant performance cost to doing so, especially 

632 for gridder='awproject' where it is combined with A-Projection. 

633  

634 wprojplanes=-1 is an option for gridder='widefield' or 'wproject' 

635 in which the number of planes is automatically computed. 

636 vptable vpmanager 

637  

638 vptable="" : Choose default beams for different telescopes 

639 ALMA : Airy disks 

640 EVLA : old VLA models. 

641  

642 Other primary beam models can be chosen via the vpmanager tool. 

643  

644 Step 1 : Set up the vpmanager tool and save its state in a table 

645  

646 vp.setpbpoly(telescope='EVLA', coeff=[1.0, -1.529e-3, 8.69e-7, -1.88e-10]) 

647 vp.saveastable('myvp.tab') 

648  

649 Step 2 : Supply the name of that table in sdintimaging. 

650  

651 sdintimaging(....., vptable='myvp.tab',....) 

652  

653 Please see the documentation for the vpmanager for more details on how to 

654 choose different beam models. Work is in progress to update the defaults 

655 for EVLA and ALMA. 

656  

657 Note : AWProjection currently does not use this mechanism to choose 

658 beam models. It instead uses ray-traced beams computed from 

659 parameterized aperture illumination functions, which are not 

660 available via the vpmanager. So, gridder='awproject' does not allow 

661 the user to set this parameter. 

662 mosweight When doing Brigg's style weighting (including uniform) to perform the weight density calculation for each field indepedently if True. If False the weight density is calculated from the average uv distribution of all the fields. 

663 aterm Use aperture illumination functions during gridding 

664  

665 This parameter turns on the A-term of the AW-Projection gridder. 

666 Gridding convolution functions are constructed from aperture illumination 

667 function models of each antenna. 

668 psterm Include the Prolate Spheroidal (PS) funtion as the anti-aliasing  

669 operator in the gridding convolution functions used for gridding. 

670  

671 Setting this parameter to true is necessary when aterm is set to  

672 false. It can be set to false when aterm is set to true, though  

673 with this setting effects of aliasing may be there in the image,  

674 particularly near the edges. 

675  

676 When set to true, the .pb images will contain the fourier transform 

677 of the of the PS funtion. The table below enumarates the functional 

678 effects of the psterm, aterm and wprojplanes settings. PB referes to  

679 the Primary Beam and FT() refers to the Fourier transform operation. 

680  

681 Operation aterm psterm wprojplanes Contents of the .pb image 

682 ---------------------------------------------------------------------- 

683 AW-Projection True True >1 FT(PS) x PB 

684 False PB 

685  

686 A-Projection True True 1 FT(PS) x PB 

687 False PB 

688  

689 W-Projection False True >1 FT(PS) 

690  

691 Standard False True 1 FT(PS) 

692 wbawp Use frequency dependent A-terms 

693 Scale aperture illumination functions appropriately with frequency 

694 when gridding and combining data from multiple channels. 

695 cfcache Convolution function cache directory name 

696  

697 Name of a directory in which to store gridding convolution functions. 

698 This cache is filled at the beginning of an imaging run. This step can be time 

699 consuming but the cache can be reused across multiple imaging runs that 

700 use the same image parameters (cell size, image size , spectral data 

701 selections, wprojplanes, wbawp, psterm, aterm). The effect of the wbawp,  

702 psterm and aterm settings is frozen-in in the cfcache. Using an existing cfcache 

703 made with a different setting of these parameters will not reflect the current 

704 settings. 

705  

706 In a parallel execution, the construction of the cfcache is also parallelized  

707 and the time to compute scales close to linearly with the number of compute  

708 cores used. With the re-computation of Convolution Functions (CF) due to PA  

709 rotation turned-off (the computepastep parameter), the total number of in the 

710 cfcache can be computed as [No. of wprojplanes x No. of selected spectral windows x 4] 

711  

712 By default, cfcache = imagename + '.cf' 

713 usepointing The usepointing flag informs the gridder that it should utilize the pointing table 

714 to use the correct direction in which the antenna is pointing with respect to the pointing phasecenter. 

715 computepastep Parallactic angle interval after the AIFs are recomputed (deg) 

716  

717 This parameter controls the accuracy of the aperture illumination function 

718 used with AProjection for alt-az mount dishes where the AIF rotates on the 

719 sky as the synthesis image is built up. Once the PA in the data changes by  

720 the given interval, AIFs are re-computed at the new PA. 

721  

722 A value of 360.0 deg (the default) implies no re-computation due to PA rotation. 

723 AIFs are computed for the PA value of the first valid data received and used for  

724 all of the data. 

725 rotatepastep Parallactic angle interval after which the nearest AIF is rotated (deg)  

726  

727 Instead of recomputing the AIF for every timestep's parallactic angle, 

728 the nearest existing AIF is used and rotated 

729 after the PA changed by rotatepastep value. 

730  

731 A value of 360.0 deg (the default) disables rotation of the AIF. 

732  

733 For example, computepastep=360.0 and rotatepastep=5.0 will compute 

734 the AIFs at only the starting parallactic angle and all other timesteps will 

735 use a rotated version of that AIF at the nearest 5.0 degree point. 

736 pointingoffsetsigdev Corrections for heterogenous and time-dependent pointing  

737 offsets via AWProjection are controlled by this parameter.  

738 It is a vector of 2 ints or doubles each of which is interpreted  

739 in units of arcsec. Based on the first threshold, a clustering  

740 algorithm is applied to entries from the POINTING subtable  

741 of the MS to determine how distinct antenna groups for which 

742 the pointing offset must be computed separately. The second  

743 number controls how much a pointing change across time can  

744 be ignored and after which an antenna rebinning is required.  

745  

746  

747 Note : The default value of this parameter is [], due a programmatic constraint. 

748 If run with this value, it will internally pick [600,600] and exercise the 

749 option of using large tolerances (10arcmin) on both axes. Please choose 

750 a setting explicitly for runs that need to use this parameter.  

751  

752 Note : This option is available only for gridder='awproject' and usepointing=True and 

753 and has been validated primarily with VLASS on-the-fly mosaic data 

754 where POINTING subtables have been modified after the data are recorded. 

755  

756  

757 Examples of parameter usage :  

758  

759 [100.0,100.0] : Pointing offsets of 100 arcsec or less are considered  

760 small enough to be ignored. Using large values for both 

761 indicates a homogeneous array. 

762  

763  

764 [10.0, 100.0] : Based on entries in the POINTING subtable, antennas  

765 are grouped into clusters based on a 10arcsec bin size.  

766 All antennas in a bin are given a pointing offset calculated 

767 as the average of the offsets of all antennas in the bin. 

768 On the time axis, offset changes upto 100 arcsec will be ignored. 

769  

770 [10.0,10.0] : Calculate separate pointing offsets for each antenna group 

771 (with a 10 arcsec bin size). As a function of time, recalculate  

772 the antenna binning if the POINTING table entries change by 

773 more than 10 arcsec w.r.to the previously computed binning. 

774  

775 [1.0, 1.0] : Tight tolerances will imply a fully heterogenous situation where  

776 each antenna gets its own pointing offset. Also, time-dependent  

777 offset changes greater than 1 arcsec will trigger recomputes of  

778 the phase gradients. This is the most general situation and is also  

779 the most expensive option as it constructs and uses separate  

780 phase gradients for all baselines and timesteps.  

781  

782 For VLASS 1.1 data with two kinds of pointing offsets, the recommended 

783 setting is [ 30.0, 30.0 ]. 

784  

785 For VLASS 1.2 data with only the time-dependent pointing offsets, the 

786 recommended setting is [ 300.0, 30.0 ] to turn off the antenna grouping 

787 but to retain the time dependent corrections required from one timestep 

788 to the next. 

789 pblimit PB gain level at which to cut off normalizations 

790  

791 Divisions by .pb during normalizations have a cut off at a .pb gain 

792 level given by pblimit. Outside this limit, image values are set to zero. 

793 Additionally, by default, an internal T/F mask is applied to the .pb, .image and 

794 .residual images to mask out (T) all invalid pixels outside the pblimit area. 

795  

796 Note : This internal T/F mask cannot be used as a deconvolution mask. 

797 To do so, please follow the steps listed above in the Notes for the 

798 'gridder' parameter. 

799  

800 Note : To prevent the internal T/F mask from appearing in anything other 

801 than the .pb and .image.pbcor images, 'pblimit' can be set to a 

802 negative number. The absolute value will still be used as a valid 'pblimit'. 

803 A sdintimaging restart using existing output images on disk that already 

804 have this T/F mask in the .residual and .image but only pblimit set 

805 to a negative value, will remove this mask after the next major cycle. 

806 deconvolver Name of minor cycle algorithm (hogbom,clark,multiscale,mtmfs,mem,clarkstokes,asp) 

807  

808 Each of the following algorithms operate on residual images and psfs 

809 from the gridder and produce output model and restored images. 

810 Minor cycles stop and a major cycle is triggered when cyclethreshold 

811 or cycleniter are reached. For all methods, components are picked from 

812 the entire extent of the image or (if specified) within a mask. 

813  

814 hogbom : An adapted version of Hogbom Clean [Hogbom, 1974] 

815 - Find the location of the peak residual 

816 - Add this delta function component to the model image 

817 - Subtract a scaled and shifted PSF of the same size as the image 

818 from regions of the residual image where the two overlap. 

819 - Repeat 

820  

821 clark : An adapted version of Clark Clean [Clark, 1980] 

822 - Find the location of max(I^2+Q^2+U^2+V^2) 

823 - Add delta functions to each stokes plane of the model image 

824 - Subtract a scaled and shifted PSF within a small patch size 

825 from regions of the residual image where the two overlap. 

826 - After several iterations trigger a Clark major cycle to subtract 

827 components from the visibility domain, but without de-gridding. 

828 - Repeat 

829  

830 ( Note : 'clark' maps to imagermode='' in the old clean task. 

831 'clark_exp' is another implementation that maps to 

832 imagermode='mosaic' or 'csclean' in the old clean task 

833 but the behavior is not identical. For now, please 

834 use deconvolver='hogbom' if you encounter problems. ) 

835  

836 clarkstokes : Clark Clean operating separately per Stokes plane 

837  

838 (Note : 'clarkstokes_exp' is an alternate version. See above.) 

839  

840 multiscale : MultiScale Clean [Cornwell, 2008] 

841 - Smooth the residual image to multiple scale sizes 

842 - Find the location and scale at which the peak occurs 

843 - Add this multiscale component to the model image 

844 - Subtract a scaled,smoothed,shifted PSF (within a small 

845 patch size per scale) from all residual images 

846 - Repeat from step 2 

847  

848 mtmfs : Multi-term (Multi Scale) Multi-Frequency Synthesis [Rau and Cornwell, 2011] 

849 - Smooth each Taylor residual image to multiple scale sizes 

850 - Solve a NTxNT system of equations per scale size to compute 

851 Taylor coefficients for components at all locations 

852 - Compute gradient chi-square and pick the Taylor coefficients 

853 and scale size at the location with maximum reduction in 

854 chi-square 

855 - Add multi-scale components to each Taylor-coefficient 

856 model image 

857 - Subtract scaled,smoothed,shifted PSF (within a small patch size 

858 per scale) from all smoothed Taylor residual images 

859 - Repeat from step 2 

860  

861  

862 mem : Maximum Entropy Method [Cornwell and Evans, 1985] 

863 - Iteratively solve for values at all individual pixels via the 

864 MEM method. It minimizes an objective function of 

865 chi-square plus entropy (here, a measure of difference 

866 between the current model and a flat prior model). 

867  

868 (Note : This MEM implementation is not very robust. 

869 Improvements will be made in the future.) 

870  

871 asp : ASP Clean [Bhatnagar and Cornwell, 2004] 

872 scales List of scale sizes (in pixels) for multi-scale and mtmfs algorithms. 

873 --> scales=[0,6,20] 

874 This set of scale sizes should represent the sizes 

875 (diameters in units of number of pixels) 

876 of dominant features in the image being reconstructed. 

877  

878 The smallest scale size is recommended to be 0 (point source), 

879 the second the size of the synthesized beam and the third 3-5 

880 times the synthesized beam, etc. For example, if the synthesized 

881 beam is 10" FWHM and cell=2",try scales = [0,5,15]. 

882  

883 For numerical stability, the largest scale must be 

884 smaller than the image (or mask) size and smaller than or 

885 comparable to the scale corresponding to the lowest measured 

886 spatial frequency (as a scale size much larger than what the 

887 instrument is sensitive to is unconstrained by the data making 

888 it harder to recovery from errors during the minor cycle). 

889 nterms Number of Taylor coefficients in the spectral model 

890  

891 - nterms=1 : Assume flat spectrum source 

892 - nterms=2 : Spectrum is a straight line with a slope 

893 - nterms=N : A polynomial of order N-1 

894  

895 From a Taylor expansion of the expression of a power law, the 

896 spectral index is derived as alpha = taylorcoeff_1 / taylorcoeff_0 

897  

898 Spectral curvature is similarly derived when possible. 

899  

900 The optimal number of Taylor terms depends on the available 

901 signal to noise ratio, bandwidth ratio, and spectral shape of the 

902 source as seen by the telescope (sky spectrum x PB spectrum). 

903  

904 nterms=2 is a good starting point for wideband EVLA imaging 

905 and the lower frequency bands of ALMA (when fractional bandwidth 

906 is greater than 10%) and if there is at least one bright source for 

907 which a dynamic range of greater than few 100 is desired. 

908  

909 Spectral artifacts for the VLA often look like spokes radiating out from 

910 a bright source (i.e. in the image made with standard mfs imaging). 

911 If increasing the number of terms does not eliminate these artifacts, 

912 check the data for inadequate bandpass calibration. If the source is away 

913 from the pointing center, consider including wide-field corrections too. 

914  

915 (Note : In addition to output Taylor coefficient images .tt0,.tt1,etc 

916 images of spectral index (.alpha), an estimate of error on 

917 spectral index (.alpha.error) and spectral curvature (.beta, 

918 if nterms is greater than 2) are produced. 

919 - These alpha, alpha.error and beta images contain 

920 internal T/F masks based on a threshold computed 

921 as peakresidual/10. Additional masking based on 

922 .alpha/.alpha.error may be desirable. 

923 - .alpha.error is a purely empirical estimate derived 

924 from the propagation of error during the division of 

925 two noisy numbers (alpha = xx.tt1/xx.tt0) where the 

926 'error' on tt1 and tt0 are simply the values picked from 

927 the corresponding residual images. The absolute value 

928 of the error is not always accurate and it is best to interpret 

929 the errors across the image only in a relative sense.) 

930 smallscalebias A numerical control to bias the scales when using multi-scale or mtmfs algorithms. 

931 The peak from each scale's smoothed residual is 

932 multiplied by ( 1 - smallscalebias \* scale/maxscale ) 

933 to increase or decrease the amplitude relative to other scales, 

934 before the scale with the largest peak is chosen.  

935 Smallscalebias can be varied between -1.0 and 1.0.  

936 A score of 0.0 gives all scales equal weight (default).  

937 A score larger than 0.0 will bias the solution towards smaller scales.  

938 A score smaller than 0.0 will bias the solution towards larger scales. 

939 The effect of smallscalebias is more pronounced when using multi-scale relative to mtmfs. 

940 restoration e. 

941  

942 Construct a restored image : imagename.image by convolving the model 

943 image with a clean beam and adding the residual image to the result. 

944 If a restoringbeam is specified, the residual image is also 

945 smoothed to that target resolution before adding it in. 

946  

947 If a .model does not exist, it will make an empty one and create 

948 the restored image from the residuals ( with additional smoothing if needed ). 

949 With algorithm='mtmfs', this will construct Taylor coefficient maps from 

950 the residuals and compute .alpha and .alpha.error. 

951 restoringbeam ize to use. 

952  

953 - restoringbeam='' or [''] 

954 A Gaussian fitted to the PSF main lobe (separately per image plane). 

955  

956 - restoringbeam='10.0arcsec' 

957 Use a circular Gaussian of this width for all planes 

958  

959 - restoringbeam=['8.0arcsec','10.0arcsec','45deg'] 

960 Use this elliptical Gaussian for all planes 

961  

962 - restoringbeam='common' 

963 Automatically estimate a common beam shape/size appropriate for 

964 all planes. 

965  

966 Note : For any restoring beam different from the native resolution 

967 the model image is convolved with the beam and added to 

968 residuals that have been convolved to the same target resolution. 

969 pbcor the output restored image 

970  

971 A new image with extension .image.pbcor will be created from 

972 the evaluation of .image / .pb for all pixels above the specified pblimit. 

973  

974 Note : Stand-alone PB-correction can be triggered by re-running 

975 sdintimaging with the appropriate imagename and with 

976 niter=0, calcpsf=False, calcres=False, pbcor=True, vptable='vp.tab' 

977 ( where vp.tab is the name of the vpmanager file. 

978 See the inline help for the 'vptable' parameter ) 

979  

980 Note : Multi-term PB correction that includes a correction for the 

981 spectral index of the PB has not been enabled for the 4.7 release. 

982 Please use the widebandpbcor task instead. 

983 ( Wideband PB corrections are required when the amplitude of the 

984 brightest source is known accurately enough to be sensitive 

985 to the difference in the PB gain between the upper and lower 

986 end of the band at its location. As a guideline, the artificial spectral 

987 index due to the PB is -1.4 at the 0.5 gain level and less than -0.2 

988 at the 0.9 gain level at the middle frequency ) 

989 weighting Weighting scheme (natural,uniform,briggs,superuniform,radial, briggsabs) 

990  

991 During gridding of the dirty or residual image, each visibility value is 

992 multiplied by a weight before it is accumulated on the uv-grid. 

993 The PSF's uv-grid is generated by gridding only the weights (weightgrid). 

994  

995 weighting='natural' : Gridding weights are identical to the data weights 

996 from the MS. For visibilities with similar data weights, 

997 the weightgrid will follow the sample density 

998 pattern on the uv-plane. This weighting scheme 

999 provides the maximum imaging sensitivity at the 

1000 expense of a possibly fat PSF with high sidelobes. 

1001 It is most appropriate for detection experiments 

1002 where sensitivity is most important. 

1003  

1004 weighting='uniform' : Gridding weights per visibility data point are the 

1005 original data weights divided by the total weight of 

1006 all data points that map to the same uv grid cell : 

1007 ' data_weight / total_wt_per_cell '. 

1008  

1009 The weightgrid is as close to flat as possible resulting 

1010 in a PSF with a narrow main lobe and suppressed 

1011 sidelobes. However, since heavily sampled areas of 

1012 the uv-plane get down-weighted, the imaging 

1013 sensitivity is not as high as with natural weighting. 

1014 It is most appropriate for imaging experiments where 

1015 a well behaved PSF can help the reconstruction. 

1016  

1017 weighting='briggs' : Gridding weights per visibility data point are given by 

1018 'data_weight / ( A \* total_wt_per_cell + B ) ' where 

1019 A and B vary according to the 'robust' parameter. 

1020  

1021 robust = -2.0 maps to A=1,B=0 or uniform weighting. 

1022 robust = +2.0 maps to natural weighting. 

1023 (robust=0.5 is equivalent to robust=0.0 in AIPS IMAGR.) 

1024  

1025 Robust/Briggs weighting generates a PSF that can 

1026 vary smoothly between 'natural' and 'uniform' and 

1027 allow customized trade-offs between PSF shape and 

1028 imaging sensitivity. 

1029 weighting='briggsabs' : Experimental option. 

1030 Same as Briggs except the formula is different A= 

1031 robust\*robust and B is dependent on the 

1032 noise per visibility estimated. Giving noise='0Jy' 

1033 is a not a reasonable option. 

1034 In this mode (or formula) robust values 

1035 from -2.0 to 0.0 only make sense (2.0 and 

1036 -2.0 will get the same weighting) 

1037  

1038 weighting='superuniform' : This is similar to uniform weighting except that 

1039 the total_wt_per_cell is replaced by the 

1040 total_wt_within_NxN_cells around the uv cell of 

1041 interest. ( N = subparameter 'npixels' ) 

1042  

1043 This method tends to give a PSF with inner 

1044 sidelobes that are suppressed as in uniform 

1045 weighting but with far-out sidelobes closer to 

1046 natural weighting. The peak sensitivity is also 

1047 closer to natural weighting. 

1048  

1049 weighting='radial' : Gridding weights are given by ' data_weight \* uvdistance ' 

1050  

1051 This method approximately minimizes rms sidelobes 

1052 for an east-west synthesis array. 

1053  

1054 weighting='briggsbwtaper' : A modified version of Briggs weighting for cubes where an inverse uv taper, 

1055 which is proportional to the fractional bandwidth of the entire cube, 

1056 is applied per channel. The objective is to modify cube (perchanweightdensity = True) 

1057 imaging weights to have a similar density to that of the continuum imaging weights. 

1058 This is currently an experimental weighting scheme being developed for ALMA. 

1059  

1060  

1061 For more details on weighting please see Chapter3 

1062 of Dan Briggs' thesis (http://www.aoc.nrao.edu/dissertations/dbriggs) 

1063 robust Robustness parameter for Briggs weighting. 

1064  

1065 robust = -2.0 maps to uniform weighting. 

1066 robust = +2.0 maps to natural weighting. 

1067 (robust=0.5 is equivalent to robust=0.0 in AIPS IMAGR.) 

1068 noise noise parameter for briggs abs mode weighting 

1069 npixels Number of pixels to determine uv-cell size for super-uniform weighting 

1070 (0 defaults to -/+ 3 pixels) 

1071  

1072 npixels -- uv-box used for weight calculation 

1073 a box going from -npixel/2 to +npixel/2 on each side 

1074 around a point is used to calculate weight density. 

1075  

1076 npixels=2 goes from -1 to +1 and covers 3 pixels on a side. 

1077  

1078 npixels=0 implies a single pixel, which does not make sense for 

1079 superuniform weighting. Therefore, if npixels=0 it will 

1080 be forced to 6 (or a box of -3pixels to +3pixels) to cover 

1081 7 pixels on a side. 

1082 uvtaper uv-taper on outer baselines in uv-plane 

1083  

1084 Apply a Gaussian taper in addition to the weighting scheme specified 

1085 via the 'weighting' parameter. Higher spatial frequencies are weighted 

1086 down relative to lower spatial frequencies to suppress artifacts 

1087 arising from poorly sampled areas of the uv-plane. It is equivalent to 

1088 smoothing the PSF obtained by other weighting schemes and can be 

1089 specified either as a Gaussian in uv-space (eg. units of lambda) 

1090 or as a Gaussian in the image domain (eg. angular units like arcsec). 

1091  

1092 uvtaper = [bmaj, bmin, bpa] 

1093  

1094 NOTE: the on-sky FWHM in arcsec is roughly the uv taper/200 (klambda). 

1095 default: uvtaper=[]; no Gaussian taper applied 

1096 example: uvtaper=['5klambda'] circular taper 

1097 FWHM=5 kilo-lambda 

1098 uvtaper=['5klambda','3klambda','45.0deg'] 

1099 uvtaper=['10arcsec'] on-sky FWHM 10 arcseconds 

1100 uvtaper=['300.0'] default units are lambda 

1101 in aperture plane 

1102 niter Maximum number of iterations 

1103  

1104 A stopping criterion based on total iteration count. 

1105 Currently the parameter type is defined as an integer therefore the integer value  

1106 larger than 2147483647 will not be set properly as it causes an overflow. 

1107  

1108 Iterations are typically defined as the selecting one flux component 

1109 and partially subtracting it out from the residual image. 

1110  

1111 niter=0 : Do only the initial major cycle (make dirty image, psf, pb, etc) 

1112  

1113 niter larger than zero : Run major and minor cycles. 

1114  

1115 Note : Global stopping criteria vs major-cycle triggers 

1116  

1117 In addition to global stopping criteria, the following rules are 

1118 used to determine when to terminate a set of minor cycle iterations 

1119 and trigger major cycles [derived from Cotton-Schwab Clean, 1984] 

1120  

1121 'cycleniter' : controls the maximum number of iterations per image 

1122 plane before triggering a major cycle. 

1123 'cyclethreshold' : Automatically computed threshold related to the 

1124 max sidelobe level of the PSF and peak residual. 

1125 Divergence, detected as an increase of 10% in peak residual from the 

1126 minimum so far (during minor cycle iterations) 

1127  

1128 The first criterion to be satisfied takes precedence. 

1129  

1130 Note : Iteration counts for cubes or multi-field images : 

1131 For images with multiple planes (or image fields) on which the 

1132 deconvolver operates in sequence, iterations are counted across 

1133 all planes (or image fields). The iteration count is compared with 

1134 'niter' only after all channels/planes/fields have completed their 

1135 minor cycles and exited either due to 'cycleniter' or 'cyclethreshold'. 

1136 Therefore, the actual number of iterations reported in the logger 

1137 can sometimes be larger than the user specified value in 'niter'. 

1138 For example, with niter=100, cycleniter=20,nchan=10,threshold=0, 

1139 a total of 200 iterations will be done in the first set of minor cycles 

1140 before the total is compared with niter=100 and it exits. 

1141  

1142 Note : Additional global stopping criteria include 

1143 - no change in peak residual across two major cycles 

1144 - a 50% or more increase in peak residual across one major cycle 

1145 gain Loop gain 

1146  

1147 Fraction of the source flux to subtract out of the residual image 

1148 for the CLEAN algorithm and its variants. 

1149  

1150 A low value (0.2 or less) is recommended when the sky brightness 

1151 distribution is not well represented by the basis functions used by 

1152 the chosen deconvolution algorithm. A higher value can be tried when 

1153 there is a good match between the true sky brightness structure and 

1154 the basis function shapes. For example, for extended emission, 

1155 multiscale clean with an appropriate set of scale sizes will tolerate 

1156 a higher loop gain than Clark clean (for example). 

1157 threshold Stopping threshold (number in units of Jy, or string) 

1158  

1159 A global stopping threshold that the peak residual (within clean mask) 

1160 across all image planes is compared to. 

1161  

1162 threshold = 0.005 : 5mJy 

1163 threshold = '5.0mJy' 

1164  

1165 Note : A 'cyclethreshold' is internally computed and used as a major cycle 

1166 trigger. It is related what fraction of the PSF can be reliably 

1167 used during minor cycle updates of the residual image. By default 

1168 the minor cycle iterations terminate once the peak residual reaches 

1169 the first sidelobe level of the brightest source. 

1170  

1171 'cyclethreshold' is computed as follows using the settings in 

1172 parameters 'cyclefactor','minpsffraction','maxpsffraction','threshold' : 

1173  

1174 psf_fraction = max_psf_sidelobe_level \* 'cyclefactor' 

1175 psf_fraction = max(psf_fraction, 'minpsffraction'); 

1176 psf_fraction = min(psf_fraction, 'maxpsffraction'); 

1177 cyclethreshold = peak_residual \* psf_fraction 

1178 cyclethreshold = max( cyclethreshold, 'threshold' ) 

1179  

1180 If nsigma is set (>0.0), the N-sigma threshold is calculated (see 

1181 the description under nsigma), then cyclethreshold is further modified as, 

1182  

1183 cyclethreshold = max( cyclethreshold, nsgima_threshold ) 

1184  

1185  

1186 'cyclethreshold' is made visible and editable only in the 

1187 interactive GUI when sdintimaging is run with interactive=True. 

1188 nsigma Multiplicative factor for rms-based threshold stopping 

1189  

1190 N-sigma threshold is calculated as nsigma \* rms value per image plane determined 

1191 from a robust statistics. For nsigma > 0.0, in a minor cycle, a maximum of the two values, 

1192 the N-sigma threshold and cyclethreshold, is used to trigger a major cycle 

1193 (see also the descreption under 'threshold'). 

1194 Set nsigma=0.0 to preserve the previous sdintimaging behavior without this feature. 

1195 The top level parameter, fastnoise is relevant for the rms noise calculation which is used  

1196 to determine the threshold. 

1197 cycleniter Maximum number of minor-cycle iterations (per plane) before triggering 

1198 a major cycle 

1199  

1200 For example, for a single plane image, if niter=100 and cycleniter=20, 

1201 there will be 5 major cycles after the initial one (assuming there is no 

1202 threshold based stopping criterion). At each major cycle boundary, if 

1203 the number of iterations left over (to reach niter) is less than cycleniter, 

1204 it is set to the difference. 

1205  

1206 Note : cycleniter applies per image plane, even if cycleniter x nplanes 

1207 gives a total number of iterations greater than 'niter'. This is to 

1208 preserve consistency across image planes within one set of minor 

1209 cycle iterations. 

1210 cyclefactor Scaling on PSF sidelobe level to compute the minor-cycle stopping threshold. 

1211  

1212 Please refer to the Note under the documentation for 'threshold' that 

1213 discussed the calculation of 'cyclethreshold' 

1214  

1215 cyclefactor=1.0 results in a cyclethreshold at the first sidelobe level of 

1216 the brightest source in the residual image before the minor cycle starts. 

1217  

1218 cyclefactor=0.5 allows the minor cycle to go deeper. 

1219 cyclefactor=2.0 triggers a major cycle sooner. 

1220 minpsffraction PSF fraction that marks the max depth of cleaning in the minor cycle 

1221  

1222 Please refer to the Note under the documentation for 'threshold' that 

1223 discussed the calculation of 'cyclethreshold' 

1224  

1225 For example, minpsffraction=0.5 will stop cleaning at half the height of 

1226 the peak residual and trigger a major cycle earlier. 

1227 maxpsffraction PSF fraction that marks the minimum depth of cleaning in the minor cycle 

1228  

1229 Please refer to the Note under the documentation for 'threshold' that 

1230 discussed the calculation of 'cyclethreshold' 

1231  

1232 For example, maxpsffraction=0.8 will ensure that at least the top 20 

1233 percent of the source will be subtracted out in the minor cycle even if 

1234 the first PSF sidelobe is at the 0.9 level (an extreme example), or if the 

1235 cyclefactor is set too high for anything to get cleaned. 

1236 interactive Modify masks and parameters at runtime 

1237  

1238 interactive=True will trigger an interactive GUI at every major cycle 

1239 boundary (after the major cycle and before the minor cycle). 

1240  

1241 Options for runtime parameter modification are : 

1242  

1243 Interactive clean mask : Draw a 1/0 mask (appears as a contour) by hand. 

1244 If a mask is supplied at the task interface or if 

1245 automasking is invoked, the current mask is 

1246 displayed in the GUI and is available for manual 

1247 editing. 

1248  

1249 Note : If a mask contour is not visible, please 

1250 check the cursor display at the bottom of 

1251 GUI to see which parts of the mask image 

1252 have ones and zeros. If the entire mask=1 

1253 no contours will be visible. 

1254  

1255  

1256 Operation buttons : -- Stop execution now (restore current model and exit) 

1257 -- Continue on until global stopping criteria are reached 

1258 without stopping for any more interaction 

1259 -- Continue with minor cycles and return for interaction 

1260 after the next major cycle. 

1261  

1262 Iteration control : -- max cycleniter : Trigger for the next major cycle 

1263  

1264 The display begins with 

1265 [ min( cycleniter, niter - itercount ) ] 

1266 and can be edited by hand. 

1267  

1268 -- iterations left : The display begins with [niter-itercount ] 

1269 and can be edited to increase or 

1270 decrease the total allowed niter. 

1271  

1272 -- threshold : Edit global stopping threshold 

1273  

1274 -- cyclethreshold : The display begins with the 

1275 automatically computed value 

1276 (see Note in help for 'threshold'), 

1277 and can be edited by hand. 

1278  

1279 All edits will be reflected in the log messages that appear 

1280 once minor cycles begin. 

1281 fullsummary Return dictionary with complete convergence history  

1282  

1283 fullsummary=True: A full version of the summary dictionary is returned. 

1284 Keys include 'iterDone','peakRes','modelFlux','cycleThresh' that record the 

1285 convergence state at the end of each set of minor cycle iterations 

1286 separately for each image plane (i.e. channel/stokes) being 

1287 deconvolved. Additional keys report the convergence state at the  

1288 start of minor cycle iterations, stopping criteria that triggered major  

1289 cycles, and a processor ID per channel, for parallel cube runs. 

1290  

1291 fullsummary=False (default): A shorten version of the summary dictionary is returned 

1292 with only 'iterDone','peakRes','modelFlux', and 'cycleThresh'. 

1293  

1294 Detailed information about the return dictionary fields may be found  

1295 at CASA Docs > Synthesis Imaging > Iteration Control > Returned Dictionary. 

1296 nmajor The nmajor parameter limits the number of minor and major cycle sets 

1297 that sdintimaging executes. It is defined as the number of major cycles after the  

1298 initial set of minor cycle iterations. The count of nmajor does  

1299 not include the initial residual calculation that occurs when calcres=True.  

1300  

1301 A setting of nmajor=-1 implies no limit (default -1).  

1302 A setting of nmajor=0 implies nothing other than the initial residual calculation 

1303 A setting of nmajor>0 imples that nmajor sets of minor and major cycles will  

1304 be done in addition to the initial residual calculation.  

1305  

1306 If the major cycle limit is reached, stopcode 9 will be returned. Other stopping 

1307 criteria (such as threshold) could cause sdintimaging to stop in fewer than this 

1308 number of major cycles. If sdintimaging reaches another stopping criteria, first 

1309 or at the same time as nmajor, then that stopcode will be returned instead. 

1310  

1311 Note however that major cycle ids in the log messages as well as in the return 

1312 dictionary do begin with 1 for the initial residual calculation, when it exists.  

1313  

1314 Example 1 : A run with 'nmajor=5' and 'calcres=True' will iterate for 

1315 5 major cycles (not counting the initial residual calculation). But, the return 

1316 dictionary will show 'nmajordone:6'. If 'calcres=False', then the return 

1317 dictionary will show 'nmajordone:5'.  

1318  

1319 Example 2 : For both the following cases, there will be a printout in the logs  

1320 "Running Major Cycle 1" and the return value will include "nmajordone: 1",  

1321 however there is a difference in the purpose of the major cycle and the  

1322 number of minor cycles executed: 

1323 Case 1; nmajor=0, calcres=True: The major cycle done is for the creation 

1324 of the residual, and no minor cycles are executed. 

1325 Case 2; nmajor=1, calcres=False: The major cycle is done as part of the 

1326 major/minor cycle loop, and 1 minor cycle will be executed. 

1327  

1328 Note : For sdintimaging, the 'nmajor' parameter is not implemented for 

1329 usedata='sdonly'. Other stopping criteria still apply as usual. 

1330 usemask Type of mask(s) to be used for deconvolution 

1331  

1332 user: (default) mask image(s) or user specified region file(s) or string CRTF expression(s) 

1333 subparameters: mask, pbmask 

1334 pb: primary beam mask 

1335 subparameter: pbmask 

1336  

1337 Example: usemask="pb", pbmask=0.2 

1338 Construct a mask at the 0.2 pb gain level. 

1339 (Currently, this option will work only with 

1340 gridders that produce .pb (i.e. mosaic and awproject) 

1341 or if an externally produced .pb image exists on disk) 

1342  

1343 auto-multithresh : auto-masking by multiple thresholds for deconvolution 

1344 subparameters : sidelobethreshold, noisethreshold, lownoisethreshold, negativethrehsold, smoothfactor, 

1345 minbeamfrac, cutthreshold, pbmask, growiterations, dogrowprune, minpercentchange, verbose 

1346 Additional top level parameter relevant to auto-multithresh: fastnoise 

1347  

1348 if pbmask is >0.0, the region outside the specified pb gain level is excluded from 

1349 image statistics in determination of the threshold. 

1350  

1351  

1352  

1353  

1354 Note: By default the intermediate mask generated by automask at each deconvolution cycle 

1355 is over-written in the next cycle but one can save them by setting 

1356 the environment variable, SAVE_ALL_AUTOMASKS="true". 

1357 (e.g. in the CASA prompt, os.environ['SAVE_ALL_AUTOMASKS']="true" ) 

1358 The saved CASA mask image name will be imagename.mask.autothresh#, where 

1359 # is the iteration cycle number. 

1360 mask Mask (a list of image name(s) or region file(s) or region string(s) 

1361  

1362  

1363 The name of a CASA image or region file or region string that specifies 

1364 a 1/0 mask to be used for deconvolution. Only locations with value 1 will 

1365 be considered for the centers of flux components in the minor cycle. 

1366 If regions specified fall completely outside of the image, sdintimaging will throw an error. 

1367  

1368 Manual mask options/examples : 

1369  

1370 mask='xxx.mask' : Use this CASA image named xxx.mask and containing 

1371 ones and zeros as the mask.  

1372 If the mask is only different in spatial coordinates from what is being made  

1373 it will be resampled to the target coordinate system before being used. 

1374 The mask has to have the same shape in velocity and Stokes planes 

1375 as the output image. Exceptions are single velocity and/or single 

1376 Stokes plane masks. They will be expanded to cover all velocity and/or 

1377 Stokes planes of the output cube. 

1378  

1379 [ Note : If an error occurs during image resampling or 

1380 if the expected mask does not appear, please try 

1381 using tasks 'imregrid' or 'makemask' to resample 

1382 the mask image onto a CASA image with the target 

1383 shape and coordinates and supply it via the 'mask' 

1384 parameter. ] 

1385  

1386  

1387 mask='xxx.crtf' : A text file with region strings and the following on the first line 

1388 ( #CRTFv0 CASA Region Text Format version 0 ) 

1389 This is the format of a file created via the viewer's region 

1390 tool when saved in CASA region file format. 

1391  

1392 mask='circle[[40pix,40pix],10pix]' : A CASA region string. 

1393  

1394 mask=['xxx.mask','xxx.crtf', 'circle[[40pix,40pix],10pix]'] : a list of masks 

1395  

1396  

1397  

1398  

1399  

1400 Note : Mask images for deconvolution must contain 1 or 0 in each pixel. 

1401 Such a mask is different from an internal T/F mask that can be 

1402 held within each CASA image. These two types of masks are not 

1403 automatically interchangeable, so please use the makemask task 

1404 to copy between them if you need to construct a 1/0 based mask 

1405 from a T/F one. 

1406  

1407 Note : Work is in progress to generate more flexible masking options and 

1408 enable more controls. 

1409 pbmask Sub-parameter for usemask: primary beam mask 

1410  

1411 Examples : pbmask=0.0 (default, no pb mask) 

1412 pbmask=0.2 (construct a mask at the 0.2 pb gain level) 

1413 sidelobethreshold Sub-parameter for "auto-multithresh": mask threshold based on sidelobe levels: sidelobethreshold \* max_sidelobe_level \* peak residual 

1414 noisethreshold Sub-parameter for "auto-multithresh": mask threshold based on the noise level: noisethreshold \* rms + location (=median) 

1415  

1416 The rms is calculated from MAD with rms = 1.4826\*MAD. 

1417 lownoisethreshold Sub-parameter for "auto-multithresh": mask threshold to grow previously masked regions via binary dilation: lownoisethreshold \* rms in residual image + location (=median) 

1418  

1419 The rms is calculated from MAD with rms = 1.4826\*MAD. 

1420 negativethreshold Sub-parameter for "auto-multithresh": mask threshold for negative features: -1.0* negativethreshold \* rms + location(=median) 

1421  

1422 The rms is calculated from MAD with rms = 1.4826\*MAD. 

1423 smoothfactor Sub-parameter for "auto-multithresh": smoothing factor in a unit of the beam 

1424 minbeamfrac Sub-parameter for "auto-multithresh": minimum beam fraction in size to prune masks smaller than mimbeamfrac \* beam 

1425 <=0.0 : No pruning 

1426 cutthreshold Sub-parameter for "auto-multithresh": threshold to cut the smoothed mask to create a final mask: cutthreshold \* peak of the smoothed mask 

1427 growiterations Sub-parameter for "auto-multithresh": Maximum number of iterations to perform using binary dilation for growing the mask 

1428 dogrowprune Experimental sub-parameter for "auto-multithresh": Do pruning on the grow mask 

1429 minpercentchange If the change in the mask size in a particular channel is less than minpercentchange, stop masking that channel in subsequent cycles. This check is only applied when noise based threshold is used and when the previous clean major cycle had a cyclethreshold value equal to the clean threshold. Values equal to -1.0 (or any value less than 0.0) will turn off this check (the default). Automask will still stop masking if the current channel mask is an empty mask and the noise threshold was used to determine the mask. 

1430 verbose he summary of automasking at the end of each automasking process 

1431 is printed in the logger. Following information per channel will be listed in the summary. 

1432  

1433 chan: channel number 

1434 masking?: F - stop updating automask for the subsequent iteration cycles 

1435 RMS: robust rms noise 

1436 peak: peak in residual image 

1437 thresh_type: type of threshold used (noise or sidelobe) 

1438 thresh_value: the value of threshold used 

1439 N_reg: number of the automask regions 

1440 N_pruned: number of the automask regions removed by pruning 

1441 N_grow: number of the grow mask regions 

1442 N_grow_pruned: number of the grow mask regions removed by pruning 

1443 N_neg_pix: number of pixels for negative mask regions 

1444  

1445 Note that for a large cube, extra logging may slow down the process. 

1446 fastnoise Only relevant when automask (user='multi-autothresh') and/or n-sigma stopping threshold (nsigma>0.0) are/is used. If it is set to True, a simpler but faster noise calucation is used.  

1447 In this case, the threshold values are determined based on classic statistics (using all 

1448 unmasked pixels for the calculations). 

1449  

1450 If it is set to False, the new noise calculation 

1451 method is used based on pre-existing mask.  

1452  

1453 Case 1: no exiting mask 

1454 Calculate image statistics using Chauvenet algorithm  

1455  

1456 Case 2: there is an existing mask 

1457 Calculate image statistics by classical method on the region 

1458 outside the mask and inside the primary beam mask. 

1459  

1460 In all cases above RMS noise is calculated from MAD. 

1461 restart images (and start from an existing model image) 

1462 or automatically increment the image name and make a new image set. 

1463  

1464 True : Re-use existing images. If imagename.model exists the subsequent 

1465 run will start from this model (i.e. predicting it using current gridder 

1466 settings and starting from the residual image). Care must be taken 

1467 when combining this option with startmodel. Currently, only one or 

1468 the other can be used. 

1469  

1470 startmodel='', imagename.model exists : 

1471 - Start from imagename.model 

1472 startmodel='xxx', imagename.model does not exist : 

1473 - Start from startmodel 

1474 startmodel='xxx', imagename.model exists : 

1475 - Exit with an error message requesting the user to pick 

1476 only one model. This situation can arise when doing one 

1477 run with startmodel='xxx' to produce an output 

1478 imagename.model that includes the content of startmodel, 

1479 and wanting to restart a second run to continue deconvolution. 

1480 Startmodel should be set to '' before continuing. 

1481  

1482 If any change in the shape or coordinate system of the image is 

1483 desired during the restart, please change the image name and 

1484 use the startmodel (and mask) parameter(s) so that the old model 

1485 (and mask) can be regridded to the new coordinate system before starting. 

1486  

1487 False : A convenience feature to increment imagename with '_1', '_2', 

1488 etc as suffixes so that all runs of sdintimaging are fresh starts (without 

1489 having to change the imagename parameter or delete images). 

1490  

1491 This mode will search the current directory for all existing 

1492 imagename extensions, pick the maximum, and adds 1. 

1493 For imagename='try' it will make try.psf, try_2.psf, try_3.psf, etc. 

1494  

1495 This also works if you specify a directory name in the path : 

1496 imagename='outdir/try'. If './outdir' does not exist, it will create it. 

1497 Then it will search for existing filenames inside that directory. 

1498  

1499 If outlier fields are specified, the incrementing happens for each 

1500 of them (since each has its own 'imagename'). The counters are 

1501 synchronized across imagefields, to make it easier to match up sets 

1502 of output images. It adds 1 to the 'max id' from all outlier names 

1503 on disk. So, if you do two runs with only the main field 

1504 (imagename='try'), and in the third run you add an outlier with 

1505 imagename='outtry', you will get the following image names 

1506 for the third run : 'try_3' and 'outtry_3' even though 

1507 'outry' and 'outtry_2' have not been used. 

1508 calcres Calculate initial residual image 

1509  

1510 This parameter controls what the first major cycle does. 

1511  

1512 calcres=False with niter greater than 0 will assume that 

1513 a .residual image already exists and that the minor cycle can 

1514 begin without recomputing it. 

1515  

1516 calcres=False with niter=0 implies that only the PSF will be made 

1517 and no data will be gridded. 

1518  

1519 calcres=True requires that calcpsf=True or that the .psf and .sumwt 

1520 images already exist on disk (for normalization purposes). 

1521  

1522 Usage example : For large runs (or a pipeline scripts) it may be 

1523 useful to first run sdintimaging with niter=0 to create 

1524 an initial .residual to look at and perhaps make 

1525 a custom mask for. Imaging can be resumed 

1526 without recomputing it. 

1527 calcpsf Calculate PSF 

1528  

1529 This parameter controls what the first major cycle does. 

1530  

1531 calcpsf=False will assume that a .psf image already exists 

1532 and that the minor cycle can begin without recomputing it. 

1533 RETURNS void 

1534 

1535 --------- examples ----------------------------------------------------------- 

1536 

1537  

1538  

1539 Please refer to the CASAdocs pages for the task sdintimaging for examples. 

1540  

1541  

1542 

1543 

1544 """ 

1545 

1546 _info_group_ = """imaging""" 

1547 _info_desc_ = """""" 

1548 

1549 def __call__( self, usedata='sdint', sdimage='', sdpsf='', sdgain=float(1.0), dishdia=float(0), vis='', selectdata=True, field='', spw='', timerange='', uvrange='', antenna='', scan='', observation='', intent='', datacolumn='corrected', imagename='', imsize=[ ], cell=[ ], phasecenter='', stokes='I', projection='SIN', startmodel='', specmode='mfs', reffreq='', nchan=int(-1), start='', width='', outframe='LSRK', veltype='radio', restfreq=[ ], interpolation='linear', perchanweightdensity=True, gridder='standard', facets=int(1), psfphasecenter='', wprojplanes=int(1), vptable='', mosweight=True, aterm=True, psterm=False, wbawp=True, cfcache='', usepointing=False, computepastep=float(360.0), rotatepastep=float(360.0), pointingoffsetsigdev=[ ], pblimit=float(0.2), deconvolver='hogbom', scales=[ ], nterms=int(2), smallscalebias=float(0.0), restoration=True, restoringbeam=[ ], pbcor=False, weighting='natural', robust=float(0.5), noise='1.0Jy', npixels=int(0), uvtaper=[ '' ], niter=int(0), gain=float(0.1), threshold=float(0.0), nsigma=float(0.0), cycleniter=int(-1), cyclefactor=float(1.0), minpsffraction=float(0.05), maxpsffraction=float(0.8), interactive=False, fullsummary=False, nmajor=int(-1), usemask='user', mask='', pbmask=float(0.0), sidelobethreshold=float(3.0), noisethreshold=float(5.0), lownoisethreshold=float(1.5), negativethreshold=float(0.0), smoothfactor=float(1.0), minbeamfrac=float(0.3), cutthreshold=float(0.01), growiterations=int(75), dogrowprune=True, minpercentchange=float(-1.0), verbose=False, fastnoise=True, restart=True, calcres=True, calcpsf=True ): 

1550 schema = {'usedata': {'type': 'cStr', 'coerce': _coerce.to_str}, 'sdimage': {'type': 'cStr', 'coerce': _coerce.to_str}, 'sdpsf': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cFloat', 'coerce': _coerce.to_float}]}, 'sdgain': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'dishdia': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'vis': {'anyof': [{'type': 'cReqPath', 'coerce': _coerce.expand_path}, {'type': 'cReqPathVec', 'coerce': [_coerce.to_list,_coerce.expand_pathvec]}]}, 'selectdata': {'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]}]}, 'timerange': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'uvrange': {'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]}]}, 'observation': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cInt'}]}, 'intent': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'datacolumn': {'type': 'cStr', 'coerce': _coerce.to_str}, 'imagename': {'anyof': [{'type': 'cInt'}, {'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'imsize': {'anyof': [{'type': 'cInt'}, {'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}]}, 'cell': {'anyof': [{'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cFloat', 'coerce': _coerce.to_float}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, {'type': 'cInt'}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'phasecenter': {'anyof': [{'type': 'cInt'}, {'type': 'cStr', 'coerce': _coerce.to_str}]}, 'stokes': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'I', 'IQUV', 'UV', 'RRLL', 'IQ', 'V', 'pseudoI', 'QU', 'YY', 'RR', 'Q', 'U', 'IV', 'XX', 'XXYY', 'LL' ]}, 'projection': {'type': 'cStr', 'coerce': _coerce.to_str}, 'startmodel': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'specmode': {'type': 'cVariant', 'coerce': [_coerce.to_variant] # <allowed> IS NOT ALLOWED FOR A PARAMETER OF TYPE any 

1551}, 'reffreq': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'nchan': {'type': 'cInt'}, 'start': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'width': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'outframe': {'type': 'cStr', 'coerce': _coerce.to_str}, 'veltype': {'type': 'cStr', 'coerce': _coerce.to_str}, 'restfreq': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'interpolation': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'nearest', 'linear', 'cubic' ]}, 'perchanweightdensity': {'type': 'cBool'}, 'gridder': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'widefield', 'wproject', 'imagemosaic', 'standard', 'awproject', 'wprojectft', 'mosaicft', 'ft', 'ftmosaic', 'mosaic', 'awprojectft', 'gridft' ]}, 'facets': {'type': 'cInt'}, 'psfphasecenter': {'anyof': [{'type': 'cInt'}, {'type': 'cStr', 'coerce': _coerce.to_str}]}, 'wprojplanes': {'type': 'cInt'}, 'vptable': {'type': 'cStr', 'coerce': _coerce.to_str}, 'mosweight': {'type': 'cBool'}, 'aterm': {'type': 'cBool'}, 'psterm': {'type': 'cBool'}, 'wbawp': {'type': 'cBool'}, 'cfcache': {'type': 'cStr', 'coerce': _coerce.to_str}, 'usepointing': {'type': 'cBool'}, 'computepastep': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'rotatepastep': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'pointingoffsetsigdev': {'anyof': [{'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'pblimit': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'deconvolver': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'clarkstokes_exp', 'mtmfs', 'mem', 'clarkstokes', 'hogbom', 'clark_exp', 'clark', 'asp', 'multiscale' ]}, 'scales': {'anyof': [{'type': 'cIntVec', 'coerce': [_coerce.to_list,_coerce.to_intvec]}, {'type': 'cFloatVec', 'coerce': [_coerce.to_list,_coerce.to_floatvec]}]}, 'nterms': {'type': 'cInt'}, 'smallscalebias': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'restoration': {'type': 'cBool'}, 'restoringbeam': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'pbcor': {'type': 'cBool'}, 'weighting': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'briggsabs', 'briggs', 'briggsbwtaper', 'natural', 'radial', 'superuniform', 'uniform' ]}, 'robust': {'type': 'cFloat', 'coerce': _coerce.to_float, 'min': -2.0, 'max': 2.0}, 'noise': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'npixels': {'type': 'cInt'}, 'uvtaper': {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}, 'niter': {'type': 'cInt'}, 'gain': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'threshold': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, 'nsigma': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'cycleniter': {'type': 'cInt'}, 'cyclefactor': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'minpsffraction': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'maxpsffraction': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'interactive': {'type': 'cBool'}, 'fullsummary': {'type': 'cBool'}, 'nmajor': {'type': 'cInt'}, 'usemask': {'type': 'cStr', 'coerce': _coerce.to_str, 'allowed': [ 'user', 'pb', 'auto-multithresh' ]}, 'mask': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'pbmask': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'sidelobethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'noisethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'lownoisethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'negativethreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'smoothfactor': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'minbeamfrac': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'cutthreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'growiterations': {'type': 'cInt'}, 'dogrowprune': {'type': 'cBool'}, 'minpercentchange': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'verbose': {'type': 'cBool'}, 'fastnoise': {'type': 'cBool'}, 'restart': {'type': 'cBool'}, 'calcres': {'type': 'cBool'}, 'calcpsf': {'type': 'cBool'}} 

1552 doc = {'usedata': usedata, 'sdimage': sdimage, 'sdpsf': sdpsf, 'sdgain': sdgain, 'dishdia': dishdia, 'vis': vis, 'selectdata': selectdata, 'field': field, 'spw': spw, 'timerange': timerange, 'uvrange': uvrange, 'antenna': antenna, 'scan': scan, 'observation': observation, 'intent': intent, 'datacolumn': datacolumn, 'imagename': imagename, 'imsize': imsize, 'cell': cell, 'phasecenter': phasecenter, 'stokes': stokes, 'projection': projection, 'startmodel': startmodel, 'specmode': specmode, 'reffreq': reffreq, 'nchan': nchan, 'start': start, 'width': width, 'outframe': outframe, 'veltype': veltype, 'restfreq': restfreq, 'interpolation': interpolation, 'perchanweightdensity': perchanweightdensity, 'gridder': gridder, 'facets': facets, 'psfphasecenter': psfphasecenter, 'wprojplanes': wprojplanes, 'vptable': vptable, 'mosweight': mosweight, 'aterm': aterm, 'psterm': psterm, 'wbawp': wbawp, 'cfcache': cfcache, 'usepointing': usepointing, 'computepastep': computepastep, 'rotatepastep': rotatepastep, 'pointingoffsetsigdev': pointingoffsetsigdev, 'pblimit': pblimit, 'deconvolver': deconvolver, 'scales': scales, 'nterms': nterms, 'smallscalebias': smallscalebias, 'restoration': restoration, 'restoringbeam': restoringbeam, 'pbcor': pbcor, 'weighting': weighting, 'robust': robust, 'noise': noise, 'npixels': npixels, 'uvtaper': uvtaper, 'niter': niter, 'gain': gain, 'threshold': threshold, 'nsigma': nsigma, 'cycleniter': cycleniter, 'cyclefactor': cyclefactor, 'minpsffraction': minpsffraction, 'maxpsffraction': maxpsffraction, 'interactive': interactive, 'fullsummary': fullsummary, 'nmajor': nmajor, 'usemask': usemask, 'mask': mask, 'pbmask': pbmask, 'sidelobethreshold': sidelobethreshold, 'noisethreshold': noisethreshold, 'lownoisethreshold': lownoisethreshold, 'negativethreshold': negativethreshold, 'smoothfactor': smoothfactor, 'minbeamfrac': minbeamfrac, 'cutthreshold': cutthreshold, 'growiterations': growiterations, 'dogrowprune': dogrowprune, 'minpercentchange': minpercentchange, 'verbose': verbose, 'fastnoise': fastnoise, 'restart': restart, 'calcres': calcres, 'calcpsf': calcpsf} 

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

1554 _logging_state_ = _start_log( 'sdintimaging', [ 'usedata=' + repr(_pc.document['usedata']), 'sdimage=' + repr(_pc.document['sdimage']), 'sdpsf=' + repr(_pc.document['sdpsf']), 'sdgain=' + repr(_pc.document['sdgain']), 'dishdia=' + repr(_pc.document['dishdia']), 'vis=' + repr(_pc.document['vis']), 'selectdata=' + repr(_pc.document['selectdata']), 'field=' + repr(_pc.document['field']), 'spw=' + repr(_pc.document['spw']), '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']), 'intent=' + repr(_pc.document['intent']), 'datacolumn=' + repr(_pc.document['datacolumn']), 'imagename=' + repr(_pc.document['imagename']), 'imsize=' + repr(_pc.document['imsize']), 'cell=' + repr(_pc.document['cell']), 'phasecenter=' + repr(_pc.document['phasecenter']), 'stokes=' + repr(_pc.document['stokes']), 'projection=' + repr(_pc.document['projection']), 'startmodel=' + repr(_pc.document['startmodel']), 'specmode=' + repr(_pc.document['specmode']), 'reffreq=' + repr(_pc.document['reffreq']), 'nchan=' + repr(_pc.document['nchan']), 'start=' + repr(_pc.document['start']), 'width=' + repr(_pc.document['width']), 'outframe=' + repr(_pc.document['outframe']), 'veltype=' + repr(_pc.document['veltype']), 'restfreq=' + repr(_pc.document['restfreq']), 'interpolation=' + repr(_pc.document['interpolation']), 'perchanweightdensity=' + repr(_pc.document['perchanweightdensity']), 'gridder=' + repr(_pc.document['gridder']), 'facets=' + repr(_pc.document['facets']), 'psfphasecenter=' + repr(_pc.document['psfphasecenter']), 'wprojplanes=' + repr(_pc.document['wprojplanes']), 'vptable=' + repr(_pc.document['vptable']), 'mosweight=' + repr(_pc.document['mosweight']), 'aterm=' + repr(_pc.document['aterm']), 'psterm=' + repr(_pc.document['psterm']), 'wbawp=' + repr(_pc.document['wbawp']), 'cfcache=' + repr(_pc.document['cfcache']), 'usepointing=' + repr(_pc.document['usepointing']), 'computepastep=' + repr(_pc.document['computepastep']), 'rotatepastep=' + repr(_pc.document['rotatepastep']), 'pointingoffsetsigdev=' + repr(_pc.document['pointingoffsetsigdev']), 'pblimit=' + repr(_pc.document['pblimit']), 'deconvolver=' + repr(_pc.document['deconvolver']), 'scales=' + repr(_pc.document['scales']), 'nterms=' + repr(_pc.document['nterms']), 'smallscalebias=' + repr(_pc.document['smallscalebias']), 'restoration=' + repr(_pc.document['restoration']), 'restoringbeam=' + repr(_pc.document['restoringbeam']), 'pbcor=' + repr(_pc.document['pbcor']), 'weighting=' + repr(_pc.document['weighting']), 'robust=' + repr(_pc.document['robust']), 'noise=' + repr(_pc.document['noise']), 'npixels=' + repr(_pc.document['npixels']), 'uvtaper=' + repr(_pc.document['uvtaper']), 'niter=' + repr(_pc.document['niter']), 'gain=' + repr(_pc.document['gain']), 'threshold=' + repr(_pc.document['threshold']), 'nsigma=' + repr(_pc.document['nsigma']), 'cycleniter=' + repr(_pc.document['cycleniter']), 'cyclefactor=' + repr(_pc.document['cyclefactor']), 'minpsffraction=' + repr(_pc.document['minpsffraction']), 'maxpsffraction=' + repr(_pc.document['maxpsffraction']), 'interactive=' + repr(_pc.document['interactive']), 'fullsummary=' + repr(_pc.document['fullsummary']), 'nmajor=' + repr(_pc.document['nmajor']), 'usemask=' + repr(_pc.document['usemask']), 'mask=' + repr(_pc.document['mask']), 'pbmask=' + repr(_pc.document['pbmask']), 'sidelobethreshold=' + repr(_pc.document['sidelobethreshold']), 'noisethreshold=' + repr(_pc.document['noisethreshold']), 'lownoisethreshold=' + repr(_pc.document['lownoisethreshold']), 'negativethreshold=' + repr(_pc.document['negativethreshold']), 'smoothfactor=' + repr(_pc.document['smoothfactor']), 'minbeamfrac=' + repr(_pc.document['minbeamfrac']), 'cutthreshold=' + repr(_pc.document['cutthreshold']), 'growiterations=' + repr(_pc.document['growiterations']), 'dogrowprune=' + repr(_pc.document['dogrowprune']), 'minpercentchange=' + repr(_pc.document['minpercentchange']), 'verbose=' + repr(_pc.document['verbose']), 'fastnoise=' + repr(_pc.document['fastnoise']), 'restart=' + repr(_pc.document['restart']), 'calcres=' + repr(_pc.document['calcres']), 'calcpsf=' + repr(_pc.document['calcpsf']) ] ) 

1555 task_result = None 

1556 try: 

1557 task_result = _sdintimaging_t( _pc.document['usedata'], _pc.document['sdimage'], _pc.document['sdpsf'], _pc.document['sdgain'], _pc.document['dishdia'], _pc.document['vis'], _pc.document['selectdata'], _pc.document['field'], _pc.document['spw'], _pc.document['timerange'], _pc.document['uvrange'], _pc.document['antenna'], _pc.document['scan'], _pc.document['observation'], _pc.document['intent'], _pc.document['datacolumn'], _pc.document['imagename'], _pc.document['imsize'], _pc.document['cell'], _pc.document['phasecenter'], _pc.document['stokes'], _pc.document['projection'], _pc.document['startmodel'], _pc.document['specmode'], _pc.document['reffreq'], _pc.document['nchan'], _pc.document['start'], _pc.document['width'], _pc.document['outframe'], _pc.document['veltype'], _pc.document['restfreq'], _pc.document['interpolation'], _pc.document['perchanweightdensity'], _pc.document['gridder'], _pc.document['facets'], _pc.document['psfphasecenter'], _pc.document['wprojplanes'], _pc.document['vptable'], _pc.document['mosweight'], _pc.document['aterm'], _pc.document['psterm'], _pc.document['wbawp'], _pc.document['cfcache'], _pc.document['usepointing'], _pc.document['computepastep'], _pc.document['rotatepastep'], _pc.document['pointingoffsetsigdev'], _pc.document['pblimit'], _pc.document['deconvolver'], _pc.document['scales'], _pc.document['nterms'], _pc.document['smallscalebias'], _pc.document['restoration'], _pc.document['restoringbeam'], _pc.document['pbcor'], _pc.document['weighting'], _pc.document['robust'], _pc.document['noise'], _pc.document['npixels'], _pc.document['uvtaper'], _pc.document['niter'], _pc.document['gain'], _pc.document['threshold'], _pc.document['nsigma'], _pc.document['cycleniter'], _pc.document['cyclefactor'], _pc.document['minpsffraction'], _pc.document['maxpsffraction'], _pc.document['interactive'], _pc.document['fullsummary'], _pc.document['nmajor'], _pc.document['usemask'], _pc.document['mask'], _pc.document['pbmask'], _pc.document['sidelobethreshold'], _pc.document['noisethreshold'], _pc.document['lownoisethreshold'], _pc.document['negativethreshold'], _pc.document['smoothfactor'], _pc.document['minbeamfrac'], _pc.document['cutthreshold'], _pc.document['growiterations'], _pc.document['dogrowprune'], _pc.document['minpercentchange'], _pc.document['verbose'], _pc.document['fastnoise'], _pc.document['restart'], _pc.document['calcres'], _pc.document['calcpsf'] ) 

1558 except Exception as exc: 

1559 _except_log('sdintimaging', exc) 

1560 raise 

1561 finally: 

1562 task_result = _end_log( _logging_state_, 'sdintimaging', task_result ) 

1563 return task_result 

1564 

1565sdintimaging = _sdintimaging( ) 

1566