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

Don't call normalize inside Tabular.mean #2375

Merged
merged 1 commit into from
Feb 4, 2023

Conversation

paulromano
Copy link
Contributor

Since we've been using the openmc.stats.Tabular class to represent source energy spectra, it may not have an integral of 1; instead the integral corresponds to the source strength. One thing I noticed is that in this case, if you call mean() it will give you the correct value but it will also normalize the distribution, which is unwanted. This PR changes the behavior of the mean() method so that it doesn't mutate the object.

@shimwell
Copy link
Member

shimwell commented Feb 3, 2023

Tagging @Asureda as this change might impact your workflow 👍

Copy link
Contributor

@pshriwise pshriwise left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call @paulromano. A definitely improvement over a sneaky normalization here. Thanks for this update. Will merge at the end of the day if there are no other comments.

@pshriwise pshriwise merged commit 6218bec into openmc-dev:develop Feb 4, 2023
@paulromano paulromano deleted the tabular-mean-fix branch February 7, 2023 03:41
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.

3 participants