[](https://pypi.org/project/openmc-plotter/)
# OpenMC Plot Explorer
## Description
A graphical interface for visualizing and navigating OpenMC models.
Originally created by @landonjmitchell at the University of Chicago ([original
repository](https://github.com/landonjmitchell/openmc-plotgui)).


## Dependencies
OpenMC, Matplotlib, NumPy, PySide6
## Installation
This package is most easily installed by running
```console
pip install openmc-plotter
```
## Usage
From a directory containing an OpenMC model run:
```console
$ openmc-plotter <path_to_openmc_model_dir>
```
or simply run
```console
$ openmc-plotter
```
from the directory containing the model.
Once the viewer has opened, press `?` to view a variety of keyboard shortcuts.

## Batch Mode
Plot view (`.pltvw`) files generated in interactive sessions (see [Saving and Exporting](#saving-and-exporting))
can be used to generate images from the command line without opening the plotter GUI.
```console
$ openmc-plotter -b view1.pltvw view1.pltvw view1.pltvw
```
## Features
### Tally Visualization
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.
### Color Manipulation
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.

### DAGMC Geometry Visualization
The plotter can also present the CAD-based tesellation geometry enabled by the
[Direct Accelerated Geometry Monte Carlo](https://svalinn.github.io/DAGMC/)
(DAGMC) toolkit. Below is the cross section of a tokamake model generated using [paramak](https://paramak.readthedocs.io/en/main/):

As well as a DAGMC model of the Advanced Test Reactor (ATR):

### Saving and Exporting
- 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"
# Options/Functionality
## Menu Bar:
- File→Save Image As... : Save an image file of the current plot.
- File→Save View Settings... : Save a .pltvw pickle file containing the current plot settings.
- File→Open View Settings... : Open and load a .pltvw pickle file containing a previously saved view.
- File→Quit : Quit the application.
- Edit→Apply Changes : Apply any un-applied plot setting changes, and reload plot image.
- Edit→Undo : Undo last applied plot settings changes, and reload plot image.
- Edit→Redo : Redo last applied plot settings 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→Basis→xz : Change plot basis to xz, apply changes, and reload plot.
- Edit→Basis→yz : Change plot basis to yz, apply changes, and reload plot.
- Edit→Color By→Cell : Change plot settings to be colored by cell, apply changes, and reload plot.
- Edit→Color By→Material : Change plot settings to be colored by material, apply changes, and reload plot.
- Edit→Enable Masking : Enable/Disable masking, apply changes, and reload plot.
- Edit→Enable Highlighting : Enable/Disable highlighting, 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.
- Window→Color Options : [Open], activate, bring color options dialog to front.
## Dock:
### Origin:
- X, Y, Z : Set the active plot origin to the values entered for each dimension.
### Options:
- Width : Set the width of the active plot in plot units.
- Height : Set the height of the active plot in plot units.
- Basis : Set the basis of the active plot.
- Color By : Select how the active plot is colored.
- Color Options... : Open the color options dialog.
### Resolution:
- Fixed Aspect Ratio : Check to prevent plot image stretching/warping.
- Pixel Width: Set width in pixels of active plot.
- Pixel Height : Set height in pixels of active plot.
### Other:
- Apply Changes : Apply changes made to active plot, reload plot image.
- Zoom : Set zoom level of plot image.
## Plot Image
### Actions:
- 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.
- <kbd>Shift</kbd> + Left Mouse Button Drag : De-crop active plot so that the current plot dimensions fit within selected area, 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.
- <kbd>Shift</kbd> + Scroll : Increase/Decrease zoom level of plot image.
- Right-Click on plot background → activate context menu:
- Edit Background Color... : Select a new color for plot background, apply changes, and reload plot image.
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:
- Displays cell/material ID and name (if defined).
- Edit Cell/Material Color... : Select a new color for the selected cell/material, apply changes, and reload plot image.
- Mask Cell/Material : Mask/Unmask selected cell/material, apply changes, and reload plot image.
- Highlight Cell/Material : Highlight/Unhighlight selected cell/material, apply changes, and reload plot image.
See menu bar for other context menu options.
## Color Options Dialog
### General Tab:
- Masking : Enable/Disable masking on active plot.
- Mask Color : Select color of masked components on active plot.
- Highlighting : Enable/Disable highlighting on active plot. Enabling
highlighting will disable custom cell/material color selection.
- Highlight Color : Select overlay color of non-highlighted cells/materials.
- Highlight Alpha : Set alpha transparency level of non-highlighted color overlay.
- Highlight Seed : Select seed for randomized colorization of cells/materials when highlighting is enabled.
- Background Color : Select color of plot background for active plot.
- Show Overlaps : Display overlap regions on the plot.
- Overlap Color : Customize the displayed color of overlap regions.
- Color Plot By : Select how the active plot is to be colored.
### Cells/Materials Tabs:
- Double-click Name field to edit cell/material name. Edited names will not be reflected in .xml files.
- Double-click Color field to select a color for the cell/material in the active plot.
- Double-click SVG/RBG field to enter a new color for the cell/material. May
be entered as SVG color, or RGB value (with or without parentheses).
- Right-click Color or SVG/RGB field to clear. This will reset the color to the default value.
- Click Mask field to mask/unmask cell/material in active plot.
- Click Highlight field to highlight/unhighlight cell/material in active plot.
- Apply Changes : Apply changes made to active plot, reload plot image.
- Close : Close the color options dialog.
**Note: Fields appear dynamically based on whether Masking/Highlighting are enabled or disabled.**
### On Open:
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.
### On Close:
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.
## Developer Notes
### Structure
- openmc-plotter: primary executable. contains the major program logic used to interact with the application.
- plotmodel.py: contains the underlying data structure of the plot model and application state.
- plotgui.py: contains the bulk of the graphical elements of the application.
- overlays.py: contains screen overlays seen in the GUI. Just keyboard shortcuts for now.
- plot_colors.py: module with convenience functions for generating and modifying RGB/RGBA colors
- assets: directory containing icons and images for the application
### Terminology
#### Plot Image
The plot slice image in the central area of the application.
#### Active Plot
Plot settings that are changed as dock and color dialog fields are changed. Not necessarily reflected in the plot image.
#### Current Plot
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.
Raw data
{
"_id": null,
"home_page": "https://github.com/openmc-dev/plotter",
"name": "openmc-plotter",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": "",
"keywords": "",
"author": "OpenMC Development Team",
"author_email": "openmc@anl.gov",
"download_url": "https://files.pythonhosted.org/packages/23/54/6a223dea80b992b90e2afa55b850f4f15680ede26fa4c2914a7c5ea6b14c/openmc-plotter-0.4.0.tar.gz",
"platform": null,
"description": "[](https://pypi.org/project/openmc-plotter/)\n\n# OpenMC Plot Explorer\n\n## Description\n\nA graphical interface for visualizing and navigating OpenMC models.\n\nOriginally created by @landonjmitchell at the University of Chicago ([original\nrepository](https://github.com/landonjmitchell/openmc-plotgui)).\n\n\n\n\n\n## Dependencies\n\nOpenMC, Matplotlib, NumPy, PySide6\n\n## Installation\n\nThis package is most easily installed by running\n\n```console\npip install openmc-plotter\n```\n\n## Usage\n\nFrom a directory containing an OpenMC model run:\n\n```console\n$ openmc-plotter <path_to_openmc_model_dir>\n```\n\nor simply run\n\n```console\n$ openmc-plotter\n```\n\nfrom the directory containing the model.\n\nOnce the viewer has opened, press `?` to view a variety of keyboard shortcuts.\n\n\n\n## Batch Mode\n\nPlot view (`.pltvw`) files generated in interactive sessions (see [Saving and Exporting](#saving-and-exporting))\ncan be used to generate images from the command line without opening the plotter GUI.\n\n```console\n$ openmc-plotter -b view1.pltvw view1.pltvw view1.pltvw\n```\n\n## Features\n\n### Tally Visualization\n\nThe plotter also provides the ability to view tallies with spatial filters (mesh\nfilter, cell filter, etc.). After loading a statepoint file from the \"Edit\"\nmenu, tallies can be displayed on top of the geometry.\n\n\n\nFilters, scores, and nuclides on the tally can be enabled/disabled to isolate data.\n\n### Color Manipulation\n\nCell and material colors can be customized in the color dialog menu. Overlap\ncoloring can be enabled as well to debug problems in the geometry definition.\n\n\n\n### DAGMC Geometry Visualization\n\nThe plotter can also present the CAD-based tesellation geometry enabled by the\n[Direct Accelerated Geometry Monte Carlo](https://svalinn.github.io/DAGMC/)\n(DAGMC) toolkit. Below is the cross section of a tokamake model generated using [paramak](https://paramak.readthedocs.io/en/main/):\n\n\n\nAs well as a DAGMC model of the Advanced Test Reactor (ATR):\n\n\n\n### Saving and Exporting\n\n - Any image displayed in the plotter can be saved in any format supported by the\nuser's Matplotlib installation.\n\n - Tally and geometry data (material/cell IDs) can be exported to a VTK file under \"File->Export\"\n\n# Options/Functionality\n\n## Menu Bar:\n\n - File→Save Image As... : Save an image file of the current plot.\n - File→Save View Settings... : Save a .pltvw pickle file containing the current plot settings.\n - File→Open View Settings... : Open and load a .pltvw pickle file containing a previously saved view.\n - File→Quit : Quit the application.\n\n - Edit→Apply Changes : Apply any un-applied plot setting changes, and reload plot image.\n - Edit→Undo : Undo last applied plot settings changes, and reload plot image.\n - Edit→Redo : Redo last applied plot settings changes, and reload plot image.\n - Edit→Restore Default Settings : Restore to default plot settings and reload plot image.\n\n - Edit→Basis→xy : Change plot basis to xy, apply changes, and reload plot.\n - Edit→Basis→xz : Change plot basis to xz, apply changes, and reload plot.\n - Edit→Basis→yz : Change plot basis to yz, apply changes, and reload plot.\n - Edit→Color By→Cell : Change plot settings to be colored by cell, apply changes, and reload plot.\n - Edit→Color By→Material : Change plot settings to be colored by material, apply changes, and reload plot.\n - Edit→Enable Masking : Enable/Disable masking, apply changes, and reload plot.\n - Edit→Enable Highlighting : Enable/Disable highlighting, apply changes, and reload plot.\n - Edit→Enable Overlap Coloring : Enable/Disable display of geometry overlaps, apply changes, and reload plot.\n\n - View→Hide[Show] Dock : Hide/Show Dock.\n - View→Zoom... : Open dialog to input new zoom value.\n\n - Window→Main Window : Activate, bring main window to front.\n - Window→Color Options : [Open], activate, bring color options dialog to front.\n\n## Dock:\n\n### Origin:\n - X, Y, Z : Set the active plot origin to the values entered for each dimension.\n\n### Options:\n\n - Width : Set the width of the active plot in plot units.\n - Height : Set the height of the active plot in plot units.\n - Basis : Set the basis of the active plot.\n - Color By : Select how the active plot is colored.\n - Color Options... : Open the color options dialog.\n\n### Resolution:\n\n - Fixed Aspect Ratio : Check to prevent plot image stretching/warping.\n - Pixel Width: Set width in pixels of active plot.\n - Pixel Height : Set height in pixels of active plot.\n\n### Other:\n\n - Apply Changes : Apply changes made to active plot, reload plot image.\n - Zoom : Set zoom level of plot image.\n\n## Plot Image\n\n### Actions:\n\n - 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.\n\n - Left Mouse Button Drag : Crop active plot to selection, apply changes, and reload plot image.\n - <kbd>Shift</kbd> + Left Mouse Button Drag : De-crop active plot so that the current plot dimensions fit within selected area, apply changes, and reload plot image.\n - Note: To cancel selection, reduce selection size to less than 10 pixels in\n either dimension and release. Active plot Origin, width, and height values\n will be returned to current plot settings.\n\n - Double-Click Left Mouse Button : Set origin to point clicked, apply changes, and reload plot image.\n - <kbd>Shift</kbd> + Scroll : Increase/Decrease zoom level of plot image.\n\n - Right-Click on plot background → activate context menu:\n - Edit Background Color... : Select a new color for plot background, apply changes, and reload plot image.\n\n See menu bar for other context menu options.\n - Right-Click on plot overlap region → activate context menu:\n - Edit Overlap Color... : Select a new color for overlap regions, apply changes, and reload plot image.\n\n - Right-click on plot cell/material : Activate context menu:\n - Displays cell/material ID and name (if defined).\n - Edit Cell/Material Color... : Select a new color for the selected cell/material, apply changes, and reload plot image.\n - Mask Cell/Material : Mask/Unmask selected cell/material, apply changes, and reload plot image.\n - Highlight Cell/Material : Highlight/Unhighlight selected cell/material, apply changes, and reload plot image.\n\n\n See menu bar for other context menu options.\n\n## Color Options Dialog\n\n### General Tab:\n\n - Masking : Enable/Disable masking on active plot.\n - Mask Color : Select color of masked components on active plot.\n - Highlighting : Enable/Disable highlighting on active plot. Enabling\n highlighting will disable custom cell/material color selection.\n - Highlight Color : Select overlay color of non-highlighted cells/materials.\n - Highlight Alpha : Set alpha transparency level of non-highlighted color overlay.\n - Highlight Seed : Select seed for randomized colorization of cells/materials when highlighting is enabled.\n - Background Color : Select color of plot background for active plot.\n - Show Overlaps : Display overlap regions on the plot.\n - Overlap Color : Customize the displayed color of overlap regions.\n - Color Plot By : Select how the active plot is to be colored.\n\n### Cells/Materials Tabs:\n\n - Double-click Name field to edit cell/material name. Edited names will not be reflected in .xml files.\n - Double-click Color field to select a color for the cell/material in the active plot.\n - Double-click SVG/RBG field to enter a new color for the cell/material. May\n be entered as SVG color, or RGB value (with or without parentheses).\n - Right-click Color or SVG/RGB field to clear. This will reset the color to the default value.\n - Click Mask field to mask/unmask cell/material in active plot.\n - Click Highlight field to highlight/unhighlight cell/material in active plot.\n - Apply Changes : Apply changes made to active plot, reload plot image.\n - Close : Close the color options dialog.\n\n **Note: Fields appear dynamically based on whether Masking/Highlighting are enabled or disabled.**\n\n### On Open:\n\n Application windows are restored to their previous locations and sizes. If\n the .xml files match those of the previous sessions, the plot model will be\n restored to its previous state.\n\n### On Close:\n Application status, including window size and location, will be saved. The\n current state of the plot model, including current plot and up to 10\n previous/subsequent plots (i.e. for undo/redo) will be saved. Active plot\n changes that have not been applied will be lost.\n\n## Developer Notes\n\n### Structure\n\n - openmc-plotter: primary executable. contains the major program logic used to interact with the application.\n - plotmodel.py: contains the underlying data structure of the plot model and application state.\n - plotgui.py: contains the bulk of the graphical elements of the application.\n - overlays.py: contains screen overlays seen in the GUI. Just keyboard shortcuts for now.\n - plot_colors.py: module with convenience functions for generating and modifying RGB/RGBA colors\n - assets: directory containing icons and images for the application\n\n### Terminology\n\n#### Plot Image\n The plot slice image in the central area of the application.\n\n#### Active Plot\n Plot settings that are changed as dock and color dialog fields are changed. Not necessarily reflected in the plot image.\n\n#### Current Plot\n Plot settings currently displayed in the plot image.\n\nApplying changes causes the active plot to become the current plot, and a new plot image to be generated.\n",
"bugtrack_url": null,
"license": "",
"summary": "Plotting tool for OpenMC models and tally data",
"version": "0.4.0",
"project_urls": {
"Download": "https://github.com/openmc-dev/plotter",
"Homepage": "https://github.com/openmc-dev/plotter",
"Issue Tracker": "https://github.com/openmc-dev/plotter/issues",
"Source Code": "https://github.com/openmc-dev/plotter"
},
"split_keywords": [],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "6eafa18e0d4f3cfb2b5ec94276cbce8cacbc50e9c2f68d2a47df2d71a8e10c5a",
"md5": "32f1f817919c7edd026d9fdcef762107",
"sha256": "2024fde516daf0908094e20c7d79c47b901474f89d0216d225837b61e1e9a7da"
},
"downloads": -1,
"filename": "openmc_plotter-0.4.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "32f1f817919c7edd026d9fdcef762107",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 93231,
"upload_time": "2024-01-31T16:50:56",
"upload_time_iso_8601": "2024-01-31T16:50:56.859463Z",
"url": "https://files.pythonhosted.org/packages/6e/af/a18e0d4f3cfb2b5ec94276cbce8cacbc50e9c2f68d2a47df2d71a8e10c5a/openmc_plotter-0.4.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "23546a223dea80b992b90e2afa55b850f4f15680ede26fa4c2914a7c5ea6b14c",
"md5": "e2981df32a0e7fbf4cd9a04decb8c149",
"sha256": "ebe38764e4b6c973765162e8d6f0f036764b5231beb21e084e77888392cfe4ee"
},
"downloads": -1,
"filename": "openmc-plotter-0.4.0.tar.gz",
"has_sig": false,
"md5_digest": "e2981df32a0e7fbf4cd9a04decb8c149",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 95499,
"upload_time": "2024-01-31T16:50:58",
"upload_time_iso_8601": "2024-01-31T16:50:58.594132Z",
"url": "https://files.pythonhosted.org/packages/23/54/6a223dea80b992b90e2afa55b850f4f15680ede26fa4c2914a7c5ea6b14c/openmc-plotter-0.4.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-01-31 16:50:58",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "openmc-dev",
"github_project": "plotter",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "openmc-plotter"
}