Skip to content
Snippets Groups Projects
Commit 1dc0d3cc authored by Gröne, Tjark Leon Raphael's avatar Gröne, Tjark Leon Raphael
Browse files

Update file maxwell_integrate_to_h5.py

parent 51dc5ce6
Branches
No related tags found
No related merge requests found
...@@ -267,6 +267,8 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"): ...@@ -267,6 +267,8 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
# Create a new entry for each scan # Create a new entry for each scan
entry = h5.create_group(entry_name) entry = h5.create_group(entry_name)
try:
entry["title"] = "Collected Q-I scans" entry["title"] = "Collected Q-I scans"
entry.attrs["NX_class"] = "NXentry" entry.attrs["NX_class"] = "NXentry"
...@@ -372,7 +374,13 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"): ...@@ -372,7 +374,13 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
entry["last_plot"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/measurement") entry["last_plot"] = h5py.SoftLink(f"/{subdir_name}/{entry_name}/measurement")
except Exception as e: except Exception as e:
print(f"Error processing file {result['filename']}: {e}") print(f"Error processing file {result['filename']} in entry {entry_name}: {e}")
# Delete incomplete group if something failed inside it
del h5[entry_name]
continue
except Exception as outer_e:
print(f"Failed to create entry group {entry_name}: {outer_e}")
continue continue
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment