pore_size_distribution(im, bins=10, log=True, voxel_size=1)[source]#

Calculate a pore-size distribution based on the image produced by the porosimetry or local_thickness functions.

  • im (ndarray) – The array of containing the sizes of the largest sphere that overlaps each voxel. Obtained from either porosimetry or local_thickness.

  • bins (scalar or array_like) – Either an array of bin sizes to use, or the number of bins that should be automatically generated that span the data range.

  • log (boolean) – If True (default) the size data is converted to log (base-10) values before processing. This can help to plot wide size distributions or to better visualize the in the small size region. Note that you should not anti-log the radii values in the retunred tuple, since the binning is performed on the logged radii values.

  • voxel_size (scalar) – The size of a voxel side in preferred units. The default is 1, so the user can apply the scaling to the returned results after the fact.


result – A custom object with the following data added as named attributes:

R or logR

Radius, equivalent to bin_centers


Probability density function


Cumulative density function


Phase saturation in differential form. For the cumulative saturation, just use cfd which is already normalized to 1.


The center point of each bin


Locations of bin divisions, including 1 more value than the number of bins


Useful for passing to the width argument of matplotlib.pyplot.bar

Return type:

Results object


(1) To ensure the returned values represent actual sizes you can manually scale the input image by the voxel size first (im *= voxel_size)

plt.bar(psd.R, psd.satn, width=psd.bin_widths, edgecolor=’k’)


Click here to view online example.