def translate_fourier(image, dx):
N = image.shape[<NUM_LIT:0>]<EOL>f = <NUM_LIT:2>*np.pi*np.fft.fftfreq(N)<EOL>kx,ky,kz = np.meshgrid(*(f,)*<NUM_LIT:3>, indexing='<STR_LIT>')<EOL>kv = np.array([kx,ky,kz]).T<EOL>q = np.fft.fftn(image)*np.exp(-<NUM_LIT>*(kv*dx).sum(axis=-<NUM_LIT:1>)).T<EOL>return np.real(np.fft.ifftn(q))<EOL>
Translate an image in fourier-space with plane waves