Using finufft from python and conda-forge environment
GitHub - flatironinstitute/finufft: Non-uniform fast Fourier transform library of types 1,2,3 in dimensions 1,2,3
git clone https://github.com/flatironinstitute/finufft.git
- Modify
make.inc
.
make lib
export LD_LIBRARY_PATH=finufft_dir/lib
cd python
python setup.py build && pip install -e .
python test/run_accuracy_tests.py
make.inc
for macOS and conda-forge environment:
CFLAGS = -O3
CONDA_PREFIX = /Users/accountname/.miniforge/envs/dev
CXX=$(CONDA_PREFIX)/bin/clang++
CC=$(CONDA_PREFIX)/bin/clang
CFLAGS += -I./include -I$(CONDA_PREFIX)/include
FFLAGS = $(CFLAGS)
CXXFLAGS = $(CFLAGS)
LIBS += -L$(CONDA_PREFIX)/lib
OMPFLAGS = -fopenmp
OMPLIBS = -L$(CONDA_PREFIX)/lib -lomp
(recovery) np.fft.ifft and finufft.nufft1d2
x = 2 * np.pi * np.arange(100) / 100
c = np.exp(1j * x)
f = np.fft.fftshift(np.fft.ifft(c))
c_r = finufft.nufft1d2(x, f)
import matplotlib.pyplot as plt
plt.plot(x, c_r.real)
plt.plot(x, c.real, '.')
plt.show()
Note fftshift
but not ifftshift
for the case that the number of original uniform data is odd. This shift is necessary to make data compatible between np.fft and finufft. See
(interpolation) np.fft.ifft and finufft.nufft1d2
x = 2 * np.pi * np.arange(100) / 100
c = np.exp(1j * x)
f = np.fft.fftshift(np.fft.ifft(c))
y = 2 * np.pi * np.arange(200) / 200
c_i = finufft.nufft1d2(y, f)
import matplotlib.pyplot as plt
plt.plot(y, c_i.real)
plt.plot(x, c.real, '.')
plt.show()
Note fftshift
but not ifftshift
for the case that the number of original uniform data is odd. This shift is necessary to make data compatible between np.fft and finufft. See