From a1dd566143d698644b3ef778b9084fdac066a4a3 Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Thu, 14 Nov 2019 13:39:31 -0500 Subject: [PATCH 1/3] fix mesh plotter energy filter bins --- scripts/openmc-plot-mesh-tally | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index 183fe35c5..bb82c650e 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -176,8 +176,8 @@ class MeshPlotter(tk.Frame): # Set combobox items if filterType in ['Energy', 'Energyout']: - combobox['values'] = ['{0} to {1}'.format(*f.bins[i:i+2]) - for i in range(len(f.bins) - 1)] + combobox['values'] = ['{0} to {1}'.format(*f.bins[i]) + for i in range(len(f.bins))] else: combobox['values'] = [str(i) for i in f.bins] @@ -210,7 +210,7 @@ class MeshPlotter(tk.Frame): continue elif f.short_name in ['Energy', 'Energyout']: index = self.filterBoxes[f.short_name].current() - ebin = (f.bins[index], f.bins[index + 1]) + ebin = f.bins[index] spec_list.append((type(f), (ebin,))) else: index = self.filterBoxes[f.short_name].current() From a9031a2a9a6046e2661f311c26c9b500b9e4b913 Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Thu, 14 Nov 2019 15:57:04 -0500 Subject: [PATCH 2/3] simplify list comprehension over energy bins --- scripts/openmc-plot-mesh-tally | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index bb82c650e..e500cd5ca 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -176,8 +176,8 @@ class MeshPlotter(tk.Frame): # Set combobox items if filterType in ['Energy', 'Energyout']: - combobox['values'] = ['{0} to {1}'.format(*f.bins[i]) - for i in range(len(f.bins))] + combobox['values'] = ['{} to {}'.format(bin) + for bin in f.bins)] else: combobox['values'] = [str(i) for i in f.bins] From e5448bf16db2514430f8f90044b418a40f919624 Mon Sep 17 00:00:00 2001 From: Gavin Ridley Date: Thu, 14 Nov 2019 15:59:50 -0500 Subject: [PATCH 3/3] bin is apparently a keyword in python --- scripts/openmc-plot-mesh-tally | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/scripts/openmc-plot-mesh-tally b/scripts/openmc-plot-mesh-tally index e500cd5ca..b4ce92587 100755 --- a/scripts/openmc-plot-mesh-tally +++ b/scripts/openmc-plot-mesh-tally @@ -176,8 +176,8 @@ class MeshPlotter(tk.Frame): # Set combobox items if filterType in ['Energy', 'Energyout']: - combobox['values'] = ['{} to {}'.format(bin) - for bin in f.bins)] + combobox['values'] = ['{} to {}'.format(*ebin) + for ebin in f.bins] else: combobox['values'] = [str(i) for i in f.bins]