Skip to content

Commit c62d1a1

Browse files
authored
Merge pull request #568 from OpenCOMPES/mpes_speedup_timed_df
Speedup mpes timed dataframes
2 parents 55da2c1 + eb67d39 commit c62d1a1

File tree

1 file changed

+1
-5
lines changed

1 file changed

+1
-5
lines changed

src/sed/loader/mpes/loader.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -221,7 +221,6 @@ def hdf5_to_timed_dataframe(
221221

222222
electron_channels = []
223223
column_names = []
224-
225224
for name, channel in channels.items():
226225
if channel["format"] == "per_electron":
227226
if channel["dataset_key"] in test_proc:
@@ -465,16 +464,13 @@ def hdf5_to_timed_array(
465464
# Delayed array for loading an HDF5 file of reasonable size (e.g. < 1GB)
466465

467466
h5file = load_h5_in_memory(h5filename)
468-
469467
# Read out groups:
470468
data_list = []
471469
ms_marker = np.asarray(h5file[ms_markers_key])
472470
for channel in channels:
473-
timed_dataset = np.zeros_like(ms_marker)
474471
if channel["format"] == "per_electron":
475472
g_dataset = np.asarray(h5file[channel["dataset_key"]])
476-
for i, point in enumerate(ms_marker):
477-
timed_dataset[i] = g_dataset[int(point) - 1]
473+
timed_dataset = g_dataset[np.maximum(ms_marker - 1, 0)]
478474
else:
479475
raise ValueError(
480476
f"Invalid 'format':{channel['format']} for channel {channel['dataset_key']}.",

0 commit comments

Comments
 (0)