Merge pull request #575 from wbinventor/mgxs-better-comparisons

Remove NumPy Elementwise Comparison Warnings from openmc.mgxs
This commit is contained in:
Paul Romano 2016-01-28 07:28:43 -06:00
commit 2760551323

View file

@ -673,14 +673,14 @@ class MGXS(object):
filter_bins = []
# Construct a collection of the domain filter bins
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
for subdomain in subdomains:
filters.append(self.domain_type)
filter_bins.append((subdomain,))
# Construct list of energy group bounds tuples for all requested groups
if groups != 'all':
if not isinstance(groups, basestring):
cv.check_iterable_type('groups', groups, Integral)
for group in groups:
filters.append('energy')
@ -838,7 +838,7 @@ class MGXS(object):
"""
# Construct a collection of the subdomain filter bins to average across
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
elif self.domain_type == 'distribcell':
subdomains = np.arange(self.num_subdomains)
@ -881,7 +881,7 @@ class MGXS(object):
"""
# Construct a collection of the subdomains to report
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
elif self.domain_type == 'distribcell':
subdomains = np.arange(self.num_subdomains, dtype=np.int)
@ -1010,7 +1010,7 @@ class MGXS(object):
xs_results = h5py.File(filename, 'w')
# Construct a collection of the subdomains to report
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
elif self.domain_type == 'distribcell':
subdomains = np.arange(self.num_subdomains, dtype=np.int)
@ -1192,7 +1192,7 @@ class MGXS(object):
"""
if groups != 'all':
if not isinstance(groups, basestring):
cv.check_iterable_type('groups', groups, Integral)
if nuclides != 'all' and nuclides != 'sum':
cv.check_iterable_type('nuclides', nuclides, basestring)
@ -1252,7 +1252,7 @@ class MGXS(object):
columns = ['group in']
# Select out those groups the user requested
if groups != 'all':
if not isinstance(groups, basestring):
if 'group in' in df:
df = df[df['group in'].isin(groups)]
if 'group out' in df:
@ -1789,21 +1789,21 @@ class ScatterMatrixXS(MGXS):
filter_bins = []
# Construct a collection of the domain filter bins
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
for subdomain in subdomains:
filters.append(self.domain_type)
filter_bins.append((subdomain,))
# Construct list of energy group bounds tuples for all requested groups
if in_groups != 'all':
if not isinstance(in_groups, basestring):
cv.check_iterable_type('groups', in_groups, Integral)
for group in in_groups:
filters.append('energy')
filter_bins.append((self.energy_groups.get_group_bounds(group),))
# Construct list of energy group bounds tuples for all requested groups
if out_groups != 'all':
if not isinstance(out_groups, basestring):
cv.check_iterable_type('groups', out_groups, Integral)
for group in out_groups:
filters.append('energyout')
@ -1887,7 +1887,7 @@ class ScatterMatrixXS(MGXS):
"""
# Construct a collection of the subdomains to report
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
elif self.domain_type == 'distribcell':
subdomains = np.arange(self.num_subdomains, dtype=np.int)
@ -1926,12 +1926,6 @@ class ScatterMatrixXS(MGXS):
bounds = self.energy_groups.get_group_bounds(group)
string += template.format('', group, bounds[0], bounds[1])
if subdomains == 'all':
if self.domain_type == 'distribcell':
subdomains = np.arange(self.num_subdomains, dtype=np.int)
else:
subdomains = [self.domain.id]
# Loop over all subdomains
for subdomain in subdomains:
@ -2135,14 +2129,14 @@ class Chi(MGXS):
filter_bins = []
# Construct a collection of the domain filter bins
if subdomains != 'all':
if not isinstance(subdomains, basestring):
cv.check_iterable_type('subdomains', subdomains, Integral)
for subdomain in subdomains:
filters.append(self.domain_type)
filter_bins.append((subdomain,))
# Construct list of energy group bounds tuples for all requested groups
if groups != 'all':
if not isinstance(groups, basestring):
cv.check_iterable_type('groups', groups, Integral)
for group in groups:
filters.append('energyout')