class serpentTools.BranchingReader(filePath)

Parser responsible for reading and working with automated branching files.


filePath (str) – path to the depletion file


Dictionary of branch names and their corresponding BranchContainer objects




Check if a branch is stored on the reader


key (str or iterable of str) – Name of the branch as defined in the Serpent input file


Flag indicating the presence of key

Return type



Return a specific branch from branches


key (str or iterable of str) – Branch name as defined in Serpent input


Branch corresponding to key

Return type



Iterate over all branch names


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 than lower percent different that the same quantity on this object, consider this allowable and make no messages. Quantities that are greater than upper percent different will have a error messages printed and the comparison will return False, but continue. Quantities with difference between these ranges will have warning messages printed.

  • 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.


True if the objects are in agreement with each other according to the parameters specified

Return type


  • TypeError – If other is not of the same class as this class nor a subclass of this class

  • ValueError – 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

  • key (str or iterable of str) – Branch name as defined in Serpent input

  • default (object, optional) – Item to return if key is not found


BranchContainer if key is found. default if not

Return type


property hasUncs

boolean if uncertainties are present in the file


Iterate over key, branch pairs from branches


Iterate over branches yielding paired branch IDs and containers

Deprecated since version 0.9.3: Use items() instead


The main method for reading that not only parses data, but also runs pre and post checks.