Skip to content

Commit

Permalink
Change warning to exception catch
Browse files Browse the repository at this point in the history
  • Loading branch information
gondiaz committed Sep 1, 2021
1 parent 939e91f commit 77bc843
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions invisible_cities/io/mcinfo_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,16 +132,12 @@ def safe_copy_nexus_eventmap(h5out : tb.file.File,
'evt_number': the evt_number copied to the output;
'nexus_evt' : the nexus event_ids copied to the output.
"""
# Suppress warning raised when table not
# present since case dealt with in try except.
with warnings.catch_warnings():
warnings.simplefilter("ignore", category=UserWarning)
evt_map = load_eventnumbermap(file_in)
try:
evt_map = load_eventnumbermap(file_in)
evt_mask = evt_map.evt_number.isin(evt_arr)
df_writer(h5out, evt_map[evt_mask], 'Run', 'eventMap')
return evt_map[evt_mask].to_dict('list')
except AttributeError:
except (AttributeError, tb.exceptions.NoSuchNodeError):
## Invoked when the eventMap table not found
## which occurs for pre-2020 MC files and
## at the first processing stage from nexus
Expand Down

0 comments on commit 77bc843

Please sign in to comment.