Skip to content

Commit

Permalink
Warn but don't crash on missing key in differ
Browse files Browse the repository at this point in the history
  • Loading branch information
EinarElen authored and tomeichlersmith committed Nov 3, 2023
1 parent 08daea2 commit d46acea
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion Validation/src/Validation/_differ.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
# external dependencies
import matplotlib.pyplot as plt
import matplotlib
import uproot
# us
from ._file import File

Expand Down Expand Up @@ -110,7 +111,11 @@ def plot1d(self, column, xlabel,
ax = fig.subplots()

for f in self.files :
weights, bins, patches = f.plot1d(ax, column, **hist_kwargs)
try:
weights, bins, patches = f.plot1d(ax, column, **hist_kwargs)
except uproot.KeyInFileError:
f.log.warn(f"Key {column} doesn't exist in {self}, skipping")
continue

ax.set_xlabel(xlabel)
ax.set_ylabel(ylabel)
Expand Down

0 comments on commit d46acea

Please sign in to comment.