mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
Merge pull request #715 from wbinventor/hotfix-mgxs-pandas-nuclides
[HOTFIX] MGXS Pandas DataFrames with Nuclides
This commit is contained in:
commit
b47ccb4d8c
1 changed files with 8 additions and 6 deletions
|
|
@ -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,25 +1483,27 @@ class MGXS(object):
|
|||
if self.by_nuclide and nuclides == 'sum':
|
||||
|
||||
# Use tally summation to sum across all nuclides
|
||||
query_nuclides = self.get_nuclides()
|
||||
xs_tally = self.xs_tally.summation(nuclides=query_nuclides)
|
||||
query_nuclides = [nuclides]
|
||||
xs_tally = self.xs_tally.summation(nuclides=self.get_nuclides())
|
||||
df = xs_tally.get_pandas_dataframe(
|
||||
distribcell_paths=distribcell_paths)
|
||||
|
||||
# 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':
|
||||
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.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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue