Skip to content

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

Merged
shimwell merged 2 commits into
openmc-dev:developfrom
paulromano:bbox-warning-fix
Sep 14, 2023
Merged

shimwell merged 2 commits into
openmc-dev:developfrom
paulromano:bbox-warning-fix

Conversation

@paulromano

Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

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

@shimwell shimwell left a comment •

Copy link
Copy Markdown
Member

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
apingegno pushed a commit to apingegno/openmc that referenced this pull request May 7, 2026
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