Skip to content

Commit eebba75

Browse files
authored
Merge pull request #44 from fusion-energy/develop
Develop refactor
2 parents d5208e1 + 95f2f4d commit eebba75

21 files changed

+297
-1154
lines changed

README.md

Lines changed: 17 additions & 105 deletions
Original file line numberDiff line numberDiff line change
@@ -6,122 +6,34 @@
66

77
[![codecov](https://codecov.io/gh/fusion-energy/regular_mesh_plotter/branch/main/graph/badge.svg)](https://codecov.io/gh/fusion-energy/regular_mesh_plotter)
88

9-
## A minimal Python package that plots 2D mesh tally results with the underlying DAGMC geometry
9+
## A minimal Python package that extracts 2D mesh tally results for plotting convenience.
1010

11-
# Installation
11+
This package is deployed on [xsplot.com](https://www.xsplot.com) as part of the ```openmc_plot``` suite of plotting apps
1212

13-
```bash
14-
pip install regular_mesh_plotter
15-
```
16-
17-
Mesh results in the form of at OpenMC.tally objects can be plotted with a single API call.
18-
19-
A Matplotlib.pyplot object is returned by all functions so one can make changes
20-
to the legend, axis, colour map etc. However some key options are accessible
21-
in the function call directly.
22-
23-
There are additional options that allow
24-
25-
- rotation of the mesh tally results
26-
- rotation of the DAGMC geometry slice
27-
- saving the plot as an image file
28-
- specifying contour lines TODO
29-
- changing axis and colour bar labels
30-
- changing colour scale applied
31-
- truncation of values
32-
- The plane_normal of the DAGMC geometry
33-
34-
The resulting plots can be used to show dose maps, activation, reaction rate
35-
and other mesh tally results.
36-
37-
The examples below require a mesh tally that can be read in with OpenMC in the following way.
38-
39-
```python
40-
import openmc
41-
42-
# loads in the statepoint file containing tallies
43-
statepoint = openmc.StatePoint(filepath="statepoint.2.h5")
13+
# Local install
4414

45-
# gets one tally from the available tallies
46-
my_tally = statepoint.get_tally(name="neutron_effective_dose_on_2D_mesh_xy")
47-
```
48-
49-
Example 1 shows a OpenMC tally plotted
50-
```python
51-
52-
import regular_mesh_plotter as rmp
53-
import matplotlib.pyplot as plt
15+
First you will need openmc installed, then you can install this package with pip
5416

55-
rmp.plot_regular_mesh_tally(
56-
tally=my_tally,
57-
std_dev_or_tally_value="tally_value",
58-
x_label="X [cm]",
59-
y_label="Y [cm]",
60-
)
61-
62-
plt.savefig('openmc_mesh_tally_plot.png')
17+
```bash
18+
pip install regular_mesh_plotter
6319
```
20+
# Usage
6421

65-
Example 4 shows a OpenMC tally plotted with an underlying DAGMC geometry
66-
```python
67-
plot_regular_mesh_tally_with_geometry(
68-
tally=my_tally,
69-
dagmc_file_or_trimesh_object='dagmc.h5m',
70-
std_dev_or_tally_value="tally_value",
71-
x_label="X [cm]",
72-
y_label="Y [cm]",
73-
)
74-
```
22+
The package can be used from within your own python script to make plots or via a GUI that is also bundled into the package install.
7523

76-
Example 5 shows how to rotate the underlying DAGMC geometry and mesh tally.
77-
This is sometimes necessary as the slice and mesh can get out of alignment
78-
when changing the plane normal
79-
```python
80-
plot_regular_mesh_tally_with_geometry(
81-
tally,
82-
dagmc_file_or_trimesh_object,
83-
std_dev_or_tally_value="tally_value",
84-
filename: Optional[str] = None,
85-
scale=None, # LogNorm(),
86-
vmin=None,
87-
label="",
88-
x_label="X [cm]",
89-
y_label="Y [cm]",
90-
plane_origin: List[float] = None,
91-
plane_normal: List[float] = [0, 0, 1],
92-
rotate_mesh: float = 0,
93-
rotate_geometry: float = 0,
94-
required_units=None,
95-
source_strength: float = None,
96-
)
97-
```
24+
## Python API script usage
9825

99-
Example 6 shows how to plot a dose tally with the underlying DAGMC geometry.
100-
This also includes unit conversion from the base tally units to the requested
101-
units.
102-
```python
103-
plot_regular_mesh_dose_tally_with_geometry(
104-
tally,
105-
dagmc_file_or_trimesh_object,
106-
filename: Optional[str] = None,
107-
scale=None, # LogNorm(),
108-
vmin=None,
109-
label="",
110-
x_label="X [cm]",
111-
y_label="Y [cm]",
112-
plane_origin: List[float] = None,
113-
plane_normal: List[float] = [0, 0, 1],
114-
rotate_mesh: float = 0,
115-
rotate_geometry: float = 0,
116-
required_units="picosievert / source_particle",
117-
source_strength: float = None,
118-
std_dev_or_tally_value: str = "tally_value",
119-
):
120-
```
26+
See the [examples folder](https://github.com/fusion-energy/regular_mesh_plotter/tree/master/examples) for example scripts
12127

122-
Additional examples can be found in the [examples folder in the GitHub repository](https://github.com/fusion-energy/regular_mesh_plotter/tree/main/examples)
28+
## Graphical User Interface (GUI) usage
12329

30+
After installing run ```openmc_mesh_plotter``` command from the terminal and the GUI should launch in a new browser window.
12431
# Related packages
12532

33+
[openmc_plot](https://github.com/fusion-energy/openmc_plot)A single package that includes all the various plotters.
34+
12635
If you want to plot the DAGMC geometry without a mesh tally then take a look at
12736
the [dagmc_geometry_slice_plotter](https://github.com/fusion-energy/dagmc_geometry_slice_plotter) package
37+
38+
If you want to plot the Native CSG geometry without a mesh tally then take a look at
39+
the [dagmc_geometry_slice_plotter](https://github.com/fusion-energy/openmc_geometry_plot) package

examples/create_statepoint_file_with_meshes_openmc.py

Lines changed: 0 additions & 93 deletions
This file was deleted.

examples/create_statepoint_file_with_meshes_openmc_dagmc.py

Lines changed: 0 additions & 107 deletions
This file was deleted.

0 commit comments

Comments
 (0)