Pull request #1095: CAS-14719
Merge in CASA/casa6 from CAS-14719 to master
* commit 'a00a67879f3b8170f273d04c57edd889d7b89f91': CAS-14719: guard against division by zero in getCommonBeam ellipse transform CAS-14719: avoid small ragged trailing block in cube minor cycle partitioning
CAS-14719: guard against division by zero in getCommonBeam ellipse transform
_transformEllipseByScaling divides by 2*j1-1 = |u|/sqrt(f1), which is
exactly zero when the scaled ellipse is circular (u = r - t = 0). That
is an ordinary geometry, not a degenerate input, but the resulting
0/0 evaluates to NaN; the enclosing GaussianBeam then fails
setMajorMinor, and the exception propagates as a failed minor cycle
in automasking. Reproduced on a 6-channel block whose beams share a
single float32 minor axis and whose position angles differ by ~1e-8
rad, so r and t land on the same double.
Take the analytic limit (k = (r+t)/2 +- sqrt(s)) instead of dividing,
and stop the enclosing-beam retry loop from rebuilding a non-finite
beam inside its own catch handler. Also correct the circle branch,
which returned sqrt(k) where the semi-axis is sqrt(1/k); it was
unreachable before and is reachable now.
CAS-14719: avoid small ragged trailing block in cube minor cycle partitioning
numblockchans derived blksize from nproc and then took nblk=nchan/blksize,
truncating the division; the remainder was re-appended as an extra, much
smaller trailing block. nblk was routinely nproc+1 and the orphan block
could hold only a few channels. The deconvolver derives its mask-smoothing
beam from the block's own beam subset, where getCommonBeam returns
trivially for a single-beam set but enters ill-conditioned arithmetic for
a few very similar channels. Decide the block count first, rounding up so
no block exceeds optchan, then split the channels evenly.