Advertisement
Guest User

Untitled

a guest
Jan 18th, 2019
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import h5py
  2. import km3pipe as kp
  3.  
  4. f = h5py.File('concatenated.h5', 'r')
  5. p = kp.io.hdf5.HDF5Pump(filename='concatenated.h5', shuffle=False)
  6.  
  7. #-- Print info of h5 with h5py --#
  8. print(f['group_info'][()])
  9. # array([(2, 0), (2, 1), (2, 2), (2, 3), (2, 4), (2, 5), (2, 6), (2, 7),
  10. #       (2, 8), (2, 9)],
  11. #      dtype=[('blob_length', '<i8'), ('group_id', '<i8')])
  12.  
  13. print(f['group_info'][0])
  14. # -----> (2, 0)
  15.  
  16. print(f['y'][0]['event_id'])
  17. # -----> 3.0
  18.  
  19. #-- Print info of h5 with HDF5Pump --#
  20. print(p[0]['GroupInfo'])
  21. # GroupInfo <class 'km3pipe.dataclasses.Table'>
  22. # HDF5 location: /group_info (no split)
  23. # <i8 (dtype: blob_length) = [2]
  24. # <i8 (dtype: group_id) = [0] <----
  25.  
  26. print(p[0]['Y']['event_id'])
  27. # -----> [2.]
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement