polydisperse_spheres#
- polydisperse_spheres(shape: List[int], porosity: float, dist, nbins: int = 5, r_min: int = 5, seed=None)[source]#
Create an image of randomly placed, overlapping spheres with a distribution of radii.
- Parameters:
shape (list) – The size of the image to generate in [Nx, Ny, Nz] where Ni is the number of voxels in each direction. If shape is only 2D, then an image of polydisperse disks is returns
porosity (float) – The porosity of the image, defined as the number of void voxels divided by the number of voxels in the image. The specified value is only matched approximately, so it’s suggested to check this value after the image is generated.
dist (scipy.stats distribution object) – This should be an initialized distribution chosen from the large number of options in the
scipy.stats
submodule. For instance, a normal distribution with a mean of 20 and a standard deviation of 10 can be obtained withdist = scipy.stats.norm(loc=20, scale=10)
nbins (int) – The number of discrete sphere sizes that will be used to generate the image. This function generates
nbins
images of monodisperse spheres that span 0.05 and 0.95 of the possible values produced by the provided distribution, then overlays them to get polydispersivity.seed (int, optional, default = None) – Initializes numpy’s random number generator to the specified state. If not provided, the current global value is used. This means calls to
np.random.state(seed)
prior to calling this function will be respected.
- Returns:
image – A boolean array with
True
values denoting the pore space- Return type:
ndarray
Examples
Click here to view online example.