Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Return all bin indices for filters not specified in Tally.get_filter_indices #1969

Merged
merged 3 commits into from
Feb 17, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions openmc/tallies.py
Original file line number Diff line number Diff line change
Expand Up @@ -1094,23 +1094,11 @@ def get_filter_indices(self, filters=[], filter_bins=[]):
for j, test_filter in enumerate(filters):
if type(self_filter) is test_filter:
bins = filter_bins[j]
indices = np.array([self_filter.get_bin_index(b) for b in bins])
break
else:
# If not a user-requested Filter, get all bins
if isinstance(self_filter, openmc.DistribcellFilter):
# Create list of cell instance IDs for distribcell Filters
bins = list(range(self_filter.num_bins))
indices = np.arange(self_filter.num_bins)

elif isinstance(self_filter, openmc.EnergyFunctionFilter):
# EnergyFunctionFilters don't have bins so just add a None
bins = [None]

else:
# Create list of IDs for bins for all other filter types
bins = self_filter.bins

# Add indices for each bin in this Filter to the list
indices = np.array([self_filter.get_bin_index(b) for b in bins])
filter_indices.append(indices)

# Account for stride in each of the previous filters
Expand Down