Import packages

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


Genearate image for testing

Porespy’s apply_chords is used to demonstrate the chords’ distributions on the phase of interest (void space) on a synthetic image. In this example chords are found along x_direction axis=0.

im = ps.generators.blobs(shape=[500, 500])
im = ps.filters.apply_chords(im)
fig, ax = plt.subplots()
ax.imshow(im, origin="lower");

Implement chord_counts

The generated image containing the chords is passed to chord_counts. The method returns an array of the chords lengths. A histogram of the chord lengths is illustrated below.

chord_length = ps.metrics.chord_counts(im=im)
fig, ax = plt.subplots()
plt.hist(chord_length, bins=100)
plt.xlabel('chord length along x_axis')