Make sure Chain.reduce preserves information in the .sources attribute

This commit is contained in:
Paul Romano 2022-10-27 08:51:32 -05:00
parent 97f1e2fdd7
commit df9f7ec814
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