Read the data as numpy array from the h5py file?

I want to read the three dimensional data from a h5py as a numpy array.

61.42836  61.42836   8.47704

Answer

When reading, use the index slicing provided by h5py, which is a great feature. This line

with h5py.File('File') as f:
   data = np.array(f['group/data']) 
#reads the whole (some GB large) dataset at once. However, #if you do

   data = f['group/data']

then you can ‘treat’ data as a numpy array (although it is an h5py object). For example, data[3] would yield the 4th sample (and read only this piece of data), whereas data[:, 5] would read and return the full trajectory of particle.