FourierTools.jl aims at simplifying work in Fourier/Frequency space without loosing efficiency.
We provide several convenient wrappers to speed-up the common
This package also brings functionality to up and downsample signals through sinc interpolation.
Furthermore, based on FFTs it provides shearing, rotation, convolution and (sub) pixel shift functions which can be applied to N-dimensional data efficiently.
Fourier space is commonly used for convolution operations, as the Fast Fourier Transformation (FFT) is, as its name may suggest, O(N log N) fast. The FFT algorithm typically produces data at a mangled form that makes it difficult to directly apply functions to.
fftshift is a way to deal with this but involves data copies.
Based on the packages ShiftedArrays.jl and PaddedViews.jl, the FourierTools.jl package implements views to the results of the FFTW routines
rfft and their inverse
irfft including the respective
fftshift operations but implemented as views rather than copying data. The indexing is, in notable difference to FFTViews.jl kept as ordinary arrays are indexed. This helps with the seamless integration across packages.
To implement an FFT-based
resample operation of real-valued data, a new view, derived from
AbstractArray is introduced, handling potential copy and addition operations for even-sized arrays to enforce the real-valuedness of the corresponding real space data (
select_region_ft). In the community it has been discussed, whether such an operation is necessary. Referring to this discussion, we argue that the Fourier-space operations cannot be replaced by casting to
real, since the latter violates Parseval's theorem.
In addition to the
FourierTools.jl also provides a tool for sub-pixel shifting based FFTs. Further algorithms like shearing, sub-pixel shifting and rotation can be also implemented via the use of the Fourier shift theorem and due to the generality of the FFT these can be applied to N-dimensional datasets efficiently.