Skip to content

Commit

Permalink
fix get_count_rate and get_elapsed_time
Browse files Browse the repository at this point in the history
  • Loading branch information
rettigl committed Nov 19, 2024
1 parent ebd1234 commit a783232
Showing 1 changed file with 21 additions and 11 deletions.
32 changes: 21 additions & 11 deletions sed/loader/mpes/loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -927,13 +927,18 @@ def get_count_rate(
count_rate_list = []
accumulated_time = 0
for fid in fids:
count_rate_, secs_ = get_count_rate(
h5py.File(self.files[fid]),
ms_markers_group=ms_markers_group,
)
secs_list.append((accumulated_time + secs_).T)
count_rate_list.append(count_rate_.T)
accumulated_time += secs_[-1]
try:
count_rate_, secs_ = get_count_rate(
h5py.File(self.files[fid]),
ms_markers_group=ms_markers_group,
)
secs_list.append((accumulated_time + secs_).T)
count_rate_list.append(count_rate_.T)
accumulated_time += secs_[-1]
except OSError as exc:
if "Unable to synchronously open file" in str(exc):
print(f"Unable to open file {fid}: {str(exc)}")
pass

count_rate = np.concatenate(count_rate_list)
secs = np.concatenate(secs_list)
Expand Down Expand Up @@ -967,10 +972,15 @@ def get_elapsed_time(self, fids: Sequence[int] = None, **kwds) -> float:

secs = 0.0
for fid in fids:
secs += get_elapsed_time(
h5py.File(self.files[fid]),
ms_markers_group=ms_markers_group,
)
try:
secs += get_elapsed_time(
h5py.File(self.files[fid]),
ms_markers_group=ms_markers_group,
)
except OSError as exc:
if "Unable to synchronously open file" in str(exc):
print(f"Unable to open file {fid}: {str(exc)}")
pass

return secs

Expand Down

0 comments on commit a783232

Please sign in to comment.