openmc.stats.Uniform

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

Distribution with constant probability over a finite interval [a,b]

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.

  • 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

  • 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 uniform distribution from an XML element

Parameters:

elem (lxml.etree._Element) – XML element

Returns:

Uniform distribution generated from XML element

Return type:

openmc.stats.Uniform

mean() float[source]

Return mean of the uniform distribution

Added in version 0.15.3.

Returns:

Mean of uniform distribution

Return type:

float

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 uniform distribution

Parameters:

element_name (str) – XML element name

Returns:

element – XML element containing uniform distribution data

Return type:

lxml.etree._Element