The wrapindex function in freqkernel has an off-by-1 bug that incorrectly embeds the kernel into the array that one uses with FFT to get the frequency response. MWE illustration:
h = centered(reshape([1], 1, 1)) # 2D Kronecker impulse whose frequency response should be uniform "1"
freqkernel(h, (4,4)) # complex output :(
4×4 Array{Complex{Float64},2}:
1.0+0.0im 0.0+1.0im -1.0+0.0im 0.0-1.0im
0.0+1.0im -1.0+0.0im 0.0-1.0im 1.0+0.0im
-1.0+0.0im 0.0-1.0im 1.0+0.0im 0.0+1.0im
0.0-1.0im 1.0+0.0im 0.0+1.0im -1.0+0.0im
(The magnitude is correct, but not the phase.)
In contrast, that "other software framework" that uses psf2otf has the correct frequency response:
The
wrapindex
function infreqkernel
has an off-by-1 bug that incorrectly embeds the kernel into the array that one uses with FFT to get the frequency response. MWE illustration:(The magnitude is correct, but not the phase.)
In contrast, that "other software framework" that uses
psf2otf
has the correct frequency response:I plan to submit a PR with both a correction and this MWE as a test case.