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

2##################### 70265d8023e9665dfb4675bd32a692f9 ############################## 

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_deconvolve import deconvolve as _deconvolve_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 _deconvolve: 

15 """ 

16 deconvolve ---- Image-domain deconvolution 

17 

18 Task deconvolve executes image-domain deconvolution with options for automasking and restoration. It can be viewed as the minor cycle of the iterative image reconstruction offered by the tclean task. The functionality that it introduces is the ability to just run the deconvolution step alone. 

19  

20 

21 --------- parameter descriptions --------------------------------------------- 

22 

23 imagename Pre-name of input and output images 

24 example : imagename='try' 

25  

26 Input images (* = required): 

27  

28 try.psf* - The point spread function 

29 try.residual* - The observed (or residual) image, such as one 

30 generated by tclean 

31 try.model - An existing model image from a previous run of 

32 tclean or deconvolve 

33 try.mask - A pre-defined mask to be either used directly or  

34 combined with additional masking options 

35 try.pb - Primary beam model, if required for masking settings 

36  

37 Output images: 

38  

39 try.model - A new or updated model image 

40 try.residual - An updated residual image 

41 try.image - A restored image, created only when restoration=True 

42 try.mask - The output mask 

43 try.prev.mask - An intermediate by-product of automasking 

44 (when usemask='auto-multithresh') 

45  

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

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

48 plus the following extra input images. 

49 try.alpha - spectral index 

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

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

52  

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

54 output images to be sent there instead of the 

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

56  

57 Tip : Restarting a deconvolution run without changing 'imagename' 

58 implies continuation from the existing model image on disk. 

59 By default, the residual image will be recomputed. 

60  

61 Note : All deconvolution runs will by default produce restored images. 

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

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

64  

65 Note : All input/output images should be 4D image cubes with axes 

66 [ra,dec,pol,chan], as is the default for the task tclean. Any input 

67 images without this format must be modified (eg with imregrid, 

68 imtrans, image.adddegaxes) in order to be accepted. 

69 startmodel Name of starting model image 

70  

71 The contents of the supplied starting model image will be 

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

73  

74 example : startmodel = 'singledish.im' 

75  

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

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

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

79 for the zeroth order term. 

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

81 for the first order term. 

82  

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

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

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

86  

87 If the startmodel is supplied, but a copy of of the destination 

88 imagename.model already exists, deconvolve will exit with an error. 

89  

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

91  

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

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

94  

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

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

97 Minor cycles stop when threshold or niter are reached. For all 

98 methods, components are picked from the entire extent of the image or 

99 (if specified) within a mask. 

100  

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

102 - Find the location of the peak residual 

103 - Add this delta function component to the model image 

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

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

106 - Repeat 

107  

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

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

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

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

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

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

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

115 - Repeat 

116  

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

118 'clark_exp' is another implementation that maps to 

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

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

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

122  

123 clarkstokes : Clark Clean operating separately per Stokes plane 

124  

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

126  

127 multiscale : MultiScale Clean [Cornwell, 2008] 

128 - Smooth the residual image to multiple scale sizes 

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

130 - Add this multiscale component to the model image 

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

132 patch size per scale) from all residual images 

133 - Repeat from step 2 

134  

135  

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

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

138 MEM method. It minimizes an objective function of 

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

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

141  

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

143 Improvements will be made in the future.) 

144  

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

146 - Smooth each Taylor residual image to multiple scale sizes 

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

148 Taylor coefficients for components at all locations 

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

150 and scale size at the location with maximum reduction in 

151 chi-square 

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

153 model image 

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

155 per scale) from all smoothed Taylor residual images 

156 - Repeat from step 2 

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

158 This set of scale sizes should represent the sizes 

159 (diameters in units of number of pixels) 

160 of dominant features in the image being reconstructed. 

161  

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

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

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

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

166  

167 For numerical stability, the largest scale must be 

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

169 comparable to the scale corresponding to the lowest measured 

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

171 instrument is sensitive to is unconstrained by the data making 

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

173 nterms Number of Taylor coefficients in the spectral model 

174  

175 - nterms=1 : Assume flat spectrum source 

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

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

178  

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

180 spectral index is derived as alpha = taylorcoeff_1 / taylorcoeff_0 

181  

182 Spectral curvature is similarly derived when possible. 

183  

184 The optimal number of Taylor terms depends on the available 

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

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

187  

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

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

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

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

192  

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

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

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

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

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

198  

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

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

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

202 if nterms is greater than 2) are produced. 

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

204 internal T/F masks based on a threshold computed 

205 as peakresidual/10. Additional masking based on 

206 .alpha/.alpha.error may be desirable. 

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

208 from the propagation of error during the division of 

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

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

211 the corresponding residual images. The absolute value 

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

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

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

215 The peak from each scale's smoothed residual is 

216 multiplied by ( 1 - smallscalebias * scale/maxscale ) 

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

218 before the scale with the largest peak is chosen.  

219 Smallscalebias can be varied between -1.0 and 1.0.  

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

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

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

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

224 fusedthreshold g Hogbom Clean (number in units of Jy) 

225  

226 fusedthreshold = 0.0001 : 0.1 mJy 

227  

228 This is a subparameter of the Asp Clean deconvolver. When peak residual  

229 is lower than the threshold, Asp Clean is "switched to Hogbom Clean" (i.e. only use the 0 scale for cleaning) for  

230 the following number of iterations until it switches back to Asp Clean. 

231  

232 NumberIterationsInHogbom = 50 + 2 * (exp(0.05 * NthHogbom) - 1) 

233  

234 , where NthHogbom is the number of times Hogbom Clean has been triggered.  

235  

236 When the Asp Clean detects it is approaching convergence, it uses only the 0 scale for the following number of iterations for better computational efficiency.  

237  

238 NumberIterationsInHogbom = 500 + 2 * (exp(0.05 * NthHogbom) - 1) 

239 largestscale s) allowed for the initial guess for the Asp Clean deconvolver. 

240  

241 largestscale = 100 

242  

243 The default initial scale sizes used by Asp Clean is [0, w, 2w, 4w, 8w],  

244 where `w` is the PSF width. The default `largestscale` is -1 which indicates  

245 users accept these initial scales. If `largestscale` is set, the initial scales  

246 would be [0, w, ... up to the `largestscale`]. This is only an initial guess, 

247 and actual fitted scale sizes may evolve from these initial values. 

248  

249 It is recommended not to set `largestscale` unless Asp Clean picks a large  

250 scale that has no constraints from the data (the UV hole issue). 

251 restoration . 

252  

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

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

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

256 smoothed to that target resolution before adding it in. 

257  

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

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

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

261 the residuals and compute .alpha and .alpha.error. 

262 restoringbeam ze to use. 

263  

264 - restoringbeam='' or [''] 

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

266  

267 - restoringbeam='10.0arcsec' 

268 Use a circular Gaussian of this width for all planes 

269  

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

271 Use this elliptical Gaussian for all planes 

272  

273 - restoringbeam='common' 

274 Automatically estimate a common beam shape/size appropriate for 

275 all planes. 

276  

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

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

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

280 niter Maximum number of iterations 

281  

282 A stopping criterion based on total iteration count. 

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

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

285  

286 Iterations are typically defined as the selecting one flux component 

287 and partially subtracting it out from the residual image. 

288  

289 niter=0 : Skip the deconvolution step (only do restoration) 

290  

291 niter larger than zero : The minor cycle. 

292  

293 Note : The following additional triggers will also stop minor cycle 

294 iterations. Whichever condition is triggered first stops the minor 

295 cycle. 

296  

297 'threshold' : The parameter value, compared to peak residual. 

298 Divergence : As detected by an increase of 10% in peak residual from 

299 the minimum so far (during minor cycle iterations). 

300  

301 The first criterion to be satisfied takes precedence. 

302  

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

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

305 deconvolver operates in sequence, iterations are counted across 

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

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

308 minor cycles and exited either due to 'niter' or 'threshold'. 

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

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

311 For example, with niter=100, nchan=10,threshold=0, 

312 a total of 1000 iterations will be done in the first set of minor cycles 

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

314 gain Loop gain 

315  

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

317 for the CLEAN algorithm and its variants. 

318  

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

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

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

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

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

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

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

326 threshold The minor cycle's stopping threshold (number in units of Jy, or string) 

327  

328 threshold = 0.005 : 5mJy 

329 threshold = '5.0mJy' 

330  

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

332 the description under nsigma). Then threshold is modified as: 

333  

334 threshold = max( threshold, nsgima_threshold ) 

335 nsigma Multiplicative factor for rms-based threshold stopping 

336  

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

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

339 the N-sigma threshold and threshold, is used as a stopping trigger 

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

341 Set nsigma=0.0 to preserve the previous deconvolve behavior without this feature. 

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

343 to determine the threshold. 

344 interactive Modify masks and parameters at runtime 

345  

346 interactive=True will trigger an interactive GUI after deconvolution finishes. 

347  

348 Options for runtime parameter modification are : 

349  

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

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

352 automasking is invoked, the current mask is 

353 displayed in the GUI and is available for manual 

354 editing. 

355  

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

357 check the cursor display at the bottom of 

358 GUI to see which parts of the mask image 

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

360 no contours will be visible. 

361  

362  

363 Operation buttons : -- For the task deconvolve, all options stop the minor cycle. 

364  

365 Iteration control : -- max cycleniter : For task deconvolve, this contol has no effect. 

366 -- iterations left : Sets the limit on the number of iterations 

367 about to be done. 

368 -- threshold : Sets the peak residual stopping threshold for 

369 for this execution of deconvolve. 

370 fullsummary Return dictionary with complete convergence history  

371  

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

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

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

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

376 deconvolved. Additional keys report the convergence state at the  

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

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

379  

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

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

382  

383 Detailed information about the return dictionary fields may be found  

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

385 fastnoise mask (user='multi-autothresh') and/or n-sigma stopping threshold 

386 (nsigma>0.0) are/is used. If it is set to True, a simpler but faster noise calucation is used.  

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

388 unmasked pixels for the calculations). 

389  

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

391 method is used based on pre-existing mask.  

392  

393 Case 1: no exiting mask 

394 Calculate image statistics using Chauvenet algorithm  

395  

396 Case 2: there is an existing mask 

397 Calculate image statistics by classical method on the region 

398 outside the mask and inside the primary beam mask. 

399  

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

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

402  

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

404 subparameters: mask, pbmask 

405 pb: primary beam mask 

406 subparameter: pbmask 

407  

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

409 Construct a mask at the 0.2 pb gain level. 

410 (Currently, this option will work only with 

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

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

413  

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

415 subparameters : sidelobethreshold, noisethreshold, lownoisethreshold, 

416 negativethrehsold, smoothfactor, minbeamfrac, cutthreshold, 

417 pbmask, growiterations, dogrowprune, minpercentchange, verbose 

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

419  

420  

421  

422  

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

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

425 the environment variable, SAVE_ALL_AUTOMASKS="true". 

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

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

428 # is the iteration cycle number. 

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

430  

431  

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

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

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

435 If regions specified fall completely outside of the image, deconvolve will throw an error. 

436  

437 Manual mask options/examples : 

438  

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

440 ones and zeros as the mask.  

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

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

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

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

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

446 Stokes planes of the output cube. 

447  

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

449 if the expected mask does not appear, please try 

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

451 the mask image onto a CASA image with the target 

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

453 parameter. ] 

454  

455  

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

457 ( #CRTFv0 CASA Region Text Format version 0 ) 

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

459 tool when saved in CASA region file format. 

460  

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

462  

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

464  

465  

466  

467  

468  

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

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

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

472 automatically interchangeable, so please use the makemask task 

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

474 from a T/F one. 

475  

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

477 enable more controls. 

478 pbmask Sub-parameter for usemask: primary beam mask 

479  

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

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

482 sidelobethreshold Sub-parameter for "auto-multithresh": mask threshold based on sidelobe levels: 

483 sidelobethreshold * max_sidelobe_level * peak residual 

484 noisethreshold Sub-parameter for "auto-multithresh": mask threshold based on the noise level: 

485 noisethreshold * rms + location (=median) 

486  

487 The rms is calculated from MAD with rms = 1.4826*MAD. 

488 lownoisethreshold Sub-parameter for "auto-multithresh": mask threshold to grow previously masked regions via binary dilation: 

489 lownoisethreshold * rms in residual image + location (=median) 

490  

491 The rms is calculated from MAD with rms = 1.4826*MAD. 

492 negativethreshold Sub-parameter for "auto-multithresh": mask threshold for negative features: 

493 -1.0* negativethreshold * rms + location(=median) 

494  

495 The rms is calculated from MAD with rms = 1.4826*MAD. 

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

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

498 <=0.0 : No pruning 

499 cutthreshold Sub-parameter for "auto-multithresh": threshold to cut the smoothed mask to create a final mask: 

500 cutthreshold * peak of the smoothed mask 

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

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

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

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

505  

506 chan: channel number 

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

508 RMS: robust rms noise 

509 peak: peak in residual image 

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

511 thresh_value: the value of threshold used 

512 N_reg: number of the automask regions 

513 N_pruned: number of the automask regions removed by pruning 

514 N_grow: number of the grow mask regions 

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

516 N_neg_pix: number of pixels for negative mask regions 

517  

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

519 RETURNS void 

520 

521 --------- examples ----------------------------------------------------------- 

522 

523  

524  

525 Please refer to the CASAdocs pages for the task deconvolve for examples. 

526  

527  

528 

529 

530 """ 

531 

532 _info_group_ = """imaging""" 

533 _info_desc_ = """Image-domain deconvolution""" 

534 

535 def __call__( self, imagename='', startmodel='', deconvolver='hogbom', scales=[ ], nterms=int(2), smallscalebias=float(0.0), fusedthreshold=float(0.0), largestscale=int(-1), restoration=True, restoringbeam=[ ], niter=int(100), gain=float(0.1), threshold=float(0.0), nsigma=float(0.0), interactive=False, fullsummary=False, fastnoise=True, 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, verbose=False ): 

536 schema = {'imagename': {'anyof': [{'type': 'cInt'}, {'type': 'cStr', 'coerce': _coerce.to_str}, {'type': 'cStrVec', 'coerce': [_coerce.to_list,_coerce.to_strvec]}]}, 'startmodel': {'type': 'cVariant', 'coerce': [_coerce.to_variant]}, '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}, 'fusedthreshold': {'type': 'cFloat', 'coerce': _coerce.to_float}, 'largestscale': {'type': 'cInt'}, 'restoration': {'type': 'cBool'}, 'restoringbeam': {'anyof': [{'type': 'cStr', 'coerce': _coerce.to_str}, {'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}, 'interactive': {'type': 'cBool'}, 'fullsummary': {'type': 'cBool'}, 'fastnoise': {'type': 'cBool'}, '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'}, 'verbose': {'type': 'cBool'}} 

