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

Generate Region Plots Directly #2895

Merged
merged 5 commits into from
Apr 12, 2024
Merged

Conversation

pshriwise
Copy link
Contributor

Description

A continuation of #2648, these changes allow regions to be plotted directly without need for a cell definition. A simple region can now be plotted with the following:

import openmc
from matplotlib import pyplot as plt

sphere = openmc.Sphere()
x_plant = openmc.XPlane()
hemisphere = -sphere & +x_plane
hemisphere.plot()
plt.show()

hemisphere

There was a little more nuance here as the color_by, color, legend, and legend_kwargs arguments no longer have meaning at this level of geometry definition, so I've addressed those as best I could for now.

Other

Also cleaned up the openmc.Cell.plot docstring a bit.

Checklist

  • I have performed a self-review of my own code
    - [ ] I have run clang-format (version 15) 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)

@shimwell
Copy link
Member

shimwell commented Mar 6, 2024

Nice PR. We might be able to plot everything thing soon 🚀
Region - this PR
Cell - done
Geometry - done
Universe - done
Model - PR #2863

Copy link
Contributor

@paulromano paulromano left a comment

Choose a reason for hiding this comment

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

Thanks!

@paulromano paulromano enabled auto-merge (squash) April 11, 2024 13:28
@shimwell
Copy link
Member

shimwell commented Apr 11, 2024

Looks like that extra assert in the testing picked up an error in the latest CI run.

 >       assert c_after.id + 1 == c_before.id
E       assert (2 + 1) == 1

@paulromano paulromano merged commit 4ba053c into openmc-dev:develop Apr 12, 2024
17 checks passed
church89 pushed a commit to openmsr/openmc that referenced this pull request Jul 18, 2024
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