Merge pull request #1712 from pshriwise/h5py_update

Update Dataset.value calls for h5py v3.0
This commit is contained in:
Paul Romano 2020-10-31 12:23:06 -05:00 committed by GitHub
commit e11364257c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 14 additions and 14 deletions

View file

@ -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,:])

View file

@ -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()

View file

@ -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()

View file

@ -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()