mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 05:35:49 -04:00
Apply suggestions from code review
Co-Authored-By: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
0cf3ea3b16
commit
2aa1849eda
5 changed files with 8 additions and 8 deletions
|
|
@ -127,7 +127,7 @@ class Chain(object):
|
|||
fission_yields : None or iterable of dict
|
||||
List of effective fission yields for materials. Each dictionary
|
||||
should be of the form ``{parent: {product: yield}}`` with
|
||||
types ``{str: {str: Real}}``, where ``yield`` is the fission product yield
|
||||
types ``{str: {str: float}}``, where ``yield`` is the fission product yield
|
||||
for isotope ``parent`` producing isotope ``product``.
|
||||
A single entry indicates yields are constant across all materials.
|
||||
Otherwise, an entry can be added for each material to be burned.
|
||||
|
|
@ -395,14 +395,14 @@ class Chain(object):
|
|||
Returns
|
||||
-------
|
||||
fission_yields : dict
|
||||
Dictionary of ``{parent : {product : f_yield}}``
|
||||
Dictionary of ``{parent: {product: f_yield}}``
|
||||
where ``parent`` and ``product`` are both string
|
||||
names of nuclides with yield data and ``f_yield``
|
||||
is a float for the fission yield.
|
||||
"""
|
||||
out = {}
|
||||
for nuc in self.nuclides:
|
||||
if len(nuc.yield_data) == 0:
|
||||
if not nuc.yield_data:
|
||||
continue
|
||||
yield_obj = nuc.yield_data[min(nuc.yield_energies)]
|
||||
out[nuc.name] = dict(yield_obj)
|
||||
|
|
|
|||
|
|
@ -317,7 +317,7 @@ class FissionYieldCutoffHelper(TalliedFissionYieldHelper):
|
|||
if fast is None:
|
||||
# find first index <= cutoff
|
||||
rev_ix = self._find_fallback_energy(
|
||||
name, list(reversed(energies)), cutoff, False)
|
||||
name, reversed(energies), cutoff, False)
|
||||
fast = yields[energies[-rev_ix]]
|
||||
self._thermal_yields[name] = thermal
|
||||
self._fast_yields[name] = fast
|
||||
|
|
@ -518,7 +518,7 @@ class AveragedFissionYieldHelper(TalliedFissionYieldHelper):
|
|||
fission_tally = self._fission_rate_tally
|
||||
|
||||
weighted_tally = Tally()
|
||||
weighted_tally.filters = fission_tally.filters.copy()
|
||||
weighted_tally.filters = fission_tally.filters
|
||||
weighted_tally.scores = ['fission']
|
||||
|
||||
ene_bin = EnergyFilter()
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ def test_from_xml(simple_chain):
|
|||
assert [r.branching_ratio for r in nuc.reactions] == [1.0, 0.7, 0.3]
|
||||
|
||||
# Yield tests
|
||||
assert nuc.yield_energies == (0.0253, )
|
||||
assert nuc.yield_energies == (0.0253,)
|
||||
assert list(nuc.yield_data) == [0.0253]
|
||||
assert nuc.yield_data[0.0253].products == ("A", "B")
|
||||
assert (nuc.yield_data[0.0253].yields == [0.0292737, 0.002566345]).all()
|
||||
|
|
|
|||
|
|
@ -91,7 +91,7 @@ def test_cutoff_failure(key):
|
|||
FissionYieldCutoffHelper(None, None, **{key: -1})
|
||||
|
||||
|
||||
class ProxyMixin(object):
|
||||
class ProxyMixin:
|
||||
"""Mixing that overloads the tally generation"""
|
||||
def generate_tallies(self, materials, mat_indexes):
|
||||
self._fission_rate_tally = Mock()
|
||||
|
|
|
|||
|
|
@ -76,7 +76,7 @@ def test_from_xml():
|
|||
0.0253: {"Xe138": 0.0481413, "Zr100": 0.0497641, "Te134": 0.062155}})
|
||||
assert u235.yield_data == expected_yield_data
|
||||
# test accessing the yield energies through the FissionYieldDistribution
|
||||
assert u235.yield_energies == (0.0253, )
|
||||
assert u235.yield_energies == (0.0253,)
|
||||
assert u235.yield_energies is u235.yield_data.energies
|
||||
with pytest.raises(AttributeError): # not settable
|
||||
u235.yield_energies = [0.0253, 5e5]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue