Teach deplete.Nuclide.validate about new fission yields

Reconfigure tests/unit_tests/test_deplete_chain.py and
tests/unit_tests/test_deplete_nuclide.py to use the new
dictionary-like representation of fission yields.
This commit is contained in:
Andrew Johnson 2019-08-21 17:46:51 -05:00
parent 93d68a24df
commit 4f46aa895c
No known key found for this signature in database
GPG key ID: 253418E91B7F6FEB
3 changed files with 6 additions and 6 deletions

View file

@ -321,8 +321,8 @@ class Nuclide(object):
valid = False
if self.yield_data:
for energy, yield_list in self.yield_data.items():
sum_yield = sum(y[1] for y in yield_list)
for energy, fission_yield in self.yield_data.items():
sum_yield = fission_yield.yields.sum()
stat = 2.0 - tolerance <= sum_yield <= 2.0 + tolerance
if stat:
continue

View file

@ -377,7 +377,7 @@ def test_validate(simple_chain):
# Fix fission yields but keep to restore later
old_yields = simple_chain["C"].yield_data
simple_chain["C"].yield_data = {0.0253: [("A", 1.4), ("B", 0.6)]}
simple_chain["C"].yield_data = {0.0253: {"A": 1.4, "B": 0.6}}
assert simple_chain.validate(strict=True, tolerance=0.0)
with pytest.warns(None) as record:

View file

@ -177,8 +177,8 @@ def test_validate():
# fission yields
nuc.yield_data = {
0.0253: [("0", 1.5), ("1", 0.5)],
1e6: [("0", 1.5), ("1", 0.5)],
0.0253: {"0": 1.5, "1": 0.5},
1e6: {"0": 1.5, "1": 0.5},
}
# nuclide is good and should have no warnings raise
@ -212,7 +212,7 @@ def test_validate():
# restore reactions, invalidate fission yields
nuc.reactions.append(reaction)
nuc.yield_data[1e6].pop()
nuc.yield_data[1e6].yields *= 2
with pytest.raises(ValueError, match=r"fission yields.*1\.0*e"):
nuc.validate(strict=True, quiet=False, tolerance=0.0)