7 parser = argparse.ArgumentParser()
8 parser.add_argument(
"a")
9 parser.add_argument(
"b")
10 parser.add_argument(
"--event-nr", default=
"event_nr")
11 parser.add_argument(
"--fail-fast", action=
"store_true")
12 args = parser.parse_args()
14 a_data = uproot.open(args.a)
15 b_data = uproot.open(args.b)
16 event_nr = args.event_nr
17 fail_fast = args.fail_fast
19 a_sort_index = np.argsort(a_data[event_nr].
array(library=
"np"), kind=
"stable")
20 b_sort_index = np.argsort(b_data[event_nr].
array(library=
"np"), kind=
"stable")
22 np.set_printoptions(linewidth=np.inf)
29 elif type(a) == np.ndarray:
30 if not np.array_equal(a, b, equal_nan=
True):
33 for aa, bb
in zip(a, b):
41 for key
in a_data.keys():
45 a_vals = a_data[key].
array(library=
"np")
46 a_vals = a_vals[a_sort_index]
48 b_vals = b_data[key].
array(library=
"np")
49 b_vals = b_vals[b_sort_index]
53 print(f
"event {event} failed for {key}")
60 failed_events.add(event)
63 if failed_events
or failed_keys:
65 print(
"failed events: " +
" ".
join(map(str, sorted(failed_events))))
66 print(
"failed keys: " +
" ".
join(failed_keys))