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

Avoid warning due to bounding box calculation in Universe.plot #2681

Merged
merged 2 commits into from
Sep 14, 2023

Conversation

paulromano
Copy link
Contributor

Description

Some of you may have noticed that running universe.plot() produces a warning message about an invalid value (for an example, see the screenshot in #2648). This is due to a bounding box calculation where the bounding box has some infinity values in it (that result in a nan value in the center property). This PR simply silences the warning since the invalid values are being handled appropriately.

Checklist

  • I have performed a self-review of my own code
  • I have run clang-format on any C++ source files (if applicable)
  • I have followed the style guidelines for Python source files (if applicable)
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works (if applicable)

@paulromano paulromano requested a review from shimwell September 13, 2023 17:17
@shimwell
Copy link
Member

This will be nice for people who get worried about that warning message.

I notice the docstring for Origin includes "Defaults to (0, 0, 0) if the bounding_box contains inf values" but perhaps this should be changed to something like. "inf values in the bounding_box.center get replaced with 0"

@paulromano
Copy link
Contributor Author

@shimwell Good suggestion -- I've just updated that.

Copy link
Member

@shimwell shimwell left a comment

Choose a reason for hiding this comment

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

Thanks Paul, this review makes sense. I've run the warning raising code locally before and after the PR to check. All looks good to me, thanks for the additional doc string fix.

auto squash merged enabled ✔️

@shimwell shimwell enabled auto-merge (squash) September 13, 2023 22:25
@shimwell shimwell merged commit 7b0eb9d into openmc-dev:develop Sep 14, 2023
@paulromano paulromano deleted the bbox-warning-fix branch September 14, 2023 11:57
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