From ffd78be628e1371489ea9f7df7a46975feccb490 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Wed, 1 Apr 2020 12:52:01 -0500 Subject: [PATCH] Changes in statepoint.py from PullRequest Inc. review --- openmc/statepoint.py | 32 ++++++-------------------------- 1 file changed, 6 insertions(+), 26 deletions(-) diff --git a/openmc/statepoint.py b/openmc/statepoint.py index dcb8b7924..782e8ba4e 100644 --- a/openmc/statepoint.py +++ b/openmc/statepoint.py @@ -416,14 +416,10 @@ class StatePoint: nuclide = openmc.Nuclide(name.decode().strip()) tally.nuclides.append(nuclide) - scores = group['score_bins'][()] - n_score_bins = group['n_score_bins'][()] - # Add the scores to the Tally - for j, score in enumerate(scores): - score = score.decode() - - tally.scores.append(score) + scores = group['score_bins'][()] + for score in scores: + tally.scores.append(score.decode()) # Add Tally to the global dictionary of all Tallies tally.sparse = self.sparse @@ -586,15 +582,7 @@ class StatePoint: # Determine if Tally has the queried score(s) if scores: - contains_scores = True - - # Iterate over the scores requested by the user - for score in scores: - if score not in test_tally.scores: - contains_scores = False - break - - if not contains_scores: + if not all(score in test_tally.scores for score in scores): continue # Determine if Tally has the queried Filter(s) @@ -620,15 +608,7 @@ class StatePoint: # Determine if Tally has the queried Nuclide(s) if nuclides: - contains_nuclides = True - - # Iterate over the Nuclides requested by the user - for nuclide in nuclides: - if nuclide not in test_tally.nuclides: - contains_nuclides = False - break - - if not contains_nuclides: + if not all(nuclide in test_tally.nuclides for nuclide in nuclides): continue # If the current Tally met user's request, break loop and return it @@ -676,7 +656,7 @@ class StatePoint: cells = summary.geometry.get_all_cells() - for tally_id, tally in self.tallies.items(): + for tally in self.tallies.values(): tally.with_summary = True for tally_filter in tally.filters: