openmc.Tallies
- class openmc.Tallies(tallies=None)[source]
Collection of Tallies used for an OpenMC simulation.
This class corresponds directly to the tallies.xml input file. It can be thought of as a normal Python list where each member is a
Tally. It behaves like a list as the following example demonstrates:>>> t1 = openmc.Tally() >>> t2 = openmc.Tally() >>> t3 = openmc.Tally() >>> tallies = openmc.Tallies([t1]) >>> tallies.append(t2) >>> tallies += [t3]
- Parameters:
tallies (Iterable of openmc.Tally) – Tallies to add to the collection
- add_results(statepoint: str | PathLike | StatePoint)[source]
Add results from the provided statepoint file
Added in version 0.15.1.
- Parameters:
statepoint (openmc.PathLike or openmc.StatePoint) – Statepoint used to update tally results
- append(tally, merge=False)[source]
Append tally to collection
- Parameters:
tally (openmc.Tally) – Tally to append
merge (bool) – Indicate whether the tally should be merged with an existing tally, if possible. Defaults to False.
- export_to_xml(path='tallies.xml')[source]
Create a tallies.xml file that can be used for a simulation.
- Parameters:
path (str) – Path to file to write. Defaults to ‘tallies.xml’.
- classmethod from_xml(path='tallies.xml')[source]
Generate tallies from XML file
- Parameters:
path (str, optional) – Path to tallies XML file
- Returns:
Tallies object
- Return type:
- classmethod from_xml_element(elem, meshes=None)[source]
Generate tallies from an XML element
- Parameters:
elem (lxml.etree._Element) – XML element
meshes (dict or None) – A dictionary with mesh IDs as keys and mesh instances as values that have already been read from XML. Pre-existing meshes are used and new meshes are added to when creating tally objects.
- Returns:
Tallies object
- Return type:
- insert(index, item)[source]
Insert tally before index
- Parameters:
index (int) – Index in list
item (openmc.Tally) – Tally to insert