mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-28 14:15:42 -04:00
suggestions from code review by @paulromano
Co-authored-by: Paul Romano <paul.k.romano@gmail.com>
This commit is contained in:
parent
9847d053f3
commit
3a2d4a9138
2 changed files with 6 additions and 4 deletions
|
|
@ -7,6 +7,7 @@ from .checkvalue import check_filetype_version
|
|||
from .source import SourceParticle, ParticleType
|
||||
|
||||
from pathlib import Path
|
||||
|
||||
ParticleTrack = namedtuple('ParticleTrack', ['particle', 'states'])
|
||||
ParticleTrack.__doc__ = """\
|
||||
Particle track information
|
||||
|
|
@ -266,7 +267,7 @@ class Tracks(list):
|
|||
track.plot(ax)
|
||||
return ax
|
||||
|
||||
def write_tracks_to_vtk(self, filename=Path('tracks.vtk')):
|
||||
def write_tracks_to_vtk(self, filename=Path('tracks.vtp')):
|
||||
"""Creates a VTP file of the tracks
|
||||
|
||||
Parameters
|
||||
|
|
|
|||
|
|
@ -144,6 +144,7 @@ def test_filter(sphere_model, run_in_tmpdir):
|
|||
|
||||
|
||||
def test_write_tracks_to_vtk(sphere_model):
|
||||
vtk = pytest.importorskip('vtk')
|
||||
# Set maximum number of tracks per process to write
|
||||
sphere_model.settings.max_tracks = 25
|
||||
sphere_model.settings.photon_transport = True
|
||||
|
|
@ -152,7 +153,7 @@ def test_write_tracks_to_vtk(sphere_model):
|
|||
generate_track_file(sphere_model, tracks=True)
|
||||
|
||||
tracks = openmc.Tracks('tracks.h5')
|
||||
filename = tracks.write_tracks_to_vtk('tracks.vtk')
|
||||
polydata = tracks.write_tracks_to_vtk('tracks.vtp')
|
||||
|
||||
assert filename == 'tracks.vtk'
|
||||
assert Path('tracks.vtk').is_file()
|
||||
assert isinstance(polydata, vtk.vtkPolyData)
|
||||
assert Path('tracks.vtp').is_file()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue