Skip to content
Snippets Groups Projects
Commit 3f2a713f authored by User's avatar User
Browse files

[add]: docstring for h5reader.py

parent baf8e909
No related branches found
No related tags found
1 merge request!3[add]: hdf5 file reader: h5reader.py
Pipeline #212424 passed
......@@ -2,12 +2,30 @@
import h5py
def open_hdf5_file(filename):
'''
Open hdf5 file
arguments
filename of the hdf5 file
returns
h5py.File object
'''
return h5py.File(filename)
def get_item_by_path(dataset, path):
'''
Get item by path
arguments
dataset: h5py.File object
path: path of the item
returns
item
'''
indice = path.split('/')
indice_length = len(indice)
try:
......@@ -31,6 +49,15 @@ def get_item_by_path(dataset, path):
return dataset
def get_structure_tree(h5_object):
'''
Get structure tree of the hdf5 file
arguments
h5_object: h5py.File object
returns
string representation of the structure tree
'''
def print_attrs(name, obj):
nonlocal string_pointer
level = name.count('/')
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment