mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-21 14:35:27 -04:00
Avoid storing inconsistent sum/sum_sq on summed D1S tallies (#3949)
Co-authored-by: shimwell <mail@jshimwell.com> Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
1914e3eefa
commit
ddabe1c8c5
2 changed files with 10 additions and 5 deletions
|
|
@ -186,8 +186,6 @@ def apply_time_correction(
|
|||
|
||||
# Apply TCF, broadcasting to the correct dimensions
|
||||
tcf.shape = (1, -1, 1, 1, 1)
|
||||
new_tally._sum = tally_sum * tcf
|
||||
new_tally._sum_sq = tally_sum_sq * (tcf*tcf)
|
||||
new_tally._mean = tally_mean * tcf
|
||||
new_tally._std_dev = tally_std_dev * tcf
|
||||
|
||||
|
|
@ -196,6 +194,8 @@ def apply_time_correction(
|
|||
if sum_nuclides:
|
||||
# Sum over parent nuclides (note that when combining different bins for
|
||||
# parent nuclide, we can't work directly on sum_sq)
|
||||
new_tally._sum = None
|
||||
new_tally._sum_sq = None
|
||||
new_tally._mean = new_tally.mean.sum(axis=1).reshape(shape)
|
||||
new_tally._std_dev = np.linalg.norm(new_tally.std_dev, axis=1).reshape(shape)
|
||||
new_tally._derived = True
|
||||
|
|
@ -203,9 +203,10 @@ def apply_time_correction(
|
|||
# Remove ParentNuclideFilter
|
||||
new_tally.filters.pop(i_filter)
|
||||
else:
|
||||
# Change shape back to (filter combinations, nuclides, scores)
|
||||
new_tally._sum.shape = shape
|
||||
new_tally._sum_sq.shape = shape
|
||||
# Apply TCF and change shape back to (filter combinations, nuclides,
|
||||
# scores)
|
||||
new_tally._sum = (tally_sum * tcf).reshape(shape)
|
||||
new_tally._sum_sq = (tally_sum_sq * (tcf*tcf)).reshape(shape)
|
||||
new_tally._mean.shape = shape
|
||||
new_tally._std_dev.shape = shape
|
||||
|
||||
|
|
|
|||
|
|
@ -150,3 +150,7 @@ def test_apply_time_correction(run_in_tmpdir):
|
|||
result_summed.get_reshaped_data()
|
||||
result.get_pandas_dataframe()
|
||||
result_summed.get_pandas_dataframe()
|
||||
|
||||
# The summed tally is derived, so sum/sum_sq are None
|
||||
assert result_summed.sum is None
|
||||
assert result_summed.sum_sq is None
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue