combine_slices

glue.utils.array.combine_slices(slice1, slice2, length)[source]

Given two slices that can be applied to a 1D array and the length of that array, this returns a new slice which is the one that should be applied to the array instead of slice2 if slice1 has already been applied.

Parameters
slice1slice

The first slice (only positive step sizes allowed).

slice2slice

The second slice (only positive step sizes allowed).

lengthint

The length of the array on which the combined slice is to be applied.