"The NFFT is a C subroutine library for computing the nonequispaced discrete Fourier transform (NDFT) in one or more dimensions, of arbitrary input size, and of complex data."
The NFFT library is licensed under GPLv2.
This wrapper provides a somewhat Pythonic access to some of the core NFFT library functionalities and is largely inspired from the pyFFTW project developped by Henry Gomersall (http://hgomersall.github.io/pyFFTW/).
The documentation is hosted on pythonhosted, the source code is available on github and the Python package index page is here.
Step-by-step installation instructions
- Install
fftw You need
gcccompiler for installingfftwwith--enable-openmp. Thegccin Apple Silicon Mac (macOS > v12.0) actually points toclangInstall
gcc-12with brew:brew install gcc@12
Download FFTW 3.3.10 from fftw.org and extract the folder
cdinto thefftwfolder and use this configuration:./configure CC="gcc-12" --enable-shared --enable-threads --enable-openmp sudo make sudo make check sudo make install
Check
/usr/local/lib/and/usr/local/include/to see iffftw3is installed.
- Install
- Install
NFFT You need
autoconf automake libtoolfor this step. Install it with:brew install autoconf automake libtool
Make sure you edit your
.zshrcto add it to yourPATHDownload the 3.5.3 release of the NFFT git repository:
https://github.com/NFFT/nfft/releases/download/3.5.3/nfft-3.5.3.tar.gz
cdinto theNFFTfolder and use this configuration:./bootstrap.sh ./configure CC="gcc-12" --enable-all --enable-openmp --enable-shared --with-fftw3-libdir=/usr/local/lib/ --with-fftw3-includedir=/usr/local/include/ sudo make sudo make check sudo make install
Check
/usr/local/lib/and/usr/local/include/to see ifnfftis installed.
- Install
- Install
pyNFFT Clone this repository:
git clone https://github.com/rohandahale/pyNFFT.git
Install
ehtim,cythonwithpipto run thissetup.py:pip install ehtim pip install Cython==0.29.32
cdinto pyNFFT folder, build and installpynfft:export MACOSX_DEPLOYMENT_TARGET=16.0 python setup.py build_ext -I /usr/local/include/ -L /usr/local/lib/ -R /usr/local/lib/ pip install . --no-build-isolation
Important: Fix the duplicate RPATH issue that may occur with conda/micromamba environments.
Find your Python environment path and run:
# Replace YOUR_USERNAME and YOUR_ENV_NAME with your actual values for module in nfft solver util; do install_name_tool -delete_rpath /Users/YOUR_USERNAME/path/to/envs/YOUR_ENV_NAME/lib \ pynfft/${module}.cpython-311-darwin.so install_name_tool -add_rpath /usr/local/lib \ pynfft/${module}.cpython-311-darwin.so doneVerify the installation:
python >>> import pynfft >>> print(pynfft.__version__)
Done.
- Install
Note for macOS 16 (Sequoia) users: The setup.py has been updated to handle the macOS 16.0 deployment target requirements. If you're using an older macOS version, you can adjust the minos value in the setup.py accordingly (e.g., 12.0, 13.0, etc.).
See the tutorial section of the documentation.
- Python 3.11
- ehtim 1.2.10
- FFTW 3.3.10
- NFFT 3.5.3
- Cython 0.29.32
See the CONTRIBUTING file.
The pyNFFT project is licensed under the GPLv3. See the bundled COPYING file for more details.