openmc.stats.PowerLaw

class openmc.stats.PowerLaw(a: float = 0.0, b: float = 1.0, n: float = 0.0, bias: Univariate | None = None)[source]

Distribution with power law probability over a finite interval [a,b]

The power law distribution has density function \(p(x) dx = c x^n dx\).

Added in version 0.13.0.

Parameters:
  • a (float, optional) – Lower bound of the sampling interval. Defaults to zero.

  • b (float, optional) – Upper bound of the sampling interval. Defaults to unity.

  • n (float, optional) – Power law exponent. Defaults to zero, which is equivalent to a uniform distribution.

  • bias (openmc.stats.Univariate, optional) – Distribution for biased sampling.

Variables:
  • a (float) – Lower bound of the sampling interval

  • b (float) – Upper bound of the sampling interval

  • n (float) – Power law exponent

  • support (tuple of float) – A 2-tuple (lower, upper) defining the interval over which the distribution is nonzero-valued

  • bias (openmc.stats.Univariate or None) – Distribution for biased sampling

evaluate(x)[source]

Evaluate the probability density at the provided value.

Parameters:

x (float or sequence of float) – Location to evaluate p(x)

Returns:

Value of p(x)

Return type:

float or numpy.ndarray

classmethod from_xml_element(elem: Element)[source]

Generate power law distribution from an XML element

Parameters:

elem (lxml.etree._Element) – XML element

Returns:

Distribution generated from XML element

Return type:

openmc.stats.PowerLaw

property support

Return the support of the probability distribution.

Returns:

Returns the set of unique points assigned probability mass in a discrete distribution, the sampling interval for a continuous distribution, or a dictionary storing the discrete and continuous parts of the support of a mixed random variable

Return type:

set or tuple of float or dict

to_xml_element(element_name: str)[source]

Return XML representation of the power law distribution

Parameters:

element_name (str) – XML element name

Returns:

element – XML element containing distribution data

Return type:

lxml.etree._Element