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. 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]}"