serpentTools.samplers.DepletionSampler

class serpentTools.samplers.DepletionSampler(files)

Class that reads and stores data from multiple *dep.m files

The following checks are performed in order to ensure that depletion files are of similar form:

  1. Keys of materials dictionary are consistent for all parsers

  2. Metadata keys are consistent for all parsers

  3. Isotope names and ZZAAA metadata are equal for all parsers

These tests can be skipped by settings <sampler.skipPrecheck> to be False.

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 with dep.m

days

Vector of points in time

Type

numpy.ndarray or None

burnup

Nominal burnup in MWd/kgU

Type

numpy.ndarray or None

names

Names of isotopes corresponding to each row in the 2D arrays

Type

list of str or None

zais

ZZAAAI identifiers for isotopes

Type

list of int or None

materials

Dictionary with material names as keys and the corresponding DepletedMaterial class for that material as values

Type

dict

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

dict

metadataUncs

Dictionary containing uncertainties in day and burnup vectors

Type

dict

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

dict

files

Unordered set containing full paths of unique files read

Type

set

settings

Dictionary of sampler-wide settings

Type

dict

parsers

Unordered set of all parsers that were successful

Type

set

map

Dictionary where key, value pairs are files and their corresponding parsers

Type

dict

__getitem__(name)

Retrieve a material from materials.

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 and yUnits is None, then the plotted data will be xUnits against 'days' name of x value to obtain, e.g. 'days', 'burnup'

  • yUnits (str) – name of y value to return, e.g. 'adens', 'ingTox'

  • timePoints (list or None) –

    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.

  • zai (int or list or None) –

    If given, plot values corresponding to these isotope ZZAAAI values. Otherwise, plot for all isotopes

    New in version 0.5.1.

  • materials (None or list) – Selection of materials from self.materials to plot. If None, plot all materials, potentially including tot

  • ax (matplotlib.axes.Axes, optional) – Ax on which to plot the data. If not provided, create a new plot

  • legend (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 not None but evaluates to False, do not label. Otherwise, use xUnits

  • 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 not None but evaluates to False, do not label. Otherwise, use yUnits

  • 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 the labelFmt 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

matplotlib.axes.Axes

See also

Raises
process()

Process the repeated files to obtain true uncertainties

read()

Read all the files and create parser objects