openmc.stats.DecaySpectrum

class openmc.stats.DecaySpectrum(nuclides: dict[str, float], volume: float)[source]

Energy distribution from decay photon spectra of a mixture of nuclides.

This distribution stores nuclide names, their atom densities, and the volume of the region. When written to XML and read by the C++ solver, the nuclide names are resolved against the depletion chain to obtain the decay photon energy spectra and decay constants. The resulting distribution is a mixture of per-nuclide photon spectra weighted by absolute activity. The volume is necessary so that the C++ solver can compute the total photon emission rate in [photons/s], which is used as the source strength.

Added in version 0.15.4.

Parameters:
  • nuclides (dict) – Dictionary mapping nuclide name (str) to atom density (float) in units of [atom/b-cm].

  • volume (float) – Volume of the source region in [cm³]. Used together with atom densities to compute the absolute photon emission rate.

Variables:
  • nuclides (dict) – Dictionary mapping nuclide name to atom density in [atom/b-cm].

  • volume (float) – Volume of the source region in [cm³].

clip(tolerance: float = 1e-09, inplace: bool = False)[source]

Remove nuclides with negligible contribution to photon emission.

Nuclides that are stable or have no photon source in the depletion chain are removed unconditionally. The remaining nuclides are ranked by their photon emission rate (proportional to atom_density * decay_constant * photon_yield) and the least important are discarded until the cumulative discarded fraction of the total emission rate exceeds tolerance.

Requires openmc.config['chain_file'] to be set.

Parameters:
  • tolerance (float) – Maximum fraction of total photon emission rate that may be discarded.

  • inplace (bool) – Whether to modify the current object in-place or return a new one.

Returns:

Distribution with negligible nuclides removed.

Return type:

openmc.stats.DecaySpectrum

evaluate(x)[source]

Evaluate the probability density at a given value.

Delegates to the combined distribution built from chain data. Raises NotImplementedError if the combined distribution is a Mixture (which does not support evaluate()).

Parameters:

x (float) – Value at which to evaluate the PDF.

Returns:

Probability density at x.

Return type:

float

classmethod from_xml_element(elem: Element)[source]

Generate decay photon distribution from an XML element

Parameters:

elem (lxml.etree._Element) – XML element

Returns:

Decay photon distribution generated from XML element

Return type:

openmc.stats.DecaySpectrum

integral()[source]

Return integral of the distribution

Returns the total photon emission rate in [photons/s] by delegating to to_distribution(). Returns 0.0 when no chain data is available (e.g., openmc.config['chain_file'] is not set).

Returns:

Total photon emission rate in [photons/s], or 0.0 if chain data is unavailable.

Return type:

float

mean()[source]

Return the mean of the distribution.

Delegates to the combined distribution built from chain data.

Returns:

Mean photon energy in [eV].

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_distribution()[source]

Convert to a concrete distribution using decay chain data.

Builds a combined photon energy distribution by looking up each nuclide in the depletion chain via openmc.data.decay_photon_energy() and weighting by absolute atom count (density * 1e24 * volume). The result is cached on the object; the cache is invalidated automatically when nuclides or volume are reassigned.

Requires openmc.config['chain_file'] to be set.

Returns:

Combined photon energy distribution, or None if no nuclide in nuclides has a photon source in the chain.

Return type:

openmc.stats.Univariate or None

to_xml_element(element_name: str)[source]

Return XML representation of the decay photon distribution

Parameters:

element_name (str) – XML element name

Returns:

element – XML element containing decay photon distribution data

Return type:

lxml.etree._Element