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_mesh(mesh)[source]

Add a mesh to the file

Deprecated since version 0.8: Meshes that appear in a tally are automatically added to the collection.

Parameters:mesh (openmc.Mesh) – Mesh to add to the file
add_tally(tally, merge=False)[source]

Append tally to collection

Deprecated since version 0.8: Use Tallies.append() instead.

Parameters:
  • tally (openmc.Tally) – Tally to add
  • merge (bool) – Indicate whether the tally should be merged with an existing tally, if possible. Defaults to False.
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()[source]

Create a tallies.xml file that can be used for a simulation.

insert(index, item)[source]

Insert tally before index

Parameters:
merge_tallies()[source]

Merge any mergeable tallies together. Note that n-way merges are possible.

remove_mesh(mesh)[source]

Remove a mesh from the file

Deprecated since version 0.8: Meshes do not need to be managed explicitly.

Parameters:mesh (openmc.Mesh) – Mesh to remove from the file
remove_tally(tally)[source]

Remove a tally from the collection

Deprecated since version 0.8: Use Tallies.remove() instead.

Parameters:tally (openmc.Tally) – Tally to remove