The new implementation refers to the major zogy code rewrite in
DM-25115 and its updates since then.
The old implementation had a bug in how to center the PSF properly in an FFT symmetry sense (
DM-11990). The centering of the image before and after FFT transformations got unnecessarily much attention while it had no real importance. In the new implementation, we always put the image center to the DFT origin for better symmetry.
The image padding size got into focus at the beginning for the wrong reason. We displayed the zogy matching kernel (and decorrelation afterburner) kernels in image space and had the impression that they contain long tails stretching up to hundreds of pixels. Later it became clear that this was due to noise in high frequency components which fills the image space representations irrespectively of their padding size. Nevertheless, to avoid the introduction of artifacts due to the circular boundary condition of DFT space calculations, we need to estimate the matching kernel dimensions in image space. See the theoretical Gaussian solutions in DMTN-179. Also, in case of splitting the image into sub images, the padding should contain the continued image data outside the cell. The new implementation uses considerations described in
The variance plane calculation was algorithmically incorrect; the variance plane was subject to the very same calculations in the old implementation as the image plane (just with addition instead of subtraction). This is discussed in DMTN-179 Sec. 5.
In addition to the issues originally raised in this ticket, we also considered the followings:
In the spatially varying PSF case, the old implementation focused on splitting the image into individual small chunks and smoothing the solution by allowing and averaging overlapping borders back in image space. In the new implementation, we split the image into overlapping image chunks for the DFT calculations and keep only smaller “useful inner areas” that do not overlap to account for spatial variability of the PSFs.
The old implementation added noise to low PSF values (in image space) to avoid numerical zero divisions in the calculations. We concluded that this approach did not solve any problem but added artificial noise to scenarios inherently noisy numerically. At close to zero denominators, the expressions should approach mathematical limits to reproduce the theoretically expected smooth solutions. This is discussed in DMTN-179.
The old implementation unnecessarily implemented options to perform convolutions in image space rather than in DFT space. We concluded that this was not a cause of “bad” solutions.
The old implementation did not create a spatially varying result PSF solution. The new implementation does, though the solution can “jump” between grid cells.
The new implementation uses power of two dimensions for the padded (sub-)images for better FFT accuracy.