A minimal Python package that produces slice plots through h5m DAGMC geometry files
Installation
pip install dagmc_geometry_slice_plotter
Python API Usage
These examples assume you have a h5m file called dagmc.h5m
in the same folder that the Python script is being run from.
Create a plot of a slice through the geometry perpendicular to the Z axis and default settings elsewhere. This will slice through the the center of the geometry as plane_origin has not been specified.
from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry
plot = plot_slice_of_dagmc_geometry(
dagmc_file_or_trimesh_object='dagmc.h5m',
plane_normal=[0, 0, 1],
)
plot.show()
Create a plot of a slice through the geometry perpendicular to the Z axis, offset by 200cm and with default settings elsewhere.
from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry
plot = plot_slice_of_dagmc_geometry(
dagmc_file_or_trimesh_object='dagmc.h5m',
plane_origin=[0, 0, 200],
plane_normal=[0, 0, 1],
)
plot.show()
Create a plot of a slice through the geometry perpendicular to the Y axis, with a rotation of 45 degrees and with default settings elsewhere. Also saves the plot with a high resolution (DPI)
from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry
plot = plot_slice_of_dagmc_geometry(
dagmc_file_or_trimesh_object='dagmc.h5m',
plane_normal=[0, 1, 0],
rotate_plot=45,
)
plot.savefig('my_plot3.png', dpi=600)
Saves a png image of a plot of a slice through the geometry perpendicular to the X axis and with default settings elsewhere.
from dagmc_geometry_slice_plotter import plot_slice_of_dagmc_geometry
plot_slice_of_dagmc_geometry(
dagmc_file_or_trimesh_object='dagmc.h5m',
plane_normal = [1, 0, 0],
rotate_plot=270,
output_filename='my_plot4.png'
)
Related packages
This package is used by the regular_mesh_plotter Python package to combine slice plots with regular mesh tally results and produce images like below.