From af442677c015fcf48263fde46b402e665585d71d Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Wed, 2 Sep 2015 19:50:56 -0700 Subject: [PATCH 1/4] Changed Tally.get_value to Tally.get_values in Python scripts --- scripts/openmc-plot-mesh-tally | 4 ++-- scripts/openmc-statepoint-3d | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index 5c46d927c..d49c9061d 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -230,9 +230,9 @@ class MeshPlotter(tk.Frame): meshtuple = (i + 1, axial_level, j + 1) filters, filter_bins = zip(*spec_list + [ (mesh_filter, meshtuple)]) - mean = selectedTally.get_value( + mean = selectedTally.get_values( self.scoreBox.get(), filters, filter_bins) - stdev = selectedTally.get_value( + stdev = selectedTally.get_values( self.scoreBox.get(), filters, filter_bins, value='std_dev') if mbvalue == 'Mean': diff --git a/scripts/openmc-statepoint-3d b/scripts/openmc-statepoint-3d index 30205c769..e667ad0bb 100755 --- a/scripts/openmc-statepoint-3d +++ b/scripts/openmc-statepoint-3d @@ -219,7 +219,7 @@ def main(file_, o): for y in range(1,ny+1): for z in range(1,nz+1): filterspec[0][1] = (x,y,z) - val = sp.get_value(tally.id-1, filterspec, sid)[o.valerr] + val = sp.get_values(tally.id-1, filterspec, sid)[o.valerr] if o.vtk: # vtk cells go z, y, x, so we store it now and enter it later i = (z-1)*nx*ny + (y-1)*nx + x-1 From cfd79626bcfa490e02715451a8309e809497e484 Mon Sep 17 00:00:00 2001 From: Paul Romano Date: Thu, 3 Sep 2015 15:58:33 +0700 Subject: [PATCH 2/4] Fix arguments to Tally.get_values(...) in openmc-plot-mesh-tally --- scripts/openmc-plot-mesh-tally | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index d49c9061d..d9bca6377 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -210,7 +210,7 @@ class MeshPlotter(tk.Frame): mesh_filter = f continue index = self.filterBoxes[f.type].current() - spec_list.append((f, index)) + spec_list.append((f.type, (index,))) text = self.basisBox.get() if text == 'xy': @@ -229,11 +229,11 @@ class MeshPlotter(tk.Frame): else: meshtuple = (i + 1, axial_level, j + 1) filters, filter_bins = zip(*spec_list + [ - (mesh_filter, meshtuple)]) + (mesh_filter.type, (meshtuple,))]) mean = selectedTally.get_values( - self.scoreBox.get(), filters, filter_bins) + [self.scoreBox.get()], filters, filter_bins) stdev = selectedTally.get_values( - self.scoreBox.get(), filters, filter_bins, + [self.scoreBox.get()], filters, filter_bins, value='std_dev') if mbvalue == 'Mean': matrix[i, j] = mean From 53edae4c7e8824b4a3a5dbd03f48a01b9dbeb08b Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 3 Sep 2015 07:31:33 -0700 Subject: [PATCH 3/4] Updated openmc-plot-mesh-tally to include if-else for 2D vs. 3D meshes --- scripts/openmc-plot-mesh-tally | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index d9bca6377..f925b413a 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -133,7 +133,11 @@ class MeshPlotter(tk.Frame): self.mesh = selectedTally.filters_by_name['mesh'].mesh # Get mesh dimensions - self.nx, self.ny, self.nz = self.mesh.dimension + if len(self.mesh.dimension) == 2: + self.nx, self.ny = self.mesh.dimension + self.nz = 1 + else: + self.nx, self.ny, self.nz = self.mesh.dimension # Repopulate comboboxes baesd on current basis selection text = self.basisBox.get() From 4aec0454a8b6f9c68e8737a8b27ecf2b94ef65c6 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Thu, 3 Sep 2015 07:33:33 -0700 Subject: [PATCH 4/4] Updated docstring for Tally.get_values(...) with correct use of Iterable filter bins --- openmc/tallies.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/openmc/tallies.py b/openmc/tallies.py index 6e418a2be..003acd943 100644 --- a/openmc/tallies.py +++ b/openmc/tallies.py @@ -823,10 +823,10 @@ class Tally(object): A list of filter type strings (e.g., ['mesh', 'energy']; default is []) - filter_bins : list + filter_bins : list of Iterables A list of the filter bins corresponding to the filter_types - parameter (e.g., [1, (0., 0.625e-6)]; default is []). Each bin in - the list is the integer ID for 'material', 'surface', 'cell', + parameter (e.g., [(1,), (0., 0.625e-6)]; default is []). Each bin + in the list is the integer ID for 'material', 'surface', 'cell', 'cellborn', and 'universe' Filters. Each bin is an integer for the cell instance ID for 'distribcell Filters. Each bin is a 2-tuple of floats for 'energy' and 'energyout' filters corresponding to the @@ -2099,10 +2099,10 @@ class Tally(object): A list of filter type strings (e.g., ['mesh', 'energy']; default is []) - filter_bins : list + filter_bins : list of Iterables A list of the filter bins corresponding to the filter_types - parameter (e.g., [1, (0., 0.625e-6)]; default is []). Each bin in - the list is the integer ID for 'material', 'surface', 'cell', + parameter (e.g., [(1,), (0., 0.625e-6)]; default is []). Each bin + in the list is the integer ID for 'material', 'surface', 'cell', 'cellborn', and 'universe' Filters. Each bin is an integer for the cell instance ID for 'distribcell Filters. Each bin is a 2-tuple of floats for 'energy' and 'energyout' filters corresponding to the