generic_distribution

openpnm.models.geometry.pore_size.generic_distribution(target, func, seeds='pore.seed')[source]

Accepts an ‘rv_frozen’ object from the Scipy.stats submodule and returns values from the distribution for the given seeds

This uses the ppf method of the stats object

Parameters
  • %(models.target.parameters)s

  • %(models.misc.seeds)s

  • func (object) – A ‘rv_frozen’ object from the scipy.stats library with all of the parameters pre-specified.

Returns

Return type

%(models.misc.stats.returns)s

Examples

The following code illustrates the process of obtaining a ‘frozen’ Scipy stats object and adding it as a model:

import numpy
import scipy.stats
import openpnm as op
import matplotlib.pyplot as plt

pn = op.network.Cubic(shape=[3, 3, 3])
geo = op.geometry.GenericGeometry(network=pn, pores=pn.Ps, throats=pn.Ts)
geo.add_model(propname='pore.seed',
              model=op.models.geometry.pore_seed.random)

# Now retrieve the stats distribution and add to ``geo`` as a model
stats_obj = scipy.stats.weibull_min(c=2, scale=.0001, loc=0)
geo.add_model(propname='pore.size',
              model=op.models.geometry.pore_size.generic_distribution,
              seeds='pore.seed',
              func=stats_obj)

plt.hist(stats_obj.ppf(q=numpy.random.rand(1000)), bins=50)

plt.show()
../../_images/openpnm-models-geometry-pore_size-generic_distribution-1.svg