serpentTools.objects.DepletedMaterial¶
-
class
serpentTools.objects.
DepletedMaterial
(name, metadata)¶ Base class for storing material data from a depleted material file
Many of the instance attributes are shortcuts for accessing data in the underlying dictionary. For example, the following command fetch the same data:
>>> m.data["adens"] >>> m["adens"] >>> m.adens
With one exception: the attribute-based accessing is guaranteed to not raise an error if the data has not been loaded into the dictionary. This may be the case if a file was read using filtering settings and
adens
was not read.-
zai
¶ Isotopic ZZAAAI identifiers like
922350
. Ordered like the rows of the data arrays- Type
list of int
-
names
¶ Isotope names like
"U235"
. Ordered like the rows of the data arrays- Type
list of str
-
days
¶ Time in days for each column in the data arrays
- Type
-
burnup
¶ Burnup vector for this specific material
- Type
-
volume
¶ Volume of this material over time
- Type
-
adens
¶ 2D array of atom densities in atoms/b-cm
- Type
-
mdens
¶ 2D array of mass densites in g/cm3
- Type
-
activity
¶ 2D array of activities in Bq
- Type
-
decayHeat
¶ 2D array of decay heats in W
- Type
-
spontaneousFissionRate
¶ 2D array of spontaneous fission rate in fission per second
- Type
-
photonProdRate
¶ 2D array of photon emission rate in photons per second
- Type
-
ingTox
¶ 2D array of ingestion toxicity in sieverts
- Type
-
inhTox
¶ 2D array of inhalation toxicity in sieverts
- Type
-
__getitem__
(item)¶ Retrieve a value from the data dictionary
-
addData
(variable, rawData)¶ Add data straight from the file onto a variable.
-
compare
(other, lower=0, upper=10, sigma=2, verbosity=None)¶ Compare the results of this reader to another.
For values without uncertainties, the upper and lower arguments control what passes and what messages get raised. If a quantity in
other
is less thanlower
percent different that the same quantity on this object, consider this allowable and make no messages. Quantities that are greater thanupper
percent different will have a error messages printed and the comparison will returnFalse
, but continue. Quantities with difference between these ranges will have warning messages printed.- Parameters
other – Other reader instance against which to compare. Must be a similar class as this one.
lower (float or int) – Lower limit for relative tolerances in percent Differences below this will be considered allowable
upper (float or int) – Upper limit for relative tolerances in percent. Differences above this will be considered failure and errors messages will be raised
sigma (int) – Size of confidence interval to apply to quantities with uncertainties. Quantities that do not have overlapping confidence intervals will fail
verbosity (None or str) – If given, update the verbosity just for this comparison.
- Returns
True
if the objects are in agreement with each other according to the parameters specified- Return type
- Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this classValueError – If upper > lower, If sigma, lower, or upper are negative
-
get
(key, default=None)¶ Retrieve a value from the dictionary, or default if not found
- Parameters
- Returns
numpy.ndarray
ifkey
was found, otherwisedefault
- Return type
-
getValues
(xUnits, yUnits, timePoints=None, names=None, zai=None)¶ Return material variable data at specified time points and isotopes
If the quantity
yUnits
corresponds to a vector in thedata
dictionary, e.g.burnup
orvolume
, and not something that varies by isotope, thennames
does not have to be given- Parameters
xUnits (str) – name of x value to obtain, e.g.
'days'
,'burnup'
yUnits (str) – name of y value to return, e.g.
'adens'
,'burnup'
timePoints (list or None) – If given, select the time points according to those specified here. Otherwise, select all points
names (str or list or None) – If given, return y values corresponding to these isotope names. Otherwise, return values for all isotopes.
If given, return y values corresponding to isotopes with these
ZZAAAI
as would be present inself.zai
. Otherwise, return values for all isotopes.New in version 0.5.1.
- Returns
Array of values.
- Return type
numpy.array
- Raises
AttributeError – If the names of the isotopes have not been obtained and specific isotopes have been requested
KeyError – If at least one of the days requested is not present
TypeError – If both
names
andzai
arguments are passedValueError – If one isotope cannot be found
-
plot
(xUnits, yUnits=None, timePoints=None, names=None, zai=None, ax=None, legend=None, xlabel=None, ylabel=None, logx=False, logy=False, loglog=False, labelFmt=None, ncol=1, title=None, **kwargs)¶ Plot some data as a function of time for some or all isotopes.
Note
kwargs
will be passed to the plot for all isotopes. Ifc='r'
is passed, to make a plot red, then data for all isotopes plotted will be red and potentially very confusing.- Parameters
xUnits (str) – name of x value to obtain, e.g.
'days'
,'burnup'
IfxUnits
is given andyUnits
isNone
, then the plotted data will bexUnits
against'days'
yUnits (str) – name of y value to return, e.g.
'adens'
,'burnup'
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.
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.
title (str) – Title to apply to the figure.
kwargs (dict, optional) – Addition keyword arguments to pass to
matplotlib.pyplot.plot()
- Returns
Ax on which the data was plotted.
- Return type
See also
getValues()
str.format()
- used for formatting labels
-
toDataFrame
(quantity, names=None, zai=None, time='days', multiIndex=False)¶ Create a pandas DataFrame for a property of interest
If
names
andzai
are not provided, then the isotope names will be used as the columns.- Parameters
quantity (str) – Either a key in
data
or the string name of an attribute likephotonProdRate
forphotonProdRate
names (sequence of str, optional) – Specific isotope names to obtain. Not compatible with
zai
zai (sequence of int, optional) – Specific isotope zai to obtain. Not compatible with
names
time ({"days", "burnup", "step"}, optional) – What array to use for the index or rows of the DataFrame. Defaults to using
days
, but"burnup"
can be passed to useburnup
, if it is present. The value of"step"
will simply create a basic index that starts at 0 and increments by one per row
- Returns
2D tabulated representation of the requested array. Columns reflect isotopes, rows represent points in time
- Return type
-