Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
XRD
darfix
Commits
f24da3f5
Commit
f24da3f5
authored
Feb 10, 2020
by
Julia Garriga Ferrer
Browse files
[io][utils] Add function to read nexus file with components
parent
48a26c39
Changes
1
Hide whitespace changes
Inline
Side-by-side
darfix/io/utils.py
View file @
f24da3f5
...
...
@@ -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
):
"""
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment