chord_counts

Import packages

[1]:
import matplotlib.pyplot as plt
import numpy as np
import porespy as ps

ps.visualization.set_mpl_style()
np.random.seed(10)

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.

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

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.

[3]:
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')
plt.ylabel('frequency');
../../../_images/examples_metrics_howtos_chord_counts_8_0.svg