ptypy.io.h5rw.h5read#

ptypy.io.h5rw.h5read(filename)#
ptypy.io.h5rw.h5read(filename, s1, s2, ...) None
ptypy.io.h5rw.h5read(filename, (s1, s2, ...)) None

Read variables from a hdf5 file created with h5write and returns them as a dictionary.

If specified, only variable named s1, s2, … are loaded.

Variable names support slicing and group access. For instance, provided that the file contains the appropriate objects, the following syntax is valid:

a = h5read(‘file.h5’, ‘myarray[2:4]’) a = h5read(‘file.h5’, ‘adict.thekeyIwant’)

Another way of slicing, is with the slice keyword argument, which will take the provided slice object and apply it on the last variable name:

a = h5read(‘file.h5’, ‘array1’, ‘array2’, slice=slice(1,2)) # Will read array2[1:2]

h5read(filename_with_wildcard, … , doglob=True) Reads sequentially all globbed filenames.