I have a numpy 1d array like this:
a = np.array([False, True, True, True, False, True, True, False])
I want to find the index of the first True value in the array (1 in this case) and the last index of the first consecutive True sequence (3 in this case).
I actually can imagine a lot of solutions for this problem, but I'm looking for the cleanest way to solve this task. For simplicity assume that there is almost one True in the array
some other examples could be useful (expected output as #comment):
[False, True, True] # 1, 2
[True, True, True, False, True, True, False] # 0, 2
[False, True, True, True] # 1, 3
[False, True, False, True] # 1, 1