openmc.Track¶
- class openmc.Track(dset)[source]¶
Tracks resulting from a single source particle
This class stores information for all tracks resulting from a primary source particle and any secondary particles that it created. The track for each primary/secondary particle is stored in the
particle_tracks
attribute.New in version 0.13.1.
- Parameters
dset (h5py.Dataset) – Dataset to read track data from
- Variables
identifier (tuple) – Tuple of (batch, generation, particle number)
particle_tracks (list) – List of tuples containing (particle type, array of track states)
sources (list) – List of
SourceParticle
representing each primary/secondary particle
- filter(particle=None, state_filter=None)[source]¶
Filter particle 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
New instance with only matching
openmc.ParticleTrack
objects- Return type
Examples
Get all particle tracks for photons:
>>> track.filter(particle='photon')
Get all particle tracks that entered cell with ID=15:
>>> track.filter(state_filter=lambda s: s['cell_id'] == 15)
Get all particle tracks in entered material with ID=2:
>>> track.filter(state_filter=lambda s: s['material_id'] == 2)
See also
- plot(axes=None)[source]¶
Produce a 3D plot of particle tracks
- Parameters
axes (matplotlib.axes.Axes, optional) – Axes for plot
- Returns
axes – Axes for plot
- Return type