Addressed comments by @samuelshaner

This commit is contained in:
wbinventor@gmail.com 2016-02-26 19:44:03 -05:00
parent ead3f50d27
commit d66556a637
5 changed files with 27 additions and 24 deletions

View file

@ -927,11 +927,6 @@ class AggregateFilter(object):
if bin in other.bins:
return False
# None of the bins in the other filter should match in this filter
for bin in other.bins:
if bin in self.bins:
return False
# If all conditional checks passed then filters are mergeable
return True

View file

@ -86,6 +86,8 @@ class Filter(object):
else:
return False
else:
# Compare largest/smallest energy bin edges in energy filters
# This logic is used when merging tallies with energy filters
if 'energy' in self.type and 'energy' in other.type:
return self.bins[0] >= other.bins[-1]
else:

View file

@ -253,7 +253,7 @@ class Geometry(object):
"""
if case_sensitive:
if not case_sensitive:
name = name.lower()
all_materials = self.get_all_materials()
@ -293,7 +293,7 @@ class Geometry(object):
"""
if case_sensitive:
if not case_sensitive:
name = name.lower()
all_cells = self.get_all_cells()
@ -333,7 +333,7 @@ class Geometry(object):
"""
if case_sensitive:
if not case_sensitive:
name = name.lower()
all_cells = self.get_all_cells()
@ -373,7 +373,7 @@ class Geometry(object):
"""
if case_sensitive:
if not case_sensitive:
name = name.lower()
all_universes = self.get_all_universes()
@ -413,7 +413,7 @@ class Geometry(object):
"""
if case_sensitive:
if not case_sensitive:
name = name.lower()
all_lattices = self.get_all_lattices()

View file

@ -241,8 +241,7 @@ class MGXS(object):
@property
def num_subdomains(self):
tally = list(self.tallies.values())[0]
domain_filter = tally.find_filter(self.domain_type)
domain_filter = self.xs_tally.find_filter(self.domain_type)
return domain_filter.num_bins
@property
@ -877,14 +876,19 @@ class MGXS(object):
# Clone this MGXS to initialize the subdomain-averaged version
avg_xs = copy.deepcopy(self)
avg_xs._rxn_rate_tally = None
avg_xs._xs_tally = None
# Average each of the tallies across subdomains
for tally_type, tally in avg_xs.tallies.items():
tally_avg = tally.average(filter_type=self.domain_type,
filter_bins=subdomains)
avg_xs.tallies[tally_type] = tally_avg
if self.derived:
avg_xs._rxn_rate_tally = avg_xs.rxn_rate_tally.average(
filter_type=self.domain_type, filter_bins=subdomains)
else:
avg_xs._rxn_rate_tally = None
avg_xs._xs_tally = None
# Average each of the tallies across subdomains
for tally_type, tally in avg_xs.tallies.items():
tally_avg = tally.average(filter_type=self.domain_type,
filter_bins=subdomains)
avg_xs.tallies[tally_type] = tally_avg
avg_xs._domain_type = 'avg({0})'.format(self.domain_type)
avg_xs.sparse = self.sparse
@ -1002,8 +1006,10 @@ class MGXS(object):
def merge(self, other):
"""Merge another MGXS with this one
If results have been loaded from a statepoint, then MGXS are only
mergeable along one and only one of energy groups or nuclides.
MGXS are only mergeable if their energy groups and nuclides are either
identical or mutually exclusive. If results have been loaded from a
statepoint, then MGXS are only mergeable along one and only one of
energy groups or nuclides.
Parameters
----------
@ -1510,7 +1516,7 @@ class TotalXS(MGXS):
@property
def rxn_rate_tally(self):
if self._rxn_rate_tally is None:
if self._rxn_rate_tally is None :
self._rxn_rate_tally = self.tallies['total']
self._rxn_rate_tally.sparse = self.sparse
return self._rxn_rate_tally

View file

@ -881,7 +881,7 @@ class Tally(object):
# Differentiate Tally with a new auto-generated Tally ID
merged_tally.id = None
# If the two tallies are equal, simpy return copy
# If the two tallies are equal, simply return copy
if self == other:
return merged_tally
@ -936,7 +936,7 @@ class Tally(object):
# If results have not been read, then return tally for input generation
if self._results_read is None:
return merged_tally
#Otherwise, this is a derived tally which needs merged results arrays
# Otherwise, this is a derived tally which needs merged results arrays
else:
self._derived = True