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
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’.
insert(index, item)[source]

Insert tally before index

Parameters:
merge_tallies()[source]

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