serpentTools.objects.BranchContainer

class serpentTools.objects.BranchContainer(filePath, branchID, branchNames, stateData)

Class that stores data for a single branch.

This container acts like a dictionary, mapping UnivTuple to HomogUniv corresponding to a specific branch state. As such, there is no need for the universes dictionary that previously served this purpose. However, it is provided for compatibility but will be removed after 0.9.0

The BranchingReader stores branch variables and branched group constant data inside these container objects. These are used in turn to create HomogUniv objects for storing group constant data.

Parameters
  • filePath (str) – Path to input file from which this container was connected

  • branchID (int) – Index for the run for this branch

  • branchNames (tuple) – Name of branches provided for this universe

  • stateData (dict) – key: value pairs for branch variables

stateData

Name: value pairs for the variables defined on each branch card

Type

dict

universes

Deprecated since version 0.8.0: Treat this object as the universes dictionary instead

Type

dict

__contains__()

True if D has a key k, else False.

__getitem__()

x.__getitem__(y) <==> x[y]

__iter__()

Implement iter(self).

__len__()

Return len(self).

__setitem__(key, value)

Set self[key] to value.

clear() → None. Remove all items from D.
copy() → a shallow copy of D
fromkeys()

Returns a new dict with keys from iterable and values equal to value.

get(k[, d]) → D[k] if k in D, else d. d defaults to None.
getUniv(univID, burnup=None, index=None, days=None)

Return a specific universe given the ID and time of interest

Parameters
  • univID (str) – Unique ID for the desired universe

  • burnup (float, optional) – Burnup [MWd/kgU] of the desired universe

  • index (int, optional) – Point of interest in the burnup index

  • days (float, optional) – Point in time [d] for the desired universe

Returns

Requested universe

Return type

HomogUniv

Raises
  • KeyError – If the requested universe could not be found

  • serpentTools.SerpentToolsException – If neither burnup nor index are given

items() → a set-like object providing a view on D's items
keys() → a set-like object providing a view on D's keys
property orderedUniv

Universe keys sorted by ID and by burnup

pop(k[, d]) → v, remove specified key and return the corresponding value.

If key is not found, d is returned if given, otherwise KeyError is raised

popitem() → (k, v), remove and return some (key, value) pair as a

2-tuple; but raise KeyError if D is empty.

setdefault(k[, d]) → D.get(k,d), also set D[k]=d if k not in D
update(other)

Update with contents of another BranchContainer

values() → an object providing a view on D's values