openmc.lib.WeightWindows
- class openmc.lib.WeightWindows(id=None, new=True, index=None)[source]
WeightWindows stored internally.
This class exposes a weight windows object that is stored internally in the OpenMC library. To obtain a view of a weight windows object with a given ID, use the
openmc.lib.weight_windowsmapping.Added in version 0.14.0.
- Parameters:
- Variables:
id (int) – ID of the weight windows object
mesh (openmc.lib.Mesh) – Mesh used for the weight windows
particle (openmc.ParticleType) – The particle type to which these weight windows apply
energy_bounds (numpy.ndarray) – The energy bounds for the weight windows
bounds (numpy.ndarray) – The weight window bounds
- classmethod from_tally(tally, particle=<ParticleType: neutron (PDG=2112)>)[source]
Create an instance of the WeightWindows class based on the specified tally.
- Parameters:
tally (openmc.lib.Tally) – The tally used to create the WeightWindows instance.
particle (openmc.ParticleType or str or int, optional) – The particle type to use for the WeightWindows instance. Should be specified as an instance of ParticleType, a PDG number, or as a name.
- Returns:
The WeightWindows instance created from the specified tally.
- Return type:
- Raises:
ValueError – If the particle parameter is not an instance of ParticleType, a string, or an integer PDG number.
ValueError – If the particle parameter is not a valid particle type (i.e., not ‘neutron’ or ‘photon’).
ValueError – If the specified particle is not included in the bins of the ParticleFilter of the tally.
ValueError – If the tally does not have a MeshFilter.
- update_magic(tally, value='mean', threshold=1.0, ratio=5.0)[source]
Update weight window values using the MAGIC method
Reference: https://inis.iaea.org/records/231pm-zzy35
- Parameters:
tally (openmc.lib.Tally object) – The tally used to update weight window information
value (str) – Value type used to generate weight windows. One of {‘mean’, ‘rel_err’}.
threshold (float) – Threshold for relative error of results used to generate weight window bounds
ratio (float) – Ratio of the lower to upper weight window bounds