Skip to content

Commit

Permalink
Use lazy pmap reader in cities
Browse files Browse the repository at this point in the history
  • Loading branch information
gonzaponte committed Nov 6, 2024
1 parent 4a7445c commit 4a3d334
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions invisible_cities/cities/components.py
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ def wf_from_files(paths, wf_type):
def pmap_from_files(paths):
for path in paths:
try:
pmaps = load_pmaps(path)
pmaps = load_pmaps(path, lazy=True)
except tb.exceptions.NoSuchNodeError:
continue

Expand All @@ -511,11 +511,11 @@ def pmap_from_files(paths):
except IndexError:
continue

check_lengths(event_info, pmaps)

for evtinfo in event_info:
for evtinfo, (evt, pmap) in zip(event_info, pmaps):
event_number, timestamp = evtinfo.fetch_all_fields()
yield dict(pmap=pmaps[event_number], run_number=run_number,
if event_number != evt:
raise RuntimeError("Inconsistent data: event number mismatch")
yield dict(pmap=pmap, run_number=run_number,
event_number=event_number, timestamp=timestamp)


Expand Down

0 comments on commit 4a3d334

Please sign in to comment.