armi.utils.plotting module¶
- armi.utils.plotting.colorGenerator(skippedColors=10)[source]¶
Selects a color from the matplotlib css color database.
- Parameters
skippedColors (int) – Number of colors to skip in the matplotlib CSS color database when generating the next color. Without skipping colors the next color may be similar to the previous color.
Notes
Will cycle indefinitely to accommodate large cores. Colors will repeat.
- armi.utils.plotting.plotBlockDepthMap(core, param='pdens', fName=None, bare=False, cmapName='jet', labels=(), labelFmt='{0:.3f}', legendMap=None, fontSize=None, minScale=None, maxScale=None, axisEqual=False, makeColorBar=False, cBarLabel='', title='', shuffleArrows=False, titleSize=25, depthIndex=0)[source]¶
Plot a param distribution in xy space with the ability to page through depth.
Notes
This is useful for visualizing the spatial distribution of a param through the core. Blocks could possibly not be in alignment between assemblies, but the depths viewable are based on the first fuel assembly.
- Parameters
plotFaceMap. (The kwarg definitions are the same as those of) –
depthIndex (int) – The the index of the elevation to show block params. The index is determined by the index of the blocks in the first fuel assembly.
- armi.utils.plotting.plotFaceMap(core, param='pdens', vals='peak', data=None, fName=None, bare=False, cmapName='jet', labels=(), labelFmt='{0:.3f}', legendMap=None, fontSize=None, minScale=None, maxScale=None, axisEqual=False, makeColorBar=False, cBarLabel='', title='', shuffleArrows=False, titleSize=25, referencesToKeep=None)[source]¶
Plot a face map of the core.
- Parameters
core (Core) – The core to plot.
param (str, optional) – The block-parameter to plot. Default: pdens
vals (str, optional) – Can be ‘peak’, ‘average’, or ‘sum’. The type of vals to produce. Will find peak, average, or sum of block values in an assembly. Default: peak
data (list, optional) – rather than using param and vals, use the data supplied as is. It must be in the same order as iter(r).
fName (str, optional) – File name to create. If none, will show on screen.
bare (bool, optional) – If True, will skip axis labels, etc.
cmapName (str) – The name of the matplotlib colormap to use. Default: jet Other possibilities: http://matplotlib.org/examples/pylab_examples/show_colormaps.html
labels (list of str, optional) – Data labels corresponding to data values.
labelFmt (str, optional) – A format string that determines how the data is printed if
labels
is not provided. E.g."{:.1e}"
fontSize (int, optional) – Font size in points
minScale (float, optional) – The minimum value for the low color on your colormap (to set scale yourself) Default: autoscale
maxScale (float, optional) – The maximum value for the high color on your colormap (to set scale yourself) Default: autoscale
axisEqual (Boolean, optional) –
If True, horizontal and vertical axes are scaled equally such that a circle appears as a circle rather than an ellipse.
If False, this scaling constraint is not imposed.
makeColorBar (Boolean, optional) –
If True, a vertical color bar is added on the right-hand side of the plot.
If False, no color bar is added.
cBarLabel (String, optional) – If True, this string is the color bar quantity label. If False, the color bar will have no label. When makeColorBar=False, cBarLabel affects nothing.
title (String, optional) – If True, the string is added as the plot title. If False, no plot title is added.
shuffleArrows (list, optional) – Adds arrows indicating fuel shuffling maneuvers
plotPartsToUpdate (list, optional) – Send references to the parts of the plot such as patches, collections and texts to be changed by another plot utility.
Examples
Plotting a BOL assembly type facemap with a legend:
>>> plotFaceMap(core, param='typeNumAssem', cmapName='RdYlBu')
- armi.utils.plotting.close(fig=None)[source]¶
Wrapper for matplotlib close.
This is useful to avoid needing to import plotting and matplotlib. The plot functions cannot always close their figure if it is going to be used somewhere else after becoming active (e.g. in reports or gallery examples).
- class armi.utils.plotting.DepthSlider(ax, sliderLabel, depths, updateFunc, selectedDepthColor, fontsize=8, valInit=0, **kwargs)[source]¶
Bases:
matplotlib.widgets.Slider
Page slider used to view params at different depths.
- Parameters
ax (Axes) – The Axes to put the slider in.
label (str) – Slider label.
valmin (float) – The minimum value of the slider.
valmax (float) – The maximum value of the slider.
valinit (float, default: 0.5) – The slider initial position.
valfmt (str, default: None) – %-format string used to format the slider value. If None, a .ScalarFormatter is used instead.
closedmin (bool, default: True) – Whether the slider interval is closed on the bottom.
closedmax (bool, default: True) – Whether the slider interval is closed on the top.
slidermin (Slider, default: None) – Do not allow the current slider to have a value less than the value of the Slider slidermin.
slidermax (Slider, default: None) – Do not allow the current slider to have a value greater than the value of the Slider slidermax.
dragging (bool, default: True) – If True the slider can be dragged by the mouse.
valstep (float or array-like, default: None) – If a float, the slider will snap to multiples of valstep. If an array the slider will snap to the values in the array.
orientation ({'horizontal', 'vertical'}, default: 'horizontal') – The orientation of the slider.
initcolor (color, default: 'r') – The color of the line at the valinit position. Set to
'none'
for no line.track_color (color, default: 'lightgrey') – The color of the background track. The track is accessible for further styling via the track attribute.
handle_style (dict) –
Properties of the slider handle. Default values are
Key
Value
Default
Description
facecolor
color
’white’
The facecolor of the slider handle.
edgecolor
color
’.75’
The edgecolor of the slider handle.
size
int
10
The size of the slider handle in points.
Other values will be transformed as marker{foo} and passed to the ~.Line2D constructor. e.g.
handle_style = {'style'='x'}
will result inmarkerstyle = 'x'
.
Notes
Additional kwargs are passed on to
self.poly
which is the ~matplotlib.patches.Polygon that draws the slider knob. See the .Polygon documentation for valid property names (facecolor
,edgecolor
,alpha
, etc.).
- armi.utils.plotting.plotAssemblyTypes(blueprints, fileName=None, assems=None, maxAssems=None, showBlockAxMesh=True) matplotlib.figure.Figure [source]¶
Generate a plot showing the axial block and enrichment distributions of each assembly type in the core.
- Parameters
blueprints (Blueprints) – The blueprints to plot assembly types of.
fileName (str or None) – Base for filename to write, or None for just returning the fig
assems (list) – list of assembly objects to be plotted.
maxAssems (integer) – maximum number of assemblies to plot in the assems list.
showBlockAxMesh (bool) – if true, the axial mesh information will be displayed on the right side of the assembly plot.
- Returns
fig – The figure object created
- Return type
plt.Figure
- armi.utils.plotting.plotBlockFlux(core, fName=None, bList=None, peak=False, adjoint=False, bList2=[])[source]¶
Produce energy spectrum plot of real and/or adjoint flux in one or more blocks.
- Parameters
core (Core) – Core object
fName (str, optional) – the name of the plot file to produce. If none, plot will be shown. A text file with the flux values will also be generated if this is non-empty.
bList (iterable, optional) – is a single block or a list of blocks to average over. If no bList, full core is assumed.
peak (bool, optional) – a flag that will produce the peak as well as the average on the plot.
adjoint (bool, optional) – plot the adjoint as well.
bList2 – a separate list of blocks that will also be plotted on a separate axis on the same plot. This is useful for comparing flux in some blocks with flux in some other blocks.
Notes
This is not a great method. It should be cleand up and migrated into
utils.plotting
.
- armi.utils.plotting.makeHistogram(x, y)[source]¶
Take a list of x and y values, and return a histogram-ified version Good for plotting multigroup flux spectrum or cross sections
- armi.utils.plotting.plotBlockDiagram(block, fName, cold, cmapName='RdYlBu', materialList=None)[source]¶
Given a Block with a spatial Grid, plot the diagram of it with all of its components. (wire, duct, coolant, etc…)
- Parameters
block (block object) –
fName (String) – name of the file to save to
cold (boolean) – true is for cold temps, hot is false.
cmapName (String) – name of a colorMap to use for block colors
materialList (List) – a list of material names across all blocks to be plotted so that same material on all diagrams will have the same color.