openmc.ProjectionPlot

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

Definition of a camera’s view of OpenMC geometry

Colors are defined in the same manner as the Plot class, but with the addition of a coloring parameter resembling a macroscopic cross section in units of inverse centimeters. The volume rendering technique is used to color regions of the model. An infinite cross section denotes a fully opaque region, and zero represents a transparent region which will expose the color of the regions behind it.

The camera projection may either by orthographic or perspective. Perspective projections are more similar to a pinhole camera, and orthographic projections preserve parallel lines and distances.

New in version 0.14.0.

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

  • name (str) – Name of the plot

Variables
  • horizontal_field_of_view (float) – Field of view horizontally, in units of degrees, defaults to 70.

  • camera_position (tuple or list of ndarray) – Position of the camera in 3D space. Defaults to (1, 0, 0).

  • look_at (tuple or list of ndarray) – The center of the camera’s image points to this place in 3D space. Set to (0, 0, 0) by default.

  • up (tuple or list of ndarray) – Which way is up for the camera. Must not be parallel to the line between look_at and camera_position. Set to (0, 0, 1) by default.

  • orthographic_width (float) – If set to a nonzero value, an orthographic projection is used. All rays traced from the orthographic pixel array travel in the same direction. The width of the starting array must be specified, unlike with the default perspective projection. The height of the array is deduced from the ratio of pixel dimensions for the image. Defaults to zero, i.e. using perspective projection.

  • wireframe_thickness (int) – Line thickness employed for drawing wireframes around cells or material regions. Can be set to zero for no wireframes at all. Defaults to one pixel.

  • wireframe_color (tuple of ints) – RGB color of the wireframe lines. Defaults to black.

  • wireframe_domains (iterable of either Material or Cells) – If provided, the wireframe is only drawn around these. If color_by is by material, it must be a list of materials, else cells.

  • xs (dict) – A mapping from cell/material IDs to floats. The floating point values are macroscopic cross sections influencing the volume rendering opacity of each geometric region. Zero corresponds to perfect transparency, and infinity equivalent to opaque. These must be set by the user, but default values can be obtained using the set_transparent method.

classmethod from_xml_element(elem)[source]

Generate plot object from an XML element

Parameters

elem (lxml.etree._Element) – XML element

Returns

ProjectionPlot object

Return type

openmc.ProjectionPlot

set_transparent(geometry)[source]

Sets all volume rendering XS to zero for the model

Parameters

geometry (openmc.Geometry) – The geometry for which the plot is defined

to_xml_element()[source]

Return XML representation of the projection plot

Returns

element – XML element containing plot data

Return type

lxml.etree._Element