two_point_correlation#

Calculates the two-point correlation function using Fourier transforms.

import matplotlib.pyplot as plt
import numpy as np
import porespy as ps

ps.visualization.set_mpl_style()

im#

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

np.random.seed(10)
im = ps.generators.blobs(shape=[100, 100, 100])

fig, ax = plt.subplots(1, 1, figsize=[4, 4])
ax.imshow(im[:, :, 6], origin="lower", interpolation="none")
ax.axis(False);
../../../_images/408499e3f1a90c0be3bb72c4c63390433768ff20dbfd461647fe53edfe3fc08b.png

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

data = ps.metrics.two_point_correlation(im)

fig, ax = plt.subplots(1, 1, figsize=[4, 4])
ax.plot(data.distance, data.probability, "r.")
ax.set_xlabel("distance")
ax.set_ylabel("two point correlation function");
../../../_images/0ce4420ac4d16068630a2b9436b257eb37f6a1bbaead1fb9618275d42b4be56d.png