two_point_correlation_bf

two_point_correlation_bf(im, spacing=10)[source]

Calculates the two-point correlation function using brute-force (see Notes)

Parameters
  • im (ndarray) – The image of the void space on which the 2-point correlation is desired.

  • spacing (int) – The space between points on the regular grid that is used to generate the correlation (see Notes).

Returns

result – 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. The distance values are binned as follows: bins = range(start=0, stop=np.amin(im.shape)/2, stride=spacing)

Return type

named_tuple

Notes

The brute-force approach means overlaying a grid of equally spaced points onto the image, calculating the distance between each and every pair of points, then counting the instances where both pairs lie in the void space.

This approach uses a distance matrix so can consume memory very quickly for large 3D images and/or close spacing.

Examples

Click here to view online example.