mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-27 13:45:36 -04:00
Merge pull request #664 from wbinventor/hotfix-exact-tallies
[HOTFIX] Improved Exact Paramter for StatePoint.get_tally(...)
This commit is contained in:
commit
d20322f22d
2 changed files with 27 additions and 18 deletions
|
|
@ -693,7 +693,7 @@ class MGXS(object):
|
|||
for tally_type, tally in self.tallies.items():
|
||||
sp_tally = statepoint.get_tally(
|
||||
tally.scores, tally.filters, tally.nuclides,
|
||||
estimator=tally.estimator, exact=True)
|
||||
estimator=tally.estimator, exact_filters=True)
|
||||
sp_tally = sp_tally.get_slice(
|
||||
tally.scores, filters, filter_bins, tally.nuclides)
|
||||
sp_tally.sparse = self.sparse
|
||||
|
|
|
|||
|
|
@ -497,17 +497,18 @@ class StatePoint(object):
|
|||
self.tallies[tally_id].sparse = self.sparse
|
||||
|
||||
def get_tally(self, scores=[], filters=[], nuclides=[],
|
||||
name=None, id=None, estimator=None, exact=False):
|
||||
name=None, id=None, estimator=None, exact_filters=False,
|
||||
exact_nuclides=False, exact_scores=False):
|
||||
"""Finds and returns a Tally object with certain properties.
|
||||
|
||||
This routine searches the list of Tallies and returns the first Tally
|
||||
found which satisfies all of the input parameters.
|
||||
|
||||
NOTE: If the "exact" parameter is False (default), the input parameters
|
||||
do not need to match the complete Tally specification and may only
|
||||
represent a subset of the Tally's properties. If the "exact" parameter
|
||||
is True then the scores, filters, nuclides and estimator parameters
|
||||
must precisely match those of any matching Tally.
|
||||
NOTE: If any of the "exact" parameters are False (default), the input
|
||||
parameters do not need to match the complete Tally specification and
|
||||
may only represent a subset of the Tally's properties. If an "exact"
|
||||
parameter is True then number of scores, filters, or nuclides in the
|
||||
parameters must precisely match those of any matching Tally.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
|
|
@ -523,9 +524,18 @@ class StatePoint(object):
|
|||
The id specified for the Tally (default is None).
|
||||
estimator: str, optional
|
||||
The type of estimator ('tracklength', 'analog'; default is None).
|
||||
exact : bool
|
||||
Whether to strictly enforce the match between the parameters and
|
||||
the returned tally
|
||||
exact_filters : bool
|
||||
If True, the number of filters in the parameters must be identical
|
||||
to those in the matching Tally. If False (default), the filters in
|
||||
the parameters may be a subset of those in the matching Tally.
|
||||
exact_nuclides : bool
|
||||
If True, the number of nuclides in the parameters must be identical
|
||||
to those in the matching Tally. If False (default), the nuclides in
|
||||
the parameters may be a subset of those in the matching Tally.
|
||||
exact_scores : bool
|
||||
If True, the number of scores in the parameters must be identical
|
||||
to those in the matching Tally. If False (default), the scores
|
||||
in the parameters may be a subset of those in the matching Tally.
|
||||
|
||||
Returns
|
||||
-------
|
||||
|
|
@ -554,17 +564,16 @@ class StatePoint(object):
|
|||
continue
|
||||
|
||||
# Determine if Tally has queried estimator
|
||||
if (estimator or exact) and estimator != test_tally.estimator:
|
||||
if estimator and estimator != test_tally.estimator:
|
||||
continue
|
||||
|
||||
# The number of filters, nuclides and scores must exactly match
|
||||
if exact:
|
||||
if len(scores) != test_tally.num_scores:
|
||||
continue
|
||||
if len(nuclides) != test_tally.num_nuclides:
|
||||
continue
|
||||
if len(filters) != test_tally.num_filters:
|
||||
continue
|
||||
if exact_scores and len(scores) != test_tally.num_scores:
|
||||
continue
|
||||
if exact_nuclides and len(nuclides) != test_tally.num_nuclides:
|
||||
continue
|
||||
if exact_filters and len(filters) != test_tally.num_filters:
|
||||
continue
|
||||
|
||||
# Determine if Tally has the queried score(s)
|
||||
if scores:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue