openmc.Tracks

class openmc.Tracks(filepath='tracks.h5')[source]

Collection of particle tracks

This class behaves like a list and can be indexed using the normal subscript notation. Each element in the list is a openmc.Track object.

New in version 0.13.1.

Parameters

filepath (str or pathlib.Path) – Path of file to load

static combine(track_files, path='tracks.h5')[source]

Combine multiple track files into a single track file

Parameters
  • track_files (list of path-like) – Paths to track files to combine

  • path (path-like) – Path of combined track file to create

filter(particle=None, state_filter=None)[source]

Filter tracks by given criteria

Parameters
  • particle ({'neutron', 'photon', 'electron', 'positron'}) – Matching particle type

  • state_filter (function) – Function that takes a state (structured datatype) and returns a bool depending on some criteria.

Returns

List of openmc.Track objects

Return type

Tracks

plot()[source]

Produce a 3D plot of particle tracks

Returns

Axes for plot

Return type

matplotlib.axes.Axes

write_to_vtk(filename=PosixPath('tracks.vtp'))[source]

Creates a VTP file of the tracks

Parameters

filename (path-like) – Name of the VTP file to write.

Returns

the VTK vtkPolyData object produced

Return type

vtk.vtkPolyData