openmc.VoxelPlot

class openmc.VoxelPlot(plot_id=None, name='')[source]

Definition of a 3D voxel plot of the geometry.

Colors that are used in plots can be given as RGB tuples, e.g. (255, 255, 255) would be white, or by a string indicating a valid SVG color.

Added in version 0.15.1.

Parameters:
  • plot_id (int) – Unique identifier for the plot

  • name (str) – Name of the plot

Variables:
  • id (int) – Unique identifier

  • name (str) – Name of the plot

  • pixels (Iterable of int) – Number of pixels to use in each direction (3 values)

  • filename (str) – Path to write the plot to

  • color_by ({'cell', 'material'}) – Indicate whether the plot should be colored by cell or by material

  • background (Iterable of int or str) – Color of the background

  • mask_components (Iterable of openmc.Cell or openmc.Material or int) – The cells or materials (or corresponding IDs) to mask

  • mask_background (Iterable of int or str) – Color to apply to all cells/materials listed in mask_components

  • show_overlaps (bool) – Indicate whether or not overlapping regions are shown

  • overlap_color (Iterable of int or str) – Color to apply to overlapping regions

  • colors (dict) – Dictionary indicating that certain cells/materials should be displayed with a particular color. The keys can be of type Cell, Material, or int (ID for a cell/material).

  • level (int) – Universe depth to plot at

  • width (Iterable of float) – Width of the plot in each dimension (3 values)

  • origin (tuple or list of ndarray) – Origin (center) of the plot (3 values)

classmethod from_xml_element(elem)[source]

Generate plot object from an XML element

Parameters:

elem (lxml.etree._Element) – XML element

Returns:

VoxelPlot object

Return type:

openmc.VoxelPlot

to_vtk(output: str | PathLike | None = None, openmc_exec: str = 'openmc', cwd: str = '.')[source]

Render plot as a voxel image

This method runs OpenMC in plotting mode to produce a .vti file.

Added in version 0.14.0.

Parameters:
  • output (path-like) – Path of the output .vti file produced

  • openmc_exec (str) – Path to OpenMC executable

  • cwd (str, optional) – Path to working directory to run in

Returns:

Path of the .vti file produced

Return type:

Path

to_xml_element()[source]

Return XML representation of the voxel plot

Returns:

element – XML element containing plot data

Return type:

lxml.etree._Element