mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 06:05:58 -04:00
Update filter.py
This commit is contained in:
parent
691173886c
commit
3ab762f617
1 changed files with 2 additions and 3 deletions
|
|
@ -375,7 +375,6 @@ class Filter(object):
|
|||
"""
|
||||
|
||||
if filter_bin not in self.bins:
|
||||
|
||||
msg = 'Unable to get the bin index for Filter since "{0}" ' \
|
||||
'is not one of the bins'.format(filter_bin)
|
||||
raise ValueError(msg)
|
||||
|
|
@ -504,6 +503,7 @@ class WithIDFilter(Filter):
|
|||
|
||||
self._bins = bins
|
||||
|
||||
|
||||
class UniverseFilter(WithIDFilter):
|
||||
"""Bins tally event locations based on the Universe they occured in.
|
||||
|
||||
|
|
@ -1083,7 +1083,7 @@ class RealFilter(Filter):
|
|||
return np.allclose(self.bins, other.bins)
|
||||
|
||||
def get_bin_index(self, filter_bin):
|
||||
i = np.where(abs(self.bins -filter_bin[1]) < 1e-10)[0]
|
||||
i = np.where(i = np.where(self.bins == filter_bin[1])[0]
|
||||
if len(i) == 0:
|
||||
msg = 'Unable to get the bin index for Filter since "{0}" ' \
|
||||
'is not one of the bins'.format(filter_bin)
|
||||
|
|
@ -1126,7 +1126,6 @@ class EnergyFilter(RealFilter):
|
|||
|
||||
def get_bin_index(self, filter_bin):
|
||||
# Use lower energy bound to find index for RealFilters
|
||||
|
||||
deltas = np.abs(self.bins - filter_bin[1]) / filter_bin[1]
|
||||
min_delta = np.min(deltas)
|
||||
if min_delta < 1E-3:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue