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

Conversation

pshriwise
Copy link
Contributor

Introducing a change when providing all indices of a filter's bins in Tally.get_filter_indices for cases where the filter is not specified. Right now as the method collects bin indices for each filter on the Tally object, the method calls Filter.get_bin_index for every filter bin regardless of whether or not specific bins were specified on the filter in the function call in the filters argument.

The method should safely (and more quickly) be able to use a set of indices generated by np.arange(len(bins)) for filters not specified in the filters argument. As I understand it, this array is what would be produced were we to perform the Filter.get_bin_index calls sequentially anyway since we want the full set of bins.

The downside here is that this approach bypasses some checking that occurs in each Filter's get_bin_index method. Looking at our current set of filters, it shouldn't be a problem, but there's a chance it might bite us in the future. Based on the patterns present for the EnergyFunctionFilter, however, I think the filter will be different enough that it will be clear what unique treatment is needed.

openmc/tallies.py Outdated Show resolved Hide resolved
@paulromano paulromano merged commit c9bbcda into openmc-dev:develop Feb 17, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants