Merge pull request #2283 from paulromano/chain-reduce-sources-bugfix

Make sure Chain.reduce preserves decay source information
This commit is contained in:
Ethan Peterson 2022-10-29 09:11:22 -04:00 committed by GitHub
commit b9c1eb34fb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 0 deletions

View file

@ -1025,6 +1025,7 @@ class Chain:
new_nuclide = Nuclide(previous.name)
new_nuclide.half_life = previous.half_life
new_nuclide.decay_energy = previous.decay_energy
new_nuclide.sources = previous.sources.copy()
if hasattr(previous, '_fpy'):
new_nuclide._fpy = previous._fpy

View file

@ -500,6 +500,7 @@ def test_reduce(gnd_simple_chain, endf_chain):
assert u5_round0.n_decay_modes == ref_U5.n_decay_modes
assert u5_round0.half_life == ref_U5.half_life
assert u5_round0.decay_energy == ref_U5.decay_energy
assert u5_round0.sources == ref_U5.sources
for newmode, refmode in zip(u5_round0.decay_modes, ref_U5.decay_modes):
assert newmode.target is None
assert newmode.type == refmode.type
@ -522,6 +523,7 @@ def test_reduce(gnd_simple_chain, endf_chain):
assert bareI5.n_decay_modes == ref_iodine.n_decay_modes
assert bareI5.half_life == ref_iodine.half_life
assert bareI5.decay_energy == ref_iodine.decay_energy
assert bareI5.sources == ref_iodine.sources
for newmode, refmode in zip(bareI5.decay_modes, ref_iodine.decay_modes):
assert newmode.target is None
assert newmode.type == refmode.type