-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
from ipytree import Tree, Node
import h5py
import numpy as np
def nwb_ipytree(fpath, driver=None):
file = h5py.File(fpath, mode="r", driver=driver)
return Tree(nodes=[add_elem(value) for value in file.values()])
def add_elem(elem, cls=Node):
name = elem.name.split('/')[-1]
if isinstance(elem, h5py.Group):
return cls(name=name, nodes=[add_elem(value) for value in elem.values()], opened=False)
elif isinstance(elem, h5py.Dataset):
if elem.dtype == np.object:
icon = 'font'
else:
icon = 'table'
return cls(name=name, icon=icon, icon_style='info')
else:
return cls(name)
fpath = "/Users/bendichter/Downloads/136_20170325_576um_360um_170325_125511_stub.nwb"
nwb_ipytree(fpath)Metadata
Metadata
Assignees
Labels
No labels
