code: def two_point_correlation_fft(im):
      r
      # Calculate half lengths of the image
      hls = (np.ceil(np.shape(im))/2).astype(int)
      # Fourier Transform and shift image
      F = sp_ft.ifftshift(sp_ft.fftn(sp_ft.fftshift(im)))
      # Compute Power Spectrum
      P = sp.absolute(F**2)
      # Auto-correlation is inverse of Power Spectrum
      autoc = sp.absolute(sp_ft.ifftshift(sp_ft.ifftn(sp_ft.fftshift(P))))
      tpcf = _radial_profile(autoc, r_max=np.min(hls))
      return tpcf
docs: r"""
      Calculates the two-point correlation function using fourier transforms
  
      Parameters
      ----------
      im : ND-array
          The image of the void space on which the 2-point correlation is desired
  
      Returns
      -------
      result : named_tuple
          A tuple containing the x and y data for plotting the two-point
          correlation function, using the *args feature of matplotlib's plot
          function.  The x array is the distances between points and the y array
          is corresponding probabilities that points of a given distance both
          lie in the void space.
  
      Notes
      -----
      The fourier transform approach utilizes the fact that the autocorrelation
      function is the inverse FT of the power spectrum density.
      For background read the Scipy fftpack docs and for a good explanation see:
      http://www.ucl.ac.uk/~ucapikr/projects/KamilaSuankulova_BSc_Project.pdf