From 17a12b81f591c2fc86a7b373a838739881b09531 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Gr=C3=B6ne=2C=20Tjark=20Leon=20Raphael?=
<tjark.leon.raphael.groene@uni-hamburg.de>
Date: Tue, 17 Jun 2025 11:01:43 +0200
Subject: [PATCH] Update file maxwell_integrate_to_h5.py
---
maxwell_integrate_to_h5.py | 14 ++++++--------
1 file changed, 6 insertions(+), 8 deletions(-)
diff --git a/maxwell_integrate_to_h5.py b/maxwell_integrate_to_h5.py
index a2bb63f..69acb6a 100644
--- a/maxwell_integrate_to_h5.py
+++ b/maxwell_integrate_to_h5.py
@@ -167,9 +167,9 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
meas.attrs["axes"] = "q"
meas.attrs["filename"] = result["filename"]
- meas["I"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/instrument/detector/I")
- meas["q"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/instrument/detector/q")
- meas["dI"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/instrument/detector/dI")
+ meas["I"] = h5py.SoftLink(f"/{entry_name}/instrument/detector/I")
+ meas["q"] = h5py.SoftLink(f"/{entry_name}/instrument/detector/q")
+ meas["dI"] = h5py.SoftLink(f"/{entry_name}/instrument/detector/dI")
# Optional display-friendly names
meas["I"].attrs["long_name"] = "Intensity"
@@ -181,8 +181,8 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
plotselect.attrs["signal"] = "I"
plotselect.attrs["axes"] = "q"
- plotselect["I"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/instrument/detector/I")
- plotselect["q"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/instrument/detector/q")
+ plotselect["I"] = h5py.SoftLink(f"/{entry_name}/instrument/detector/I")
+ plotselect["q"] = h5py.SoftLink(f"/{entry_name}/instrument/detector/q")
# Optional display-friendly names
plotselect["I"].attrs["long_name"] = "Intensity"
@@ -255,9 +255,7 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
# plot.create_dataset("dI", data=result["dI"])
# plot["dI"].attrs["long_name"] = np.string_("Uncertainty in I")
-
- h5.flush()
- h5.close()
+
print(f"✅ HDF5 file '{output_file}' created with {len(results_data)} spectra.")
# # Sort results_data by filename
# def natural_sort_key(item):
--
GitLab