H5Glance demo

In [1]:
import h5py
In [2]:
# Create some example HDF5 data to show
f = h5py.File("example.h5", "w")
f.create_dataset("/group1/subgroup1/dataset1", (200,), dtype='u8')
f.create_dataset("/group1/subgroup1/dataset2", (2, 128, 500), dtype='f4')
f.create_dataset("/group1/subgroup2/dataset1", (12,), dtype='i2')

# Basic h5py repr
f
Out[2]:
<HDF5 file "example.h5" (mode r+)>

Use H5Glance explicitly

In [3]:
from h5glance import H5Glance
H5Glance(f)
Out[3]:
        • dataset1 [📋]: 200 entries, dtype: uint64
        • dataset2 [📋]: 2 × 128 × 500 entries, dtype: float32
        • dataset1 [📋]: 12 entries, dtype: int16
In [4]:
H5Glance(f['group1/subgroup1'])
Out[4]:
    • dataset1 [📋]: 200 entries, dtype: uint64
    • dataset2 [📋]: 2 × 128 × 500 entries, dtype: float32

View all h5py objects

Install a display hook for IPython so all h5py files & groups are viewed this way.

In [5]:
import h5glance
h5glance.install_ipython_h5py_display()
In [6]:
f
Out[6]:
        • dataset1 [📋]: 200 entries, dtype: uint64
        • dataset2 [📋]: 2 × 128 × 500 entries, dtype: float32
        • dataset1 [📋]: 12 entries, dtype: int16
In [7]:
f['group1']
Out[7]:
      • dataset1 [📋]: 200 entries, dtype: uint64
      • dataset2 [📋]: 2 × 128 × 500 entries, dtype: float32
      • dataset1 [📋]: 12 entries, dtype: int16
In [ ]: