A graphical interface for visualizing and navigating OpenMC models.
Originally created by @landonjmitchell at the University of Chicago (original repository).
OpenMC, Matplotlib, NumPy, PySide2
This package is most easily installed by running
pip install openmc-plotter
From a directory containing an OpenMC model run:
$ openmc-plotter -d <path_to_openmc_model_dir>
or simply run
from the directory containing the model.
Once the viewer has opened, press
? to view a variety of keyboard shortcuts.
The plotter also provides the ability to view tallies with spatial filters (mesh filter, cell filter, etc.). After loading a statepoint file from the "Edit" menu, tallies can be displayed on top of the geometry.
Filters, scores, and nuclides on the tally can be enabled/disabled to isolate data.
Cell and material colors can be customized in the color dialog menu. Overlap coloring can be enabled as well to debug problems in the geometry definition.
The plotter can also present the CAD-based tesellation geometry enabled by the Direct Accelerated Geometry Monte Carlo (DAGMC) toolkit. Below is the cross section of a tokamake model generated using paramak:
As well as a DAGMC model of the Advanced Test Reactor (ATR):
Any image displayed in the plotter can be saved in any format supported by the user's Matplotlib installation.
Tally and geometry data (material/cell IDs) can be exported to a VTK file under "File->Export"
File→Quit : Quit the application.
Edit→Apply Changes : Apply any un-applied plot setting changes, and reload plot image.
Edit→Restore Default Settings : Restore to default plot settings and reload plot image.
Edit→Basis→xy : Change plot basis to xy, apply changes, and reload plot.
Edit→Enable Overlap Coloring : Enable/Disable display of geometry overlaps, apply changes, and reload plot.
View→Hide[Show] Dock : Hide/Show Dock.
View→Zoom... : Open dialog to input new zoom value.
Window→Main Window : Activate, bring main window to front.
Mouse Hover : Display plot coordinates in bottom-right of status bar. Display cell/material ID and name (if any) in bottom-left of status bar.
Left Mouse Button Drag : Crop active plot to selection, apply changes, and reload plot image.
Note: To cancel selection, reduce selection size to less than 10 pixels in either dimension and release. Active plot Origin, width, and height values will be returned to current plot settings.
Double-Click Left Mouse Button : Set origin to point clicked, apply changes, and reload plot image.
Shift + Scroll : Increase/Decrease zoom level of plot image.
Right-Click on plot background → activate context menu:
See menu bar for other context menu options. - Right-Click on plot overlap region → activate context menu: - Edit Overlap Color... : Select a new color for overlap regions, apply changes, and reload plot image.
Right-click on plot cell/material : Activate context menu:
See menu bar for other context menu options.
Note: Fields appear dynamically based on whether Masking/Highlighting are enabled or disabled.
Application windows are restored to their previous locations and sizes. If the .xml files match those of the previous sessions, the plot model will be restored to its previous state.
Application status, including window size and location, will be saved. The current state of the plot model, including current plot and up to 10 previous/subsequent plots (i.e. for undo/redo) will be saved. Active plot changes that have not been applied will be lost.
The plot slice image in the central area of the application.
Plot settings that are changed as dock and color dialog fields are changed. Not necessarily reflected in the plot image.
Plot settings currently displayed in the plot image.
Applying changes causes the active plot to become the current plot, and a new plot image to be generated.
Hi, I'm having issues getting openmc-plotter to run. I was getting issues with pyside2, so i removed the environment I was using, and installed everything again. Openmc runs fine, but when I reinstalled openmc-plotter (using PIP), I get this error now.
"qt.qpa.plugin: Could not load the Qt platform plugin "xcb" in "" even though it was found. This application failed to start because no Qt platform plugin could be initialized. Reinstalling the application may fix this problem.
Available platform plugins are: eglfs, linuxfb, minimal, minimalegl, offscreen, vnc, wayland-egl, wayland, wayland-xcomposite-egl, wayland-xcomposite-glx, webgl, xcb."
Any help would be much appreciated, I'm pretty lost.
I've been exploring the landscape for plotting openmc materials, geometry and meshes.
I've got a few ideas about possible developments to the plotter that I wanted to share. and get peoples thoughts on.
:bug::bear: When plotting a just a geometry we currently need to also load up materials. I've started trying to decouple the two with this PR but further PRs are needed if we want to remove this requirement.
:bug::bear: When launching the plotter it loads up local xml files automatically. If we want to plot geometry or materials or meshtally we need openmc install and the openmc binary. For instance the plotter runs openmc in plot mode then loads up the resulting image. But there are other ways of finding the materials and geometry on a grid, using the openmc.Geometry.find() method I've written two functions that monkey patch openmc.Geometry to allow the materials or cells to be found on a grid and this grid becomes and image. These are not c++ based like the openmc plot but as there is no need to load nuclear data or run openmc the time to plot is comparable. Also the for loop could be parallelised if speed becomes an issue.
Regardless of if we make use of the Geometry.find method I think it makes sense to migrate all data extraction functionality to openmc and then call it from the plotter. This will help keep the code in the plotter minimal and avoid duplication with openmc. If we do this then users have the option of using the plotter and the python API to make batch plots. This issue has come up on the forum and I've put in a PR for slicing regular meshes. I think there are 3 data extraction functions we need (cells, materials, mesh tally result). I think there are also some axis manipulation needed as well but that varies across the plotting tools (imshow is different to contour and plotly is different to mpl).
Is this totally going in the wrong direction? Is the :snake: python based find method robust enough to rely on? Is it worth moving code to openmc so that it can be shared with API users?
There are some super useful units built into the plotter
However in some cases it might be handy if the user can specify the units.
My use case is when using an EnergyFunctionFilter the code can't be sure what units the function (with the current lack of units in tallies)
In this case it would be useful if the user can assign units to make use of on the colorbar
This could potentially be part of adding a scaling factor #105 as one could have a scaling factor units as well.
Really liking the plotting capabilities of this package
I think I stubbled across a small bug
When plotting regular mesh tallies that include a EnergyFunctionFilter the displayed result is all zeros.
This would be a useful feature as plotting dose maps could then be performed
Making use of this super plotter and I'm keen to be able to plot RegularMesh results with a custom scaling factor.
I am also keen to be able to plot with the RegularMesh result normalised by the voxel size.
I would be happy to put in a couple of PRs if the request sounds reasonable
Hi,Everyone! There is an error when I use the Openmc-Plotter through Ubuntu & Xming.Here is the error:
File “/home/rookie/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_plotter/plotgui.py”, line 75, in getPlotCoords transform = self.ax.transAxes.inverted() AttributeError: ‘PlotImage’ object has no attribute ‘ax’. Did you mean: ‘x’? Traceback (most recent call last): File “/home/rookie/anaconda3/envs/openmc-env/lib/python3.10/site-packages/openmc_plotter/plotgui.py”, line 220, in mouseMoveEvent xPlotPos, yPlotPos = self.getPlotCoords(event.pos())
If you have some advices, Please text it,Thank You! Best Wishes!
Full Changelog: https://github.com/openmc-dev/plotter/compare/v0.1.1...v0.2.0
First official release of the OpenMC plotting application.
Please see this version's README for the initial set of supported features.
Community-developed Monte Carlo particle transport codeGitHub Repository
openmc particle-transport monte-carlo-simulation visualization geometry