Skip to content

Conversation

@pshriwise
Copy link
Contributor

Description

Implements CAPI functions for the SolidRayTracePlot C++ class and a openmc.lib.SolidRayTracePlot class. With the refactor in #3776 adding create_image, the plot output can now be accessed via the Python interface in openmc.lib, making inline visualization of these images more straightforward.

image

It also allows for easier connection to other apps for interactive rendering (i.e. the plotter utility)

Screencast.from.2026-02-03.09-54-50.webm

I added a few tests in test_lib.py to ensure that we can create a SolidRayTracePlot object, produce outputs, modify the object parameters, and produce an updated image.

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)

Copy link
Contributor

@nuclearkevin nuclearkevin left a comment

Choose a reason for hiding this comment

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

This is awesome! Do you think it would be worthwhile to add a quick tutorial in the User's Guide (under geometry visualization) to showcase how these plots can be created with the Python lib bindings? I can see people wanting to use this more often now that they don't need to run OpenMC in plotting mode to generate ray traced plots.

Comment on lines +2084 to +2085
new_plot->pixels()[0] = 400;
new_plot->pixels()[1] = 400;
Copy link
Contributor

Choose a reason for hiding this comment

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

Better extract these magic numbers into a global module variable.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Mmm yeah these slipped through the cracks. They should probably be defined independently on the object tbh. I'll take a look.

Co-authored-by: GuySten <62616591+GuySten@users.noreply.github.com>
@pshriwise
Copy link
Contributor Author

This is awesome! Do you think it would be worthwhile to add a quick tutorial in the User's Guide (under geometry visualization) to showcase how these plots can be created with the Python lib bindings? I can see people wanting to use this more often now that they don't need to run OpenMC in plotting mode to generate ray traced plots.

Yeah I think that would be a good idea. Probably the best place for it would be in our example notebooks, no?

Copy link
Contributor

@nuclearkevin nuclearkevin left a comment

Choose a reason for hiding this comment

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

Yeah I think that would be a good idea. Probably the best place for it would be in our example notebooks, no?

Agreed, definitely a better place for it then the User's Guide.

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