From 16fcc9300caf8e5bb0a52ca648ecacf61a8b3aee Mon Sep 17 00:00:00 2001 From: "wbinventor@gmail.com" Date: Mon, 14 Dec 2015 09:32:10 -0500 Subject: [PATCH] Remove unused nonzero method and added docstring for shape property to Tally Python API class --- openmc/tallies.py | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/openmc/tallies.py b/openmc/tallies.py index b57a0d228..0954122d8 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -70,6 +70,9 @@ class Tally(object): Total number of filter bins accounting for all filters num_bins : Integral Total number of bins for the tally + shape : 3-tuple of Integral + The shape of the tally data array ordered as the number of filter bins, + nuclide bins and score bins num_realizations : Integral Total number of realizations with_summary : bool @@ -251,10 +254,6 @@ class Tally(object): def scores(self): return self._scores - @property - def shape(self): - return (self.num_filter_bins, self.num_nuclides, self.num_score_bins) - @property def num_scores(self): return len(self._scores) @@ -279,6 +278,10 @@ class Tally(object): num_bins *= self.num_score_bins return num_bins + @property + def shape(self): + return (self.num_filter_bins, self.num_nuclides, self.num_score_bins) + @property def estimator(self): return self._estimator @@ -312,10 +315,6 @@ class Tally(object): sum = data['sum'] sum_sq = data['sum_sq'] - # Define a routine to convert 0 to 1 - def nonzero(val): - return 1 if not val else val - # Reshape the results arrays sum = np.reshape(sum, self.shape) sum_sq = np.reshape(sum_sq, self.shape)