- class openmc.Plots(plots=None)¶
Collection of Plots used for an OpenMC simulation.
This class corresponds directly to the plots.xml input file. It can be thought of as a normal Python list where each member is a
Plot. It behaves like a list as the following example demonstrates:
>>> xz_plot = openmc.Plot() >>> big_plot = openmc.Plot() >>> small_plot = openmc.Plot() >>> p = openmc.Plots((xz_plot, big_plot)) >>> p.append(small_plot) >>> small_plot = p.pop()
plots (Iterable of openmc.Plot) – Plots to add to the collection
- colorize(geometry, seed=1)¶
Generate a consistent color scheme for each domain in each plot.
This routine may be used to generate random, reproducible color schemes. The colors generated are based upon cell/material IDs in the geometry. The color schemes will be consistent for all plots in “plots.xml”.
geometry (openmc.Geometry) – The geometry for which the plots are defined
seed (Integral) – The random number seed used to generate the color scheme
Export plot specifications to an XML file.
path (str) – Path to file to write. Defaults to ‘plots.xml’.
- classmethod from_xml(path='plots.xml')¶
Generate plots collection from XML file
- highlight_domains(geometry, domains, seed=1, alpha=0.5, background='gray')¶
Use alpha compositing to highlight one or more domains in the plot.
This routine generates a color scheme and applies alpha compositing to make all domains except the highlighted ones appear partially transparent.
geometry (openmc.Geometry) – The geometry for which the plot is defined
domains (Iterable of openmc.Cell or openmc.Material) – A collection of the domain IDs to highlight in the plot
seed (int) – The random number seed used to generate the color scheme
alpha (float) – The value between 0 and 1 to apply in alpha compisiting
background (3-tuple of int or str) – The background color to apply in alpha compisiting