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

Update file maxwell_integrate_to_h5.py

parent f24ba87c
No related branches found
No related tags found
No related merge requests found
...@@ -122,6 +122,12 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"): ...@@ -122,6 +122,12 @@ def integrate_ims_in_dir(path_im, path_int, dtype_im=".tif", dtype_int=".dat"):
subdir_name = os.path.basename(os.path.normpath(subdir_path_int)) 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) results_df.to_csv(os.path.join(subdir_path_int, f"{subdir_name}.csv"), index=False)
results_df.to_hdf(os.path.join(subdir_path_int, f"{subdir_name}.h5"), key='data', mode='w') results_df.to_hdf(os.path.join(subdir_path_int, f"{subdir_name}.h5"), key='data', mode='w')
with pd.HDFStore(os.path.join(subdir_path_int, f"{subdir_name}.h5"), mode='w') as hdf_store:
for result in results_data:
filename_key = os.path.basename(result["filename"])
hdf_store.put(f"measurements/{filename_key}/q", pd.Series(result["q"]))
hdf_store.put(f"measurements/{filename_key}/I", pd.Series(result["I"]))
hdf_store.put(f"measurements/{filename_key}/dI", pd.Series(result["dI"]))
print(f"Results for subdirectory {subdir_name} saved to CSV and HDF5 files.") print(f"Results for subdirectory {subdir_name} saved to CSV and HDF5 files.")
del results_df del results_df
else: else:
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment