serpentTools.samplers.DepletionSampler¶
-
class
serpentTools.samplers.
DepletionSampler
(files)¶ Class that reads and stores data from multiple
*dep.m
filesThe following checks are performed in order to ensure that depletion files are of similar form:
Keys of
materials
dictionary are consistent for all parsersMetadata keys are consistent for all parsers
Isotope names and ZZAAA metadata are equal for all parsers
These tests can be skipped by settings
<sampler.skipPrecheck>
to beFalse
.- Parameters
files (str or iterable) – Single file or iterable (list) of files from which to read. Supports file globs,
*dep.m
expands to all files that end withdep.m
-
days
¶ Vector of points in time
- Type
-
burnup
¶ Nominal burnup in MWd/kgU
- Type
-
materials
¶ Dictionary with material names as keys and the corresponding
DepletedMaterial
class for that material as values- Type
-
metadata
¶ Dictionary with file-wide data names as keys and the corresponding data, e.g.
'zai'
: [list of zai numbers]Deprecated since version 0.9.3: Use attributes like
days
directly- Type
-
allMdata
¶ Dictionary where key, value pairs are name of metadata and metadata arrays for all runs. Arrays with be of one greater dimension, as the first index corresponds to the file index.
- Type
-
free
()¶ Remove all parsers and individual containers from memory
-
iterMaterials
()¶ Yields material names and objects
-
plot
(xUnits, yUnits=None, timePoints=None, names=None, zai=None, materials=None, ax=None, legend=None, logx=False, logy=False, loglog=False, labelFmt=None, xlabel=None, ylabel=None, ncol=1, **kwargs)¶ Plot properties for all materials in this file together.
- Parameters
xUnits (str) – If
xUnits
is given andyUnits
isNone
, then the plotted data will bexUnits
against'days'
name of x value to obtain, e.g.'days'
,'burnup'
yUnits (str) – name of y value to return, e.g.
'adens'
,'ingTox'
If given, select the time points according to those specified here. Otherwise, select all points
Deprecated since version 0.7.0: Will plot against all time points
names (str or list or None) – If given, plot values corresponding to these isotope names. Otherwise, plot values for all isotopes.
If given, plot values corresponding to these isotope
ZZAAAI
values. Otherwise, plot for all isotopesNew in version 0.5.1.
materials (None or list) – Selection of materials from
self.materials
to plot. If None, plot all materials, potentially includingtot
ax (
matplotlib.axes.Axes
, optional) – Ax on which to plot the data. If not provided, create a new plotlegend (bool or str or None) – Automatically label the plot. No legend will be made if a single item is plotted. Pass one of the following values to place the legend outside the plot: above, right
xlabel (str or bool, optional) – Label to apply to the x-axis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label. Otherwise, usexUnits
ylabel (str or bool, optional) – Label to apply to the y-axis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label. Otherwise, useyUnits
logx (bool) – Apply a log scale to x axis.
logy (bool) – Apply a log scale to y axis.
loglog (bool) – Apply a log scale to both axes.
labelFmt (str, optional) –
Formattable string for labeling the individual plots. If not given, just label as isotope name, e.g.
'U235'
. Will make the following substitutions on thelabelFmt
string, if given:Keyword
Replacement
'mat'
name of this material
'iso'
specific isotope name
'zai'
specific isotope ZZAAAI
ncol (int) – Integer number of columns to apply to the legend.
kwargs (dict, optional) – Addition keyword arguments to pass to
matplotlib.pyplot.plot()
- Returns
Ax on which the data was plotted.
- Return type
See also
str.format()
- used for formatting labels
- Raises
KeyError – If x axis units are not
'days'
nor'burnup'
SerpentToolsException – If the materials dictionary does not contain any items
-
process
()¶ Process the repeated files to obtain true uncertainties
-
read
()¶ Read all the files and create parser objects