Optimize depletion chain loading and material activity calculations#4025
Open
paulromano wants to merge 3 commits into
Open
Optimize depletion chain loading and material activity calculations#4025paulromano wants to merge 3 commits into
paulromano wants to merge 3 commits into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
I recently found while profiling a script that analyzed activated material compositions from an R2S calculation that substantial time was being spent repeatedly resolving depletion-chain paths and parsing decay source distributions. This PR fixes this by loading the depletion chain once per
Material.get_activity()call, utilizingPath.absolute()instead ofPath.resolve(), and simplifying how the chain cache works. It also accelerates chain XML loading by parsing distribution data directly into NumPy arrays, which enables a fast-path when doing type checks.One other issue I identified along the way: some ENDF decay evaluations indicate an emitted radiation type but provide no corresponding discrete energies or continuous spectrum. These metadata-only records previously produced zero-length distributions and empty
<parameters>elements in generated depletion chains. They are now omitted as sources, while existing chain files containing these empty elements remain readable.Checklist
I have run clang-format (version 18) on any C++ source files (if applicable)