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
import inspect
inspect.signature(ps.metrics.two_point_correlation)
<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).

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/dee7ab9c1b2f3bdf441ac1ec802d4ed309b9768c62e90f4a0680a6ed00807f54.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=[6, 6])
ax.plot(data.distance, data.probability, 'r.')
ax.set_xlabel("distance")
ax.set_ylabel("two point correlation function");
../../../_images/b890cf74536535a5d8ff0c585d347ad74169d6b64987ba0149dad146fc69bcac.png