From 7fe9778cc0b22f139b900a9b0311940f9bea7ff2 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Tue, 4 Feb 2025 15:01:20 +0100 Subject: [PATCH 1/2] Fix telescope grouping for uint telescope id --- src/ctapipe/instrument/subarray.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/ctapipe/instrument/subarray.py b/src/ctapipe/instrument/subarray.py index f66bce99702..1cd94495e38 100644 --- a/src/ctapipe/instrument/subarray.py +++ b/src/ctapipe/instrument/subarray.py @@ -37,7 +37,7 @@ def _group_consecutives(sequence): from https://codereview.stackexchange.com/questions/214820/codewars-range-extraction """ sequence = sorted(sequence) - for _, g in groupby(enumerate(sequence), lambda i_x: i_x[0] - i_x[1]): + for _, g in groupby(enumerate(sequence), lambda i_x: int(i_x[0]) - int(i_x[1])): r = [x for _, x in g] if len(r) > 2: yield f"{r[0]}-{r[-1]}" From 03b639d7ba89f91d6d97e0edb4018ba875da0b00 Mon Sep 17 00:00:00 2001 From: Maximilian Linhoff Date: Wed, 5 Feb 2025 12:04:18 +0100 Subject: [PATCH 2/2] Add changelog --- docs/changes/2692.bugfix.rst | 2 ++ 1 file changed, 2 insertions(+) create mode 100644 docs/changes/2692.bugfix.rst diff --git a/docs/changes/2692.bugfix.rst b/docs/changes/2692.bugfix.rst new file mode 100644 index 00000000000..3546851841d --- /dev/null +++ b/docs/changes/2692.bugfix.rst @@ -0,0 +1,2 @@ +Fix the function grouping telescope ids into ranges for +the case of unsigned integer telescope ids.