From 1e2735df93787664bda58273c009e6d85b824a59 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Fri, 30 Oct 2020 23:20:05 -0500 Subject: [PATCH 1/2] Updating h5py calls in the plot test files. --- tests/regression_tests/plot/test.py | 8 ++++---- tests/regression_tests/plot_overlaps/test.py | 8 ++++---- tests/regression_tests/plot_voxel/test.py | 10 +++++----- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/tests/regression_tests/plot/test.py b/tests/regression_tests/plot/test.py index bfaef019c..a6f7306a0 100644 --- a/tests/regression_tests/plot/test.py +++ b/tests/regression_tests/plot/test.py @@ -42,10 +42,10 @@ class PlotTestHarness(TestHarness): # Add voxel data to results with h5py.File(fname, 'r') as fh: outstr += fh.attrs['filetype'] - outstr += fh.attrs['num_voxels'].tostring() - outstr += fh.attrs['lower_left'].tostring() - outstr += fh.attrs['voxel_width'].tostring() - outstr += fh['data'].value.tostring() + outstr += fh.attrs['num_voxels'].tobytes() + outstr += fh.attrs['lower_left'].tobytes() + outstr += fh.attrs['voxel_width'].tobytes() + outstr += fh['data'][()].tobytes() # Hash the information and return. sha512 = hashlib.sha512() diff --git a/tests/regression_tests/plot_overlaps/test.py b/tests/regression_tests/plot_overlaps/test.py index d8c0943cf..62236081b 100644 --- a/tests/regression_tests/plot_overlaps/test.py +++ b/tests/regression_tests/plot_overlaps/test.py @@ -42,10 +42,10 @@ class PlotTestHarness(TestHarness): # Add voxel data to results with h5py.File(fname, 'r') as fh: outstr += fh.attrs['filetype'] - outstr += fh.attrs['num_voxels'].tostring() - outstr += fh.attrs['lower_left'].tostring() - outstr += fh.attrs['voxel_width'].tostring() - outstr += fh['data'].value.tostring() + outstr += fh.attrs['num_voxels'].tobytes() + outstr += fh.attrs['lower_left'].tobytes() + outstr += fh.attrs['voxel_width'].tobytes() + outstr += fh['data'][()].tobytes() # Hash the information and return. sha512 = hashlib.sha512() diff --git a/tests/regression_tests/plot_voxel/test.py b/tests/regression_tests/plot_voxel/test.py index d2767e2f1..3b7a6bef2 100644 --- a/tests/regression_tests/plot_voxel/test.py +++ b/tests/regression_tests/plot_voxel/test.py @@ -23,7 +23,7 @@ class PlotVoxelTestHarness(TestHarness): check_call(['../../../scripts/openmc-voxel-to-vtk'] + glob.glob('plot_4.h5')) - + def _test_output_created(self): """Make sure *.ppm has been created.""" for fname in self._plot_names: @@ -44,10 +44,10 @@ class PlotVoxelTestHarness(TestHarness): # Add voxel data to results with h5py.File(fname, 'r') as fh: outstr += fh.attrs['filetype'] - outstr += fh.attrs['num_voxels'].tostring() - outstr += fh.attrs['lower_left'].tostring() - outstr += fh.attrs['voxel_width'].tostring() - outstr += fh['data'].value.tostring() + outstr += fh.attrs['num_voxels'].tobytes() + outstr += fh.attrs['lower_left'].tobytes() + outstr += fh.attrs['voxel_width'].tobytes() + outstr += fh['data'][()].tobytes() # Hash the information and return. sha512 = hashlib.sha512() From 2d94535627a1aeeb6578eb6816ca4c127ab6b1f4 Mon Sep 17 00:00:00 2001 From: Patrick Shriwise Date: Sat, 31 Oct 2020 00:20:00 -0500 Subject: [PATCH 2/2] Another .value replacement in the track-to-vtk script. --- scripts/openmc-track-to-vtk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scripts/openmc-track-to-vtk b/scripts/openmc-track-to-vtk index fa154a2a7..3c781d19e 100755 --- a/scripts/openmc-track-to-vtk +++ b/scripts/openmc-track-to-vtk @@ -46,7 +46,7 @@ def main(): n_coords = track.attrs['n_coords'] coords = [] for i in range(n_particles): - coords.append(track['coordinates_' + str(i + 1)].value) + coords.append(track['coordinates_' + str(i + 1)][()]) for j in range(n_coords[i]): points.InsertNextPoint(coords[i][j,:])