Skip to content

Speedup mpes timed dataframes #568

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 4, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/sed/loader/mpes/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,6 @@ def hdf5_to_timed_dataframe(

electron_channels = []
column_names = []

for name, channel in channels.items():
if channel["format"] == "per_electron":
if channel["dataset_key"] in test_proc:
Expand Down Expand Up @@ -468,16 +467,13 @@ def hdf5_to_timed_array(
# Delayed array for loading an HDF5 file of reasonable size (e.g. < 1GB)

h5file = load_h5_in_memory(h5filename)

# Read out groups:
data_list = []
ms_marker = np.asarray(h5file[ms_markers_key])
for channel in channels:
timed_dataset = np.zeros_like(ms_marker)
if channel["format"] == "per_electron":
g_dataset = np.asarray(h5file[channel["dataset_key"]])
for i, point in enumerate(ms_marker):
timed_dataset[i] = g_dataset[int(point) - 1]
timed_dataset = g_dataset[np.maximum(ms_marker - 1, 0)]
else:
raise ValueError(
f"Invalid 'format':{channel['format']} for channel {channel['dataset_key']}.",
Expand Down
Loading