weibull¶
- openpnm.models.geometry.throat_size.weibull(target, shape, scale, loc, seeds='throat.seed')[source]¶
Produces values from a Weibull distribution given a set of random numbers.
- Parameters
target (OpenPNM Base object) – Object with which this model is associated. This controls the length of the calculated array, and also provides access to other necessary properties.
seeds (string, optional) – Name of the dictionary key on
target
where the array containing random seed values (between 0 and 1) is stored. These values are used to do a reverse lookup on the cdf of given distribution using theppf
method on the scipy.stats object. Truncating the range (e.g. from 0.1 to 0.9) is often useful to prevent the occurance of extreme values from the long tails.shape (float) – Controls the width or skewness of the distribution. For more information on the effect of this parameter refer to the corresponding scipy.stats function.
scale (float) – Controls the width of the distribution. For more information on the effect of this parameter refer to the corresponding scipy.stats function.
loc (float) – Specifies the central value of ???
- Returns
values – A numpy ndarray containing values following the distribution
- Return type
ndndarray
Examples
The following code illustrates the inner workings of this function, which uses the ‘weibull_min’ method of the scipy.stats module. This can be used to find suitable values of ‘shape’, ‘scale’` and ‘loc’. Note that ‘shape’ is represented by ‘c’ in the actual function call.
import numpy import scipy.stats import matplotlib.pyplot as plt func = scipy.stats.weibull_min(c=1.5, scale=0.0001, loc=0) plt.hist(func.ppf(q=numpy.random.rand(10000)), bins=50) plt.show()