Hello, I am getting this error message when I try to use track mode and plot particle tracks. This is the only attribute I get an error for. Any ideas why?
The Tracks
class, which it sounds like you’re trying to use, was added in version 0.13.1 (which was released a little more than a week ago). If you are using an older of OpenMC, you’ll need to upgrade first.
Thank you, it’s solved. However, in version 0.13.0, when running in track mode, I would automatically get a *.h5 file for every track individually. Now, I only get one file with all the tracks. It helps a lot in making my folder clean, but now I am having a hard time making a VTK file for an individual particle track.
For for example:
tracks = openmc.Tracks('tracks.h5')
track1 = tracks[0]
one_particle = track1.particle_tracks[0]
Any guidance on how I could convert this one particle track to vtk?
I tried tracks1.write_to_vtk('one_particle.vtp')
, but it did not work.
AttributeError: 'Track' object has no attribute 'write_to_vtk'
Ah yes, that’s a good point. It’s still possible although it requires a little Python trickery. Because the Tracks
class inherits from the basic Python list
class, you can actually modify it in-place to reduce to a single track:
tracks = openmc.Tracks('tracks.h5')
# limit to first particle
tracks[:] = [tracks[0]]
tracks.write_to_vtk(...)