radial_density_distribution(dt, bins=10, log=False, voxel_size=1)[source]

Computes radial density function by analyzing the histogram of voxel values in the distance transform. This function is defined by Torquato [1] as:

\[\int_0^\infty P(r)dr = 1.0\]

where P(r)dr is the probability of finding a voxel at a lying at a radial distance between r and dr from the solid interface. This is equivalent to a probability density function (pdf)

The cumulative distribution is defined as:

\[F(r) = \int_r^\infty P(r)dr\]

which gives the fraction of pore-space with a radius larger than r. This is equivalent to the cumulative distribution function (cdf).

  • dt (ND-array) – A distance transform of the pore space (the edt package is recommended). Note that it is recommended to apply find_dt_artifacts to this image first, and set potentially erroneous values to 0 with dt[mask] = 0 where mask = porespy.filters.find_dt_artifaces(dt).

  • bins (int or array_like) – This number of bins (if int) or the location of the bins (if array). This argument is passed directly to Scipy’s histogram function so see that docstring for more information. The default is 10 bins, which reduces produces a relatively smooth distribution.

  • log (boolean) – If True 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 named-tuple containing several 1D arrays:

R or LogR

Radius, equivalent to bin_centers


Probability density function


Cumulative density function


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



Torquato refers to this as the pore-size density function, and mentions that it is also known as the pore-size distribution function. These terms are avoided here since they have specific connotations in porous media analysis.


[1] Torquato, S. Random Heterogeneous Materials: Mircostructure and Macroscopic Properties. Springer, New York (2002) - See page 48 & 292


Click here to view online example.