A Python package for creating publication quality plots of regular mesh tallies with the underlying geometry
Project description
A minimal Python package that plots 2D mesh tally results with the underlying DAGMC geometry
Installation
pip install regular_mesh_plotter
Mesh results in the form of Numpy arrays or OpenMC.tally objects can be plotted with a single API call.
A Matplotlib.pyplot object is returned by all functions so one can make changes to the legend, axis, colour map etc. However some key options are accessible in the function call directly.
There are additional options that allow
- rotation of the mesh tally results
- rotation of the DAGMC geometry slice
- saving the plot as an image file
- specifying contour lines TODO
- changing axis and colour bar labels
- changing colour scale applied
- truncation of values
- The plane_normal of the DAGMC geometry
The resulting plots can be used to show dose maps, activation, reaction rate and other mesh tally results.
Example 1 shows a Numpy array plotted
plot_regular_mesh_values(
values: np.ndarray,
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
base_plt=None,
extent=None,
x_label="X [cm]",
y_label="Y [cm]",
rotate_plot: float = 0,
)
Example 2 shows a Numpy array plotted with an underlying DAGMC geometry
plot_regular_mesh_values_with_geometry(
values: np.ndarray,
dagmc_file_or_trimesh_object,
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
extent=None,
x_label="X [cm]",
y_label="Y [cm]",
plane_origin: List[float] = None,
plane_normal: List[float] = [0, 0, 1],
rotate_mesh: float = 0,
rotate_geometry: float = 0,
)
Example 3 shows a OpenMC tally plotted
plot_regular_mesh_tally(
tally,
dagmc_file_or_trimesh_object,
std_dev_or_tally_value="tally_value",
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
x_label="X [cm]",
y_label="Y [cm]",
plane_origin: List[float] = None,
plane_normal: List[float] = [0, 0, 1],
rotate_mesh: float = 0,
rotate_geometry: float = 0,
required_units=None,
source_strength: float = None,
)
Example 4 shows a OpenMC tally plotted with an underlying DAGMC geometry
plot_regular_mesh_tally_with_geometry(
tally,
dagmc_file_or_trimesh_object,
std_dev_or_tally_value="tally_value",
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
x_label="X [cm]",
y_label="Y [cm]",
plane_origin: List[float] = None,
plane_normal: List[float] = [0, 0, 1],
rotate_mesh: float = 0,
rotate_geometry: float = 0,
required_units=None,
source_strength: float = None,
)
Example 5 shows how to rotate the underlying DAGMC geometry and mesh tally. This is sometimes necessary as the slice and mesh can get out of alignment when changing the plane normal
plot_regular_mesh_tally_with_geometry(
tally,
dagmc_file_or_trimesh_object,
std_dev_or_tally_value="tally_value",
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
x_label="X [cm]",
y_label="Y [cm]",
plane_origin: List[float] = None,
plane_normal: List[float] = [0, 0, 1],
rotate_mesh: float = 0,
rotate_geometry: float = 0,
required_units=None,
source_strength: float = None,
)
Example 6 shows how to plot a dose tally with the underlying DAGMC geometry. This also includes unit conversion from the base tally units to the requested units.
plot_regular_mesh_dose_tally_with_geometry(
tally,
dagmc_file_or_trimesh_object,
filename: Optional[str] = None,
scale=None, # LogNorm(),
vmin=None,
label="",
x_label="X [cm]",
y_label="Y [cm]",
plane_origin: List[float] = None,
plane_normal: List[float] = [0, 0, 1],
rotate_mesh: float = 0,
rotate_geometry: float = 0,
required_units="picosievert cm **2 / simulated_particle",
source_strength: float = None,
std_dev_or_tally_value: str = "tally_value",
):
Additional examples can be found in the examples folder in the GitHub repository
Related packages
If you want to plot the DAGMC geometry without a mesh tally then take a look at the dagmc_geometry_slice_plotter package
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Hashes for regular_mesh_plotter-0.2.0.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ff3dd9b862aad79a16fab212cf031d4f36f342d9b234f0e3076577204646d96e |
|
MD5 | f4557793821aec7ad9f158f55d2861e9 |
|
BLAKE2b-256 | 6a41643c1465ebbeabb6c824db9fbf02177ad55a5498c7ad24af89da0bb4c3da |
Hashes for regular_mesh_plotter-0.2.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7aa01cb21db6b5b46136c5be28ef490e931f2306013bd8a8eae68ae1de8987ef |
|
MD5 | a817ba3f150dec9b7d8359537ea3089c |
|
BLAKE2b-256 | 7c3977044b7abd5bbcd8f3f0128f32fff3abfc84d2ac9f0e4c8ed7cc84958cfb |