Commit cb750153 authored by Julia Garriga Ferrer's avatar Julia Garriga Ferrer
Browse files

[io][utils] Add function to read nexus file with components

parent 9e2e1e43
......@@ -72,6 +72,23 @@ def advancement_display(iteration, total, prefix='', suffix='', decimals=1, leng
print()
def read_process(h5_file):
with h5py.File(h5_file, "r") as nx:
# find the default NXentry group
nx_entry = nx[nx.attrs["default"]]
# find the default NXdata group
nx_process = nx_entry["process_1"]
input_data = nx_process["input"]
dimensions = {}
for key in input_data.keys():
dimensions[key] = numpy.array(list(input_data[key]))
results = nx_process["results"]
components = numpy.array(list(results["components"]))
W = numpy.array(list(results["W"]))
return dimensions, components, W
def write_process(h5_file, entry, dimensions, W, data, processing_order,
data_path='/', overwrite=True):
"""
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment