Merge pull request #2046 from nelsonag/mgxs_print_xs_issue2042

Clarify usage of MGXS.rxn_type in MGXS.print_xs methods
This commit is contained in:
Paul Romano 2022-05-09 14:13:22 -05:00 committed by GitHub
commit 0c04053242
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 163 additions and 86 deletions

View file

@ -120,8 +120,11 @@ class MDGXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -605,7 +608,7 @@ class MDGXS(MGXS):
# Build header for string with type and domain info
string = 'Multi-Delayed-Group XS\n'
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.rxn_type)
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.mgxs_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id)
@ -1000,8 +1003,11 @@ class ChiDelayed(MDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -1516,8 +1522,11 @@ class DelayedNuFissionXS(MDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -1652,8 +1661,11 @@ class Beta(MDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -1842,8 +1854,11 @@ class DecayRate(MDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -2152,8 +2167,11 @@ class MatrixMDGXS(MDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -2477,7 +2495,7 @@ class MatrixMDGXS(MDGXS):
# Build header for string with type and domain info
string = 'Multi-Delayed-Group XS\n'
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.rxn_type)
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.mgxs_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id)
@ -2748,8 +2766,11 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -2759,6 +2780,6 @@ class DelayedNuFissionMatrixXS(MatrixMDGXS):
super().__init__(domain, domain_type, energy_groups, delayed_groups,
by_nuclide, name, num_polar, num_azimuthal)
self._rxn_type = 'delayed-nu-fission'
self._hdf5_key = 'delayed-nu-fission matrix'
self._mgxs_type = 'delayed-nu-fission matrix'
self._estimator = 'analog'
self._valid_estimators = ['analog']

View file

@ -237,8 +237,11 @@ class MGXS:
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -266,7 +269,7 @@ class MGXS:
self._sparse = False
self._loaded_sp = False
self._derived = False
self._hdf5_key = None
self._mgxs_type = None
self._valid_estimators = ESTIMATOR_TYPES
self.name = name
@ -305,7 +308,7 @@ class MGXS:
clone._sparse = self.sparse
clone._loaded_sp = self._loaded_sp
clone._derived = self.derived
clone._hdf5_key = self._hdf5_key
clone._mgxs_type = self._mgxs_type
clone._tallies = OrderedDict()
for tally_type, tally in self.tallies.items():
@ -609,9 +612,9 @@ class MGXS:
return self._derived
@property
def hdf5_key(self):
if self._hdf5_key is not None:
return self._hdf5_key
def mgxs_type(self):
if self._mgxs_type is not None:
return self._mgxs_type
else:
return self._rxn_type
@ -1725,7 +1728,7 @@ class MGXS:
# Build header for string with type and domain info
string = 'Multi-Group XS\n'
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.rxn_type)
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.mgxs_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id)
@ -1912,7 +1915,7 @@ class MGXS:
subdomain_group = domain_group
# Create a separate HDF5 group for this cross section
rxn_group = subdomain_group.require_group(self.hdf5_key)
rxn_group = subdomain_group.require_group(self.mgxs_type)
# Create a separate HDF5 group for each nuclide
for j, nuclide in enumerate(nuclides):
@ -2238,8 +2241,11 @@ class MatrixMGXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@property
@ -2534,7 +2540,7 @@ class MatrixMGXS(MGXS):
# Build header for string with type and domain info
string = 'Multi-Group XS\n'
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.rxn_type)
string += '{0: <16}=\t{1}\n'.format('\tReaction Type', self.mgxs_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain Type', self.domain_type)
string += '{0: <16}=\t{1}\n'.format('\tDomain ID', self.domain.id)
@ -2732,8 +2738,11 @@ class TotalXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -2870,8 +2879,11 @@ class TransportXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3108,8 +3120,11 @@ class DiffusionCoefficient(TransportXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3291,8 +3306,11 @@ class AbsorptionXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3417,8 +3435,11 @@ class CaptureXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3570,8 +3591,11 @@ class FissionXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3738,8 +3762,11 @@ class KappaFissionXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -3869,8 +3896,11 @@ class ScatterXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -4013,8 +4043,11 @@ class ArbitraryXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -4145,8 +4178,11 @@ class ArbitraryMatrixXS(MatrixMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -4347,8 +4383,11 @@ class ScatterMatrixXS(MatrixMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -4705,17 +4744,17 @@ class ScatterMatrixXS(MatrixMGXS):
if self.formulation == 'simple':
if not nu:
self._rxn_type = 'scatter'
self._hdf5_key = 'scatter matrix'
self._mgxs_type = 'scatter matrix'
else:
self._rxn_type = 'nu-scatter'
self._hdf5_key = 'nu-scatter matrix'
self._mgxs_type = 'nu-scatter matrix'
else:
if not nu:
self._rxn_type = 'scatter'
self._hdf5_key = 'consistent scatter matrix'
self._mgxs_type = 'consistent scatter matrix'
else:
self._rxn_type = 'nu-scatter'
self._hdf5_key = 'consistent nu-scatter matrix'
self._mgxs_type = 'consistent nu-scatter matrix'
@formulation.setter
def formulation(self, formulation):
@ -4725,15 +4764,15 @@ class ScatterMatrixXS(MatrixMGXS):
if self.formulation == 'simple':
self._valid_estimators = ['analog']
if not self.nu:
self._hdf5_key = 'scatter matrix'
self._mgxs_type = 'scatter matrix'
else:
self._hdf5_key = 'nu-scatter matrix'
self._mgxs_type = 'nu-scatter matrix'
else:
self._valid_estimators = ['tracklength']
if not self.nu:
self._hdf5_key = 'consistent scatter matrix'
self._mgxs_type = 'consistent scatter matrix'
else:
self._hdf5_key = 'consistent nu-scatter matrix'
self._mgxs_type = 'consistent nu-scatter matrix'
@correction.setter
def correction(self, correction):
@ -5195,9 +5234,9 @@ class ScatterMatrixXS(MatrixMGXS):
cv.check_value('xs_type', xs_type, ['macro', 'micro'])
if self.correction != 'P0' and self.scatter_format == SCATTER_LEGENDRE:
rxn_type = '{0} (P{1})'.format(self.rxn_type, moment)
rxn_type = '{0} (P{1})'.format(self.mgxs_type, moment)
else:
rxn_type = self.rxn_type
rxn_type = self.mgxs_type
# Build header for string with type and domain info
string = 'Multi-Group XS\n'
@ -5434,8 +5473,11 @@ class MultiplicityMatrixXS(MatrixMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -5607,8 +5649,11 @@ class ScatterProbabilityMatrix(MatrixMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -5622,7 +5667,7 @@ class ScatterProbabilityMatrix(MatrixMGXS):
super().__init__(domain, domain_type, groups, by_nuclide,
name, num_polar, num_azimuthal)
self._rxn_type = 'scatter'
self._hdf5_key = 'scatter probability matrix'
self._mgxs_type = 'scatter probability matrix'
self._estimator = 'analog'
self._valid_estimators = ['analog']
@ -5780,8 +5825,11 @@ class NuFissionMatrixXS(MatrixMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -5792,10 +5840,10 @@ class NuFissionMatrixXS(MatrixMGXS):
num_polar, num_azimuthal)
if not prompt:
self._rxn_type = 'nu-fission'
self._hdf5_key = 'nu-fission matrix'
self._mgxs_type = 'nu-fission matrix'
else:
self._rxn_type = 'prompt-nu-fission'
self._hdf5_key = 'prompt-nu-fission matrix'
self._mgxs_type = 'prompt-nu-fission matrix'
self._estimator = 'analog'
self._valid_estimators = ['analog']
self.prompt = prompt
@ -5938,8 +5986,11 @@ class Chi(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -5953,10 +6004,6 @@ class Chi(MGXS):
num_azimuthal=1):
super().__init__(domain, domain_type, groups, by_nuclide, name,
num_polar, num_azimuthal)
if not prompt:
self._rxn_type = 'chi'
else:
self._rxn_type = 'chi-prompt'
self._estimator = 'analog'
self._valid_estimators = ['analog']
self.prompt = prompt
@ -6031,11 +6078,11 @@ class Chi(MGXS):
cv.check_type('prompt', prompt, bool)
self._prompt = prompt
if not self.prompt:
self._rxn_type = 'nu-fission'
self._hdf5_key = 'chi'
self._rxn_type = 'chi'
self._mgxs_type = 'chi'
else:
self._rxn_type = 'prompt-nu-fission'
self._hdf5_key = 'chi-prompt'
self._rxn_type = 'chi-prompt'
self._mgxs_type = 'chi-prompt'
def get_homogenized_mgxs(self, other_mgxs):
"""Construct a homogenized mgxs with other MGXS objects.
@ -6465,8 +6512,11 @@ class InverseVelocity(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
@ -6584,8 +6634,11 @@ class MeshSurfaceMGXS(MGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
def __init__(self, domain=None, domain_type=None, energy_groups=None,
@ -6970,8 +7023,11 @@ class Current(MeshSurfaceMGXS):
Whether or not a statepoint file has been loaded with tally data
derived : bool
Whether or not the MGXS is merged from one or more other MGXS
hdf5_key : str
The key used to index multi-group cross sections in an HDF5 data store
mgxs_type : str
The name of this MGXS type, to be used when printing and
indexing in an HDF5 data store
.. versionadded:: 0.13.1
"""
def __init__(self, domain=None, domain_type=None,