Skip to content

Add divergence detection to clean algorithms

Andre Offringa requested to merge divergence-detection-in-clean-algorithms into main

This builds upon the work done in !136 (merged), where parallel deconvolution can recover a subimage from divergence. This MR makes the clean algorithms also immediately stop when diverging, instead of keeping iterating until niter is reached. This saves time when diverging, but in the case of parallel deconvolution it also allows recovering from diverging in one major iteration, if the next major iteration no longer diverges (either because the subimage boundaries will be changed, and/or because strong sources from other subimages will be further deconvolved).

This MR also makes the divergence_limit option available in the Python interface.

A relatively simple way of triggering it is to deconvolve way too deep, e.g.:

wsclean -scale 1amin -size 512 512 -niter 10000000 -mgain 0.8 -auto-threshold 0.1 observation.ms/

In my case, this outputs:

 == Deconvolving (3) ==
Estimated standard deviation of background noise: 151.84 mJy
Initial peak: 936.93 mJy at 82,85
Next major iteration at: 187.39 mJy
Performed 104521 iterations in total, 75543 in this major iteration with sub-minor optimization.
WARNING: Stopping clean because of divergence!
 ==> Initial flux density of 936.93 mJy increased to -3.76 Jy

The test case of !136 (merged) also covers this work (it just makes things faster).

This MR also fixes an issue in !136 (merged): in that MR, a subimage is reset to zero instead of to what it is before the major iteration. While both could be a solution to the problem, setting it to zero makes the component list inconsistent with the sub-image. To make sure that this is now correct, I ran a diverging clean with output of components, rendered the components to a fits file and compared this to wsclean's model fits file. These image are matching (apart from small rounding issues).

Edited by Andre Offringa

Merge request reports