From dac285929ff6655e3e5945c00fa1a8df6324bcf0 Mon Sep 17 00:00:00 2001 From: Jacan Chaplais Date: Tue, 28 Nov 2023 17:28:04 +0000 Subject: [PATCH] throw error when tagging if not enough clusters #168 --- graphicle/select.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/graphicle/select.py b/graphicle/select.py index e828ea6..4aeb71c 100644 --- a/graphicle/select.py +++ b/graphicle/select.py @@ -1376,6 +1376,11 @@ def monte_carlo_tag( if clustered_pmu is None: clustered_pmu = particles.pmu[particles.final] ref_length = "particles.final" + if len(cluster_masks) < len(hard_pmu): + raise ValueError( + f"shape mismatch: only {len(cluster_masks)} clusters " + f"passed to tag {len(hard_pmu)} partons." + ) if len(clustered_pmu) != len(cluster_masks[0]): raise ValueError( "shape mismatch: length of elements in cluster_masks must be the "