openmc.stats.Discrete¶
- class openmc.stats.Discrete(x, p)[source]¶
Distribution characterized by a probability mass function.
The Discrete distribution assigns probability values to discrete values of a random variable, rather than expressing the distribution as a continuous random variable.
- Parameters
x (Iterable of float) – Values of the random variable
p (Iterable of float) – Discrete probability for each value
- Variables
x (numpy.ndarray) – Values of the random variable
p (numpy.ndarray) – Discrete probability for each value
- clip(tolerance: float = 1e-06, inplace: bool = False) Discrete [source]¶
Remove low-importance points from discrete distribution.
Given a probability mass function \(p(x)\) with \(\{x_1, x_2, x_3, \dots\}\) the possible values of the random variable with corresponding probabilities \(\{p_1, p_2, p_3, \dots\}\), this function will remove any low-importance points such that \(\sum_i x_i p_i\) is preserved to within some threshold.
New in version 0.14.0.
- classmethod from_xml_element(elem: Element)[source]¶
Generate discrete distribution from an XML element
- Parameters
elem (lxml.etree._Element) – XML element
- Returns
Discrete distribution generated from XML element
- Return type
- integral()[source]¶
Return integral of distribution
New in version 0.13.1.
- Returns
Integral of discrete distribution
- Return type
- classmethod merge(dists: Sequence[Discrete], probs: Sequence[int])[source]¶
Merge multiple discrete distributions into a single distribution
New in version 0.13.1.
- Parameters
dists (iterable of openmc.stats.Discrete) – Discrete distributions to combine
probs (iterable of float) – Probability of each distribution
- Returns
Combined discrete distribution
- Return type