serpentTools.BranchingReader¶
-
class
serpentTools.
BranchingReader
(filePath)¶ Parser responsible for reading and working with automated branching files.
- Parameters
filePath (str) – path to the depletion file
-
branches
¶ Dictionary of branch names and their corresponding
BranchContainer
objects- Type
-
__contains__
(key)¶ Check if a branch is stored on the reader
-
__getitem__
(key)¶ Return a specific branch from
branches
- Parameters
key (str or iterable of str) – Branch name as defined in Serpent input
- Returns
Branch corresponding to
key
- Return type
-
__iter__
()¶ Iterate over all branch names
-
__len__
()¶ Number of branches stored on the reader
-
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)¶ Return a branch that may or may not exist in
branches
- Parameters
- Returns
BranchContainer
ifkey
is found.default
if not- Return type
-
property
hasUncs
¶ boolean if uncertainties are present in the file
-
iterBranches
()¶ Iterate over branches yielding paired branch IDs and containers
Deprecated since version 0.9.3: Use
items()
instead
-
read
()¶ The main method for reading that not only parses data, but also runs pre and post checks.