I have a 1-D numpy array a = [1,2,3,4,5,6] and a function that gets two inputs, starting_index and ending_index, and returns a[stari
a = [1,2,3,4,5,6]
starting_index
ending_index
a[stari
This circles forever.
def circular_indices(lb, ub, thresh): indices = [] while True: stop = min(ub, thresh) ix = np.arange(lb, stop) indices.append(ix) if stop != ub: diff = ub - stop lb = 0 ub = diff else: break return np.concatenate(indices)