serpentTools.objects.HomogUniv¶

class
serpentTools.objects.
HomogUniv
(name, bu, step, day)¶ Class for storing homogenized universe specifications and retrieving them
 Parameters

gcUnc
¶ Relative uncertainties for group constants that do not fit the
INF_
norB1_
pattern Type

reshaped
¶ True
if scattering matrices have been reshaped to square matrices. Otherwise, these matrices are stored as vectors. Type

groups
¶ Group boundaries from highest to lowest
 Type
None or
numpy.array

microGroups
¶ Micro group structure used to produce group constants. Listed from lowest to highest
 Type
None or
numpy.array
 Raises
serpentTools.messages.SerpentToolsException – If a negative value of burnup, step, or burnup days is passed

__getitem__
(gcname)¶ Return just the group constant with this name, no uncertainty
To return data with uncertainties, or to return uncertainties, use
get()
.

__setitem__
(gckey, gcvalue)¶ Set the expected value of gckey to be gcvalue
No conversions are placed on the variable name. What you pass is what gets set. For uncertainties, or to convert variable names to
mixedCase
, useaddData()
.Much like a dictionary, this will overwrite existing data.
 Parameters
gckey (str) – Group constant name. If it begins with
inf
, value will be placed ininfExp
. If it begins withb1
, the value will be placed inb1Exp
. Otherwise it will be placed ingc
gcvalue (numpy.ndarray) – Corresponding group constant

addData
(variableName, variableValue, uncertainty=False)¶ Sets the value of the variable and, optionally, the associate s.d.
New in version 0.5.0: Reshapes scattering matrices according to setting
xs.reshapeScatter
. Matrices are of the form \(S[i, j]=\Sigma_{s,i\rightarrow j}\)Warning
This method will overwrite data for variables that already exist

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

compareAttributes
(other, lower=0, upper=10, sigma=2)¶ Compare attributes like group structure and burnup. Return the result
 Parameters
other (
HomogUniv
) – Universe against which to comparelower (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
 Returns
True
if the attributes agree within specifications Return type
bools
 Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this class

compareB1Data
(other, sigma)¶ Return
True
if contents ofb1Exp
andb1Unc
agree Parameters
other (
HomogUniv
) – Object from which to grab group constant dictionariessigma (int) – Size of confidence interval to apply to quantities with uncertainties. Quantities that do not have overlapping confidence intervals will fail
Returns –
bool – If the dictionaries contain identical values with uncertainties, and if those values have overlapping confidence intervals
 Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this class

compareGCData
(other, sigma)¶ Return
True
if contents ofgcExp
andgcUnc
agree Parameters
other (
HomogUniv
) – Object from which to grab group constant dictionariessigma (int) – Size of confidence interval to apply to quantities with uncertainties. Quantities that do not have overlapping confidence intervals will fail
Returns –
bool – If the dictionaries contain identical values with uncertainties, and if those values have overlapping confidence intervals
 Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this class

compareInfData
(other, sigma)¶ Return
True
if contents ofinfExp
andinfUnc
agree Parameters
other (
HomogUniv
) – Object from which to grab group constant dictionariessigma (int) – Size of confidence interval to apply to quantities with uncertainties. Quantities that do not have overlapping confidence intervals will fail
Returns –
bool – If the dictionaries contain identical values with uncertainties, and if those values have overlapping confidence intervals
 Raises
TypeError – If
other
is not of the same class as this class nor a subclass of this class

get
(variableName, uncertainty=False)¶ Gets the value of the variable VariableName from the dictionaries
 Parameters
 Returns
x – Variable Value
dx – Associated uncertainty if
uncertainty
 Raises
See also

hasData
()¶ Return True if data is stored on the object.

plot
(qtys, limitE=True, ax=None, logx=None, logy=None, loglog=None, sigma=3, xlabel=None, ylabel=None, legend=None, ncol=1, steps=True, labelFmt=None, labels=None, **kwargs)¶ Plot homogenized data as a function of energy.
 Parameters
qtys (str or iterable) – Plot this or these value against energy.
limitE (bool) – If given, set the maximum energy value to be that of the micro group structure. By default, SERPENT macro group structures can reach 1E37, leading for a very large tail on the plots.
ax (
matplotlib.axes.Axes
, optional) – Ax on which to plot the data. If not provided, create a new plotlabels (None or iterable) – Labels to apply to each line drawn. This can be used to identify which bin is plotted as what line.
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.
sigma (int) – Confidence interval to apply to errors. If not given or
0
, no errors will be drawn.xlabel (str or bool, optional) – Label to apply to the xaxis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.ylabel (str or bool, optional) – Label to apply to the yaxis. If given as
None
, a label will be determined from other arguments. If notNone
but evaluates toFalse
, do not label.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
ncol (int) – Integer number of columns to apply to the legend.
steps (bool) – If
True
, plot values as constant within energy bins.labelFmt (str, optional) –
Formattable string for labeling the individual plots.
String
Replaced value
{k}
Name of variable plotted
{u}
Name of this universe
{b}
Value of burnup in MWd/kgU
{d}
Value of burnup in days
{i}
Burnup index
kwargs (dict, optional) – Addition keyword arguments to pass to
matplotlib.pyplot.plot()
ormatplotlib.pyplot.errorbar()
 Returns
Ax on which the data was plotted.
 Return type