To be more clear, let me reword my question that I initially asked below.
I have a series of data points that rise and fall in amplitude as someone takes a step and then another step. Zero is when the foot is off the ground.
A simple example would look like this:
data_array = (0,0,0,10,20,50,40,30,10,0,0,0,0,0,10,20,50,40,30,10,0,0)
I determine when each step starts and stop by recording the starts (all the indexes that start) in one array and the stops in another array.
starts = (4 15)
stops = (9 20)
THE QUESTION: Now, I want to slice the actual data for each step out of the initial array and them in columns.
[Note: That, if necessary, we know the number of steps taken by the amount of data in the starts or stops arrays.]
10 10
20 20
50 50
40 40
30 30
10 10
I can not figure out how to use those starts and stops indices to slice the initial array. OR, I did not find a filter function to slice out the steps.
BTW (2nd Edit) Here is some of the code I am using if it helps:
sigma = 5
threshold = 30
above_threshold = gaussian_filter(Fz, sigma=sigma) > threshold
#---INDEX ALL STATE CHANGES---
ind = np.where(np.diff(above_threshold))[0] + 1
print ind
ORIGINAL QUESTION
In this type of array:
data_array = (0,0,0,10,20,50,40,30,10,0,0)
I determine when values are above 20 and below 20. I return those indexes as starts (going above 20) and stops (going below 20) by making the following:
startstop = np.vstack((ind[::2], ind[1::2])).T
starts1=np.vstack((ind[::2])).T
stops1=np.vstack((ind[1::2])).T
Can someone point me in the right direction using numpy (or not) so that I can extract all those values in data_array using one of these arrays (startstop, starts1, stops1) to get this:
new_array = (50,40,30)
Thanks, Scott