Is there a good way to find stretches of Trues in a numpy boolean array? If I have an array like:
x = numpy.array([True,True,False,True,True,False,False])
Can I get an array of indices like:
starts = [0,3]
ends = [1,4]
or any other appropriate way to store this information. I know this can be done with some complicated while loops, but I'm looking for a better way.