diff --git a/docs/source/pythonapi/examples/tally-arithmetic.ipynb b/docs/source/pythonapi/examples/tally-arithmetic.ipynb index d1325e487..bbadd1ac4 100644 --- a/docs/source/pythonapi/examples/tally-arithmetic.ipynb +++ b/docs/source/pythonapi/examples/tally-arithmetic.ipynb @@ -418,15 +418,15 @@ "\n", "# Instantiate flux Tally in moderator and fuel\n", "tally = openmc.Tally(name='flux')\n", - "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id]),\n", - " energy_filter]\n", + "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id])]\n", + "tally.filters.append(energy_filter)\n", "tally.scores = ['flux']\n", "tallies_file.add_tally(tally)\n", "\n", "# Instantiate reaction rate Tally in fuel\n", "tally = openmc.Tally(name='fuel rxn rates')\n", - "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id]),\n", - " energy_filter]\n", + "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id])]\n", + "tally.filters.append(energy_filter)\n", "tally.scores = ['nu-fission', 'scatter']\n", "tally.nuclides = [u238, u235]\n", "tallies_file.add_tally(tally)\n", @@ -516,8 +516,8 @@ "\n", "# Instantiate flux Tally in moderator and fuel\n", "tally = openmc.Tally(name='need-to-slice')\n", - "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id]),\n", - " energy_filter]\n", + "tally.filters = [openmc.Filter(type='cell', bins=[fuel_cell.id, moderator_cell.id])]\n", + "tally.filters.append(energy_filter)\n", "tally.scores = ['nu-fission', 'scatter']\n", "tally.nuclides = [h1, u238]\n", "tallies_file.add_tally(tally)" diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index ad987d70f..68d34dce3 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -510,14 +510,14 @@ class MGXS(object): # Create each Tally needed to compute the multi group cross section for score, key, filters in zip(scores, keys, all_filters): self.tallies[key] = openmc.Tally(name=self.name) - self.tallies[key].scores.append(score) + self.tallies[key].scores = [score] self.tallies[key].estimator = estimator - self.tallies[key].filters.append(domain_filter) + self.tallies[key].filters = [domain_filter] # If a tally trigger was specified, add it to each tally if self.tally_trigger: trigger_clone = copy.deepcopy(self.tally_trigger) - trigger_clone.scores.append(score) + trigger_clone.scores = [score] self.tallies[key].triggers.append(trigger_clone) # Add all non-domain specific Filters (e.g., 'energy') to the Tally diff --git a/openmc/tallies.py b/openmc/tallies.py index 9d6ed4b7f..d56512155 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -449,9 +449,9 @@ class Tally(object): """ - warnings.warn("Tally.add_trigger(...) has been deprecated and may be " - "removed in a future version. Tally triggers should be " - "defined using the triggers property directly.", + warnings.warn('Tally.add_trigger(...) has been deprecated and may be ' + 'removed in a future version. Tally triggers should be ' + 'defined using the triggers property directly.', DeprecationWarning) self.triggers.append(trigger) @@ -540,9 +540,9 @@ class Tally(object): """ - warnings.warn("Tally.add_filter(...) has been deprecated and may be " - "removed in a future version. Tally filters should be " - "defined using the filters property directly.", + warnings.warn('Tally.add_filter(...) has been deprecated and may be ' + 'removed in a future version. Tally filters should be ' + 'defined using the filters property directly.', DeprecationWarning) self.filters.append(new_filter) @@ -565,9 +565,9 @@ class Tally(object): """ - warnings.warn("Tally.add_nuclide(...) has been deprecated and may be " - "removed in a future version. Tally nuclides should be " - "defined using the nuclides property directly.", + warnings.warn('Tally.add_nuclide(...) has been deprecated and may be ' + 'removed in a future version. Tally nuclides should be ' + 'defined using the nuclides property directly.', DeprecationWarning) self.nuclides.append(nuclide) @@ -589,9 +589,9 @@ class Tally(object): """ - warnings.warn("Tally.add_score(...) has been deprecated and may be " - "removed in a future version. Tally scores should be " - "defined using the scores property directly.", + warnings.warn('Tally.add_score(...) has been deprecated and may be ' + 'removed in a future version. Tally scores should be ' + 'defined using the scores property directly.', DeprecationWarning) self.scores.append(score) @@ -2324,9 +2324,9 @@ class Tally(object): new_tally.with_summary = self.with_summary new_tally.num_realization = self.num_realizations - new_tally.filters = self.filters - new_tally.nuclides = self.nuclides - new_tally.scores = self.scores + new_tally.filters = copy.deepcopy(self.filters) + new_tally.nuclides = copy.deepcopy(self.nuclides) + new_tally.scores = copy.deepcopy(self.scores) # If this tally operand is sparse, sparsify the new tally new_tally.sparse = self.sparse @@ -2396,9 +2396,9 @@ class Tally(object): new_tally.with_summary = self.with_summary new_tally.num_realization = self.num_realizations - new_tally.filters = self.filters - new_tally.nuclides = self.nuclides - new_tally.scores = self.scores + new_tally.filters = copy.deepcopy(self.filters) + new_tally.nuclides = copy.deepcopy(self.nuclides) + new_tally.scores = copy.deepcopy(self.scores) # If this tally operand is sparse, sparsify the new tally new_tally.sparse = self.sparse @@ -2468,9 +2468,9 @@ class Tally(object): new_tally.with_summary = self.with_summary new_tally.num_realization = self.num_realizations - new_tally.filters = self.filters - new_tally.nuclides = self.nuclides - new_tally.scores = self.scores + new_tally.filters = copy.deepcopy(self.filters) + new_tally.nuclides = copy.deepcopy(self.nuclides) + new_tally.scores = copy.deepcopy(self.scores) # If this tally operand is sparse, sparsify the new tally new_tally.sparse = self.sparse @@ -2544,9 +2544,9 @@ class Tally(object): new_tally.with_summary = self.with_summary new_tally.num_realization = self.num_realizations - new_tally.filters = self.filters - new_tally.nuclides = self.nuclides - new_tally.scores = self.scores + new_tally.filters = copy.deepcopy(self.filters) + new_tally.nuclides = copy.deepcopy(self.nuclides) + new_tally.scores = copy.deepcopy(self.scores) # If original tally was sparse, sparsify the exponentiated tally new_tally.sparse = self.sparse