Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
L
Live integration
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Koziej Lab
X-ray Diffraction
PDF
Live integration
Commits
51dc5ce6
Commit
51dc5ce6
authored
2 weeks ago
by
Gröne, Tjark Leon Raphael
Browse files
Options
Downloads
Patches
Plain Diff
Update file maxwell_integrate_to_h5.py
parent
91ec1538
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
maxwell_integrate_to_h5.py
+113
-114
113 additions, 114 deletions
maxwell_integrate_to_h5.py
with
113 additions
and
114 deletions
maxwell_integrate_to_h5.py
+
113
−
114
View file @
51dc5ce6
...
...
@@ -181,7 +181,7 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
# Use a lambda function to pass the subdir_path_int to the integration_thread
# Map async allows us to run the integration in parallel, with trace back of varibles
async_result
=
pool
.
map_async
(
lambda
fname_im
:
integration_thread
(
fname_im
,
subdir_path_int
),
lambda
fname_im
:
integration_thread
(
fname_im
),
filtered_fnames
)
...
...
@@ -261,10 +261,7 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
for
idx
,
result
in
enumerate
(
results_data
,
start
=
1
):
# Drop unfinished scans (usually last scan due to closed shutter)
if
not
result
[
"
q
"
].
size
or
not
result
[
"
I
"
].
size
:
print
(
f
"
Skipping invalid scan data for entry
{
entry_name
}
"
)
continue
try
:
# Here one could use the image sequence number from the metadata, however, we use the index as it seemes cleaner
entry_name
=
f
"
{
idx
:
05
d
}
.1
"
...
...
@@ -273,8 +270,6 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
entry
[
"
title
"
]
=
"
Collected Q-I scans
"
entry
.
attrs
[
"
NX_class
"
]
=
"
NXentry
"
# Set time attributes for the entry
entry
.
create_dataset
(
"
time
"
,
data
=
results_metadata
[
idx
-
1
][
"
dateString
"
].
encode
(
'
utf-8
'
),
dtype
=
h5py
.
string_dtype
(
encoding
=
'
utf-8
'
))
...
...
@@ -376,6 +371,10 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
if
idx
==
len
(
results_data
):
# mark the last one as global default
entry
[
"
last_plot
"
]
=
h5py
.
SoftLink
(
f
"
/
{
subdir_name
}
/
{
entry_name
}
/measurement
"
)
except
Exception
as
e
:
print
(
f
"
Error processing file
{
result
[
'
filename
'
]
}
:
{
e
}
"
)
continue
print
(
f
"
✅ HDF5 file
'
{
output_file
}
'
created with
{
len
(
results_data
)
}
spectra.
"
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment