FFT helpers
FourierTools.ffts
— Functionffts(A [, dims])
Result is semantically equivalent to fftshift(fft(A, dims), dims)
However, the shift is done with ShiftedArrays
and therefore doesn't allocate memory.
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.ffts!
— Functionffts!(A [, dims])
Result is semantically equivalent to fftshift(fft!(A, dims), dims)
. A
is in-place modified. However, the shift is done with ShiftedArrays
and therefore doesn't allocate memory.
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.iffts
— Functioniffts(A [, dims])
Result is semantically equivalent to ifft(ifftshift(A, dims), dims)
. A
is in-place modified. However, the shift is done with ShiftedArrays
and therefore doesn't allocate memory.
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.rffts
— Functionrffts(A [, dims])
Calculates a rfft(A, dims)
and then shift the frequencies to the center. dims[1]
is not shifted, because there is no negative and positive frequency. The shift is done with ShiftedArrays
and therefore doesn't allocate memory.
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.irffts
— Functionirffts(A, d, [, dims])
Calculates a irfft(A, d, dims)
and then shift the frequencies back to the corner. dims[1]
is not shifted, because there is no negative and positive frequency. The shift is done with ShiftedArrays
and therefore doesn't allocate memory.
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.fftshift_view
— Functionfftshift_view(A [, dims])
Result is semantically equivalent to fftshift(A, dims)
but returns a view instead.
FourierTools.ifftshift_view
— Functionifftshift_view(A [, dims])
Result is semantically equivalent to fftshift(A, dims)
but returns a view instead.
FourierTools.rfftshift_view
— Functionrfftshift_view(A, dims)
Shifts the frequencies to the center expect for dims[1]
because there os no negative and positive frequency.
FourierTools.irfftshift_view
— Functionirfftshift_view(A, dims)
Shifts the frequencies back to the corner except for dims[1]
because there os no negative and positive frequency.
FourierTools.ft
— Functionft(A [, dims])
Digital Fourier-transformation centered in both spaces. The result is semantically equivalent to fftshift(fft(ifftshift(A, dims), dims), dims)
This is a digital Fourier transformation with both coordinate systems in real and Fourier-space being centered at position CtrFT == size÷2+1
The following identities are true:
julia> sz = (5,5)
(5, 5)
julia> ft(ones(sz)) ≈ prod(sz) .* δ(sz)
true
julia> ft(δ(sz)) ≈ ones(sz)
true
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.ift
— Functionift(A [, dims])
Digital inverse Fourier-transformation centered in both spaces. The result is semantically equivalent to fftshift(ifft(ifftshift(A, dims), dims), dims)
This is a digital Fourier transformation with both coordinate systems in real and Fourier-space being centered at position CtrFT == size÷2+1
The following identities are true:
julia> sz = (5,6,7)
(5, 6, 7)
julia> ift(ones(sz)) ≈ δ(sz)
true
julia> ift(δ(sz)) ≈ ones(sz) ./ prod(sz)
true
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.rft
— Functionrft(A [, dims])
Digital real-valued Fourier-transformation centered in both spaces. The result is semantically equivalent to fftshift(rfft(ifftshift(A, dims), dims), dims)
This is a digital Fourier transformation with the coordinate systems in real space centered at CtrFT == size÷2+1 and in (half) Fourier-space being centered at CtrRFT == setindex(size÷2 +1,1,1).
The following identities are true:
julia> sz = (6,6)
(6, 6)
julia> rft(δ(sz)) ≈ ones(rft_size(sz))
true
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FourierTools.irft
— Functionirft(A, d, [, dims])
Digital real-valued inverse Fourier-transformation centered in both spaces. The result is semantically equivalent to fftshift(irfft(ifftshift(A, dims), dims), dims)
This is a digital Fourier transformation with the coordinate systems in real space centered at CtrFT == size÷2+1 and in (half) Fourier-space being centered at CtrRFT == setindex(size÷2 +1,1,1). Note that the size d
of the first transform direction [1] is a required argument.
The following identities are true:
julia> sz = (6,6)
(6, 6)
julia> irft(ones(rft_size(sz)),sz[1]) ≈ δ(sz)
true
See also: ft
, ift
, rft
, irft
, ffts
, iffts
, ffts!
, rffts
, irffts
,
FFT Utils
FourierTools.fftpos
— Functionfftpos(L, N)
Construct a range from -L/2 to L/2. However, we ensure that everything is centered around the center in a way that a FFT interpretes it correctly. For odd sequences it is indeed in the real center. For even sequences the center is at N/2 + 1
.
Examples
julia> collect(fftpos(1, 4))
4-element Array{Float64,1}:
-0.5
-0.25
0.0
0.25
julia> collect(fftpos(1, 5))
5-element Array{Float64,1}:
-0.5
-0.25
0.0
0.25
0.5
FourierTools.fft_center
— Functionfft_center(x)
Returns the center of a size in Fourier sense and Julia 1-based indices.
FourierTools.rft_size
— Functionrft_size(sz::NTuple{Int})
Returns the size of an rft or rfft performed on the data x, without performing the rfft. sz: corresponding real space size to obtain the rft size for
rft_size(arr)
Returns the size of an rft or rfft performed on the data x, without performing the rfft.
arr: array to optain the corresponding rft size for
FourierTools.rfft_size
— Functionrfft_size(size, dims)
Returns the size rfft
would return if applied to a real array. size
is the input size to rfft
and dims
the dimensions the rfft
transforms over. Actually we only would need first(dims)
.
julia> using FFTW
julia> rfft((ones((4,3,2))), (2,3)) |> size
(4, 2, 2)
julia> FourierTools.rfft_size((4,3,2), (2, 3))
(4, 2, 2)
FourierTools.ft_center_diff
— Functionft_center_diff(s [, dims])
Calculates how much each dimension must be shifted that the center frequency is at the Fourier center. This if for a normal fft
FourierTools.rft_center_diff
— Functionrft_center_diff(s [, dims])
Calculates how much each dimension must be shifted that the center frequency is at the Fourier center. This is for rfft
. The dims[1]
must be therefore not shifted!
FourierTools.center_pos
— Functioncenter_pos(x)
Calculate the position of the center frequency. Size of the array is x
Examples
julia> FourierTools.center_pos(3)
2
julia> FourierTools.center_pos(4)
3