You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
As I understand, fft/ifft implementations in https://github.com/mcabbott/AxisKeys.jl/blob/master/src/fft.jl are fundamentally wrong and return incorrect results. For one, the original axiskeys don't affect the resulting content at all - this cannot be right, shifting the original array should change the phase of the FFT.
These are the implementations for zero-centered axiskeys (as they @assert), seem correct --- eg ifft inverts fft, fft of delta function at zero is constant, etc:
function AbstractFFTs.fft(A::KeyedArray)
@assertall(ks -> ks[end÷2+1] |> iszero, axiskeys(A))
data =fft(AxisKeys.keyless(fftshift(A)))
keys =map(axiskeys(A)) do ks
fftfreq(length(ks), inv(step(ks)))
endKeyedArray(data, keys) |> fftshift
endfunction AbstractFFTs.ifft(A::KeyedArray)
@assertall(ks -> ks[end÷2+1] |> iszero, axiskeys(A))
data =ifft(AxisKeys.keyless(fftshift(A)))
keys =map(axiskeys(A)) do ks
fftfreq(length(ks), inv(step(ks)))
endKeyedArray(data, keys) |> fftshift
end
Implementations for arbitrary (ranges) axiskeys should involve phase gradient multiplication, at least.
The text was updated successfully, but these errors were encountered:
As I understand,
fft
/ifft
implementations in https://github.com/mcabbott/AxisKeys.jl/blob/master/src/fft.jl are fundamentally wrong and return incorrect results. For one, the original axiskeys don't affect the resulting content at all - this cannot be right, shifting the original array should change the phase of the FFT.These are the implementations for zero-centered axiskeys (as they
@assert
), seem correct --- egifft
invertsfft
,fft
of delta function at zero is constant, etc:Implementations for arbitrary (ranges) axiskeys should involve phase gradient multiplication, at least.
The text was updated successfully, but these errors were encountered: