two_point_correlation#

Calculates the two-point correlation function using Fourier transforms.

[1]:
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps
import inspect
inspect.signature(ps.metrics.two_point_correlation)
[1]:
<Signature (im)>

im#

The input binary image of the porous material with void space voxels labeled with 1(True) and solid phase labeled with 0(False).

[2]:
np.random.seed(10)
im = ps.generators.blobs(shape=[100,100, 100])
fig, ax = plt.subplots(1, 1, figsize=[6, 6])
ax.imshow(im[:,:,6], origin='lower', interpolation='none')
ax.axis(False);
../../../_images/examples_metrics_reference_two_point_correlation_4_0.png

The two_point_correlation returns a custom object containing the distance and probability data. We can then plot the two point correlation function:

[3]:
data = ps.metrics.two_point_correlation(im)
fig, ax = plt.subplots(1, 1, figsize=[6, 6])
ax.plot(data.distance, data.probability, 'r.')
ax.set_xlabel("distance")
ax.set_ylabel("two point correlation function");
../../../_images/examples_metrics_reference_two_point_correlation_6_0.png