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