From 0fbe8e72f1dcf09178e5647e93797c2c866f3fa3 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 30 Aug 2016 12:04:34 -0600 Subject: [PATCH 1/4] Bug fix for MGXS Pandas DataFrames with selected nuclides --- openmc/mgxs/mgxs.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index de7475308c..d0bc07987c 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -1496,12 +1496,14 @@ class MGXS(object): # If the user requested a specific set of nuclides elif self.by_nuclide and nuclides != 'all': + query_nuclides = nuclides xs_tally = self.xs_tally.get_slice(nuclides=nuclides) df = xs_tally.get_pandas_dataframe( distribcell_paths=distribcell_paths) # If the user requested all nuclides, keep nuclide column in dataframe else: + query_nuclides = self.get_nuclides() df = self.xs_tally.get_pandas_dataframe( distribcell_paths=distribcell_paths) @@ -1513,7 +1515,7 @@ class MGXS(object): # Override energy groups bounds with indices all_groups = np.arange(self.num_groups, 0, -1, dtype=np.int) - all_groups = np.repeat(all_groups, self.num_nuclides) + all_groups = np.repeat(all_groups, len(query_nuclides)) if 'energy low [MeV]' in df and 'energyout low [MeV]' in df: df.rename(columns={'energy low [MeV]': 'group in'}, inplace=True) From b80b0fae835e920e1fc2a7686265cc37cd200cb1 Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 30 Aug 2016 14:29:19 -0400 Subject: [PATCH 2/4] Fixed isue with MGXS Pandas DataFrame with total nuclides --- openmc/mgxs/mgxs.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index d0bc07987c..dd5c2056c6 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -337,7 +337,7 @@ class MGXS(object): if self.by_nuclide: return self.get_nuclides() else: - return 'sum' + return ['sum'] @property def loaded_sp(self): @@ -1483,7 +1483,7 @@ class MGXS(object): if self.by_nuclide and nuclides == 'sum': # Use tally summation to sum across all nuclides - query_nuclides = self.get_nuclides() + query_nuclides = [nuclides] xs_tally = self.xs_tally.summation(nuclides=query_nuclides) df = xs_tally.get_pandas_dataframe( distribcell_paths=distribcell_paths) @@ -1503,7 +1503,7 @@ class MGXS(object): # If the user requested all nuclides, keep nuclide column in dataframe else: - query_nuclides = self.get_nuclides() + query_nuclides = self.nuclides df = self.xs_tally.get_pandas_dataframe( distribcell_paths=distribcell_paths) From 627057d87717411c94475e53ac097a33a3dddadf Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 30 Aug 2016 16:03:29 -0400 Subject: [PATCH 3/4] Fixed query_nuclides for sum in MGXS Pandas DataFrames --- openmc/mgxs/mgxs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index dd5c2056c6..543caf088a 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -1484,7 +1484,7 @@ class MGXS(object): # Use tally summation to sum across all nuclides query_nuclides = [nuclides] - xs_tally = self.xs_tally.summation(nuclides=query_nuclides) + xs_tally = self.xs_tally.summation(nuclides=self.get_nuclides()) df = xs_tally.get_pandas_dataframe( distribcell_paths=distribcell_paths) From 96acab8ba1f8e34200a72a66fd768d9bcaed15aa Mon Sep 17 00:00:00 2001 From: Will Boyd Date: Tue, 30 Aug 2016 21:40:50 -0400 Subject: [PATCH 4/4] Fixed bug in nuclide summation for MGXS Pandas DataFrame --- openmc/mgxs/mgxs.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/openmc/mgxs/mgxs.py b/openmc/mgxs/mgxs.py index 543caf088a..1d2e9098d3 100644 --- a/openmc/mgxs/mgxs.py +++ b/openmc/mgxs/mgxs.py @@ -1490,9 +1490,9 @@ class MGXS(object): # Remove nuclide column since it is homogeneous and redundant if self.domain_type == 'mesh': - df.drop('nuclide', axis=1, level=0, inplace=True) + df.drop('sum(nuclide)', axis=1, level=0, inplace=True) else: - df.drop('nuclide', axis=1, inplace=True) + df.drop('sum(nuclide)', axis=1, inplace=True) # If the user requested a specific set of nuclides elif self.by_nuclide and nuclides != 'all':