Adding type hints to RSA
@@ -7,6 +7,7 @@ from skimage.morphology import ball, disk, square, cube
from tqdm import tqdm
from porespy.tools import norm_to_uniform
from typing import List
+from numpy import array
def insert_shape(im, center, element, value=1):
@@ -30,7 +31,8 @@ def insert_shape(im, center, element, value=1):
return im
-def RSA(im, radius, volume_fraction=1, mode='extended'):
+def RSA(im: array, radius: int, volume_fraction: int = 1,
+ mode: str = 'extended'):
r"""
Generates a sphere or disk packing using Random Sequential Addition, which
ensures that spheres do not overlap but does not guarantee they are
@@ -171,7 +173,8 @@ def bundle_of_tubes(shape: List[int], spacing: int):
def polydisperse_spheres(shape: List[int], porosity: float, dist,
nbins: int = 5):
r"""
- Create an image of spheres with a distribution of radii.
+ Create an image of randomly place, overlapping spheres with a distribution
+ of radii.
Parameters
----------
@@ -187,10 +190,10 @@ def polydisperse_spheres(shape: List[int], porosity: float, dist,
after the image is generated.
dist : scipy.stats distribution object
- This should be an initialized distribution 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 obtain with
- ``dist = scipy.stats.norm(loc=20, scale=10)``
+ 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 with ``dist = scipy.stats.norm(loc=20, scale=10)``
nbins : scalar
The number of discrete sphere sizes that will be used to generate the