537 doc = {'imagename': imagename, 'startmodel': startmodel, 'deconvolver': deconvolver, 'scales': scales, 'nterms': nterms, 'smallscalebias': smallscalebias, 'fusedthreshold': fusedthreshold, 'largestscale': largestscale, 'restoration': restoration, 'restoringbeam': restoringbeam, 'niter': niter, 'gain': gain, 'threshold': threshold, 'nsigma': nsigma, 'interactive': interactive, 'fullsummary': fullsummary, 'fastnoise': fastnoise, 'usemask': usemask, 'mask': mask, 'pbmask': pbmask, 'sidelobethreshold': sidelobethreshold, 'noisethreshold': noisethreshold, 'lownoisethreshold': lownoisethreshold, 'negativethreshold': negativethreshold, 'smoothfactor': smoothfactor, 'minbeamfrac': minbeamfrac, 'cutthreshold': cutthreshold, 'growiterations': growiterations, 'dogrowprune': dogrowprune, 'verbose': verbose} 

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

539 _logging_state_ = _start_log( 'deconvolve', [ 'imagename=' + repr(_pc.document['imagename']), 'startmodel=' + repr(_pc.document['startmodel']), 'deconvolver=' + repr(_pc.document['deconvolver']), 'scales=' + repr(_pc.document['scales']), 'nterms=' + repr(_pc.document['nterms']), 'smallscalebias=' + repr(_pc.document['smallscalebias']), 'fusedthreshold=' + repr(_pc.document['fusedthreshold']), 'largestscale=' + repr(_pc.document['largestscale']), 'restoration=' + repr(_pc.document['restoration']), 'restoringbeam=' + repr(_pc.document['restoringbeam']), 'niter=' + repr(_pc.document['niter']), 'gain=' + repr(_pc.document['gain']), 'threshold=' + repr(_pc.document['threshold']), 'nsigma=' + repr(_pc.document['nsigma']), 'interactive=' + repr(_pc.document['interactive']), 'fullsummary=' + repr(_pc.document['fullsummary']), 'fastnoise=' + repr(_pc.document['fastnoise']), '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']), 'verbose=' + repr(_pc.document['verbose']) ] ) 

540 task_result = None 

541 try: 

542 task_result = _deconvolve_t( _pc.document['imagename'], _pc.document['startmodel'], _pc.document['deconvolver'], _pc.document['scales'], _pc.document['nterms'], _pc.document['smallscalebias'], _pc.document['fusedthreshold'], _pc.document['largestscale'], _pc.document['restoration'], _pc.document['restoringbeam'], _pc.document['niter'], _pc.document['gain'], _pc.document['threshold'], _pc.document['nsigma'], _pc.document['interactive'], _pc.document['fullsummary'], _pc.document['fastnoise'], _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['verbose'] ) 

543 except Exception as exc: 

544 _except_log('deconvolve', exc) 

545 raise 

546 finally: 

547 task_result = _end_log( _logging_state_, 'deconvolve', task_result ) 

548 return task_result 

549 

550deconvolve = _deconvolve( ) 

551