From c761468490cc8a49fdd3410d89ab174a75eb4fa7 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: Wed, 18 Jun 2025 08:39:45 +0200 Subject: [PATCH] Edit maxwell_integrate_to_h5.py --- maxwell_integrate_to_h5.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/maxwell_integrate_to_h5.py b/maxwell_integrate_to_h5.py index c4bf4cd..2871b0b 100644 --- a/maxwell_integrate_to_h5.py +++ b/maxwell_integrate_to_h5.py @@ -188,9 +188,9 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"): results_df = results_df.sort_values(by="filename", key=lambda col: col.str.lower()) results_metadata_df = results_metadata_df.sort_values(by="filename", key=lambda col: col.str.lower()) - for key in results_metadata_df.columns + for key in results_metadata_df.columns: if key not in results_df.columns: - results_df[key] = results_metadata_df[key].value + results_df[key] = results_metadata_df[key].values subdir_name = os.path.basename(os.path.normpath(subdir_path_int)) results_df.to_csv(os.path.join(subdir_path_int, f"{subdir_name}.csv"), index=False) @@ -252,15 +252,15 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"): image_sequence_number = results_metadata[idx-1].get("imageSequenceNumber", "").strip() if width.isdigit(): - detector.create_dataset("pixels width", data=np.asarray(int(width), dtype=np.int64)) + detector.create_dataset("pixels width", data=np.asarray([int(width)], dtype=np.int64)) if height.isdigit(): - detector.create_dataset("pixels height", data=np.asarray(int(height), dtype=np.int64)) + detector.create_dataset("pixels height", data=np.asarray([int(height)], dtype=np.int64)) if exposure_time.isdigit(): - detector.create_dataset("exposure time", data=np.asarray(int(exposure_time), dtype=np.int64)) + detector.create_dataset("exposure time", data=np.asarray([int(exposure_time)], dtype=np.int64)) if summed_exposures.replace('.', '', 1).isdigit(): - detector.create_dataset("summed exposures", data=np.asarray(float(summed_exposures), dtype=np.float64)) + detector.create_dataset("summed exposures", data=np.asarray([float(summed_exposures)], dtype=np.float64)) if image_sequence_number.isdigit(): - detector.create_dataset("image sequence number", data=np.asarray(int(image_sequence_number), dtype=np.int64)) + detector.create_dataset("image sequence number", data=np.asarray([int(image_sequence_number)], dtype=np.int64)) # Add interpretation info (optional for PyMca) detector["I"].attrs["interpretation"] = "spectrum" -- GitLab