two_point_correlation#

two_point_correlation(im, voxel_size=1, bins=100)[source]#

Calculate the two-point correlation function using Fourier transforms

Parameters:
  • im (ndarray) – The image of the void space on which the 2-point correlation is desired, in which the phase of interest is labelled as True

  • voxel_size (scalar) – The size of a voxel side in preferred units. The default is 1, so the user can apply the scaling to the returned results after the fact.

  • bins (scalar or array_like) – Either an array of bin sizes to use, or the number of bins that should be automatically generated that span the data range. The maximum value of the bins, if passed as an array, cannot exceed the distance from the center of the image to the corner.

Returns:

result – The two-point correlation function object, with named attributes:

distance

The distance between two points, equivalent to bin_centers

bin_centers

The center point of each bin. See distance

bin_edges

Locations of bin divisions, including 1 more value than the number of bins

bin_widths

Useful for passing to the width argument of matplotlib.pyplot.bar

probability_normalized

The probability that two points of the stated separation distance are within the same phase normalized to 1 at r = 0

probability or pdf

The probability that two points of the stated separation distance are within the same phase scaled to the phase fraction at r = 0

Return type:

tpcf

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 this thesis.

Examples

Click here to view online example.