From d905033c477e153a4353e1308ebc226ebba3b376 Mon Sep 17 00:00:00 2001 From: Zineb Aly <zaly@km3net.de> Date: Wed, 30 Sep 2020 13:27:51 +0200 Subject: [PATCH] adapt best_track to sliced tracks --- km3io/tools.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/km3io/tools.py b/km3io/tools.py index 2827f82..5cf69a1 100644 --- a/km3io/tools.py +++ b/km3io/tools.py @@ -302,7 +302,11 @@ def best_track(tracks, strategy="default", rec_type=None): if strategy not in options: raise ValueError("{} not in {}".format(strategy, options)) - n_events = len(tracks) + try: + n_events = len(count_nested(tracks.lik, axis=1)) + except ValueError: + n_events = 1 + if n_events > 1 and any(count_nested(tracks.lik, axis=1) == 0): raise ValueError( "'events' should not contain empty tracks. Consider applying the mask: events.n_tracks>0" -- GitLab